-
Notifications
You must be signed in to change notification settings - Fork 821
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(opentelemetry-js): infer zipkin service name from resource #1138
Changes from 1 commit
6c113d7
e0dd742
1ce71b9
c0b56d3
42de702
ad18c21
c7cf118
edcc5f9
bfc8566
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -70,15 +70,10 @@ export class ZipkinExporter implements SpanExporter { | |
resultCallback: (result: ExportResult) => void | ||
) { | ||
if (typeof this._serviceName !== 'string') { | ||
dyladan marked this conversation as resolved.
Show resolved
Hide resolved
|
||
if ( | ||
typeof spans[0].resource.labels[SERVICE_RESOURCE.NAME] !== 'undefined' | ||
) { | ||
this._serviceName = spans[0].resource.labels[ | ||
SERVICE_RESOURCE.NAME | ||
].toString(); | ||
} else { | ||
this._serviceName = 'Unnamed Service'; | ||
} | ||
this._serviceName = String( | ||
spans[0].resource.labels[SERVICE_RESOURCE.NAME] || | ||
'OpenTelemetry Service' | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I would prefer to have There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. do you mean like thi?
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. No he means defining a constant somewhere like
|
||
); | ||
} | ||
this._logger.debug('Zipkin exporter export'); | ||
if (this._isShutdown) { | ||
|
@@ -105,7 +100,7 @@ export class ZipkinExporter implements SpanExporter { | |
private _toZipkinSpan(span: ReadableSpan): zipkinTypes.Span { | ||
return toZipkinSpan( | ||
span, | ||
this._serviceName, | ||
String(this._serviceName), | ||
dyladan marked this conversation as resolved.
Show resolved
Hide resolved
|
||
this._statusCodeTagName, | ||
this._statusDescriptionTagName | ||
); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It would be nice if you can update the https://github.com/rezakrimi/opentelemetry-js/tree/zipkin-service-name/packages/opentelemetry-exporter-zipkin#usage and mention "serviceName is optional and can be omitted - it will be inferred from resource and in case not provided, serviceName will default to "OpenTelemetry Service"". Something like this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How about we mention that it's completely optional to pass the config now. So the usage section will be something like:
"Install the exporter on your application and pass the options. It's optional to pass the options. If
serviceName
is omitted, it will be inferred from resource and in case not provided,serviceName
will default to "OpenTelemetry Service". Theurl
is also set tohttp://localhost:9411/api/v2/spans
by default."There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's not exactly obvious how to set the service name in the resource right now, so I would focus more on the case where you do directly set the service name: