-
Notifications
You must be signed in to change notification settings - Fork 823
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
feat(opentelemetry-js): infer zipkin service name from resource #1138
Conversation
Codecov Report
@@ Coverage Diff @@
## master #1138 +/- ##
==========================================
+ Coverage 92.31% 92.32% +0.01%
==========================================
Files 116 116
Lines 3397 3402 +5
Branches 685 689 +4
==========================================
+ Hits 3136 3141 +5
Misses 261 261
|
making service name optional for zipkin exporter Co-authored-by: Daniel Dyla <[email protected]>
making config object optional for zipkin Co-authored-by: Daniel Dyla <[email protected]>
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.
Overall LGTM, added two comments.
@@ -21,7 +21,7 @@ import * as api from '@opentelemetry/api'; | |||
*/ | |||
export interface ExporterConfig { | |||
logger?: api.Logger; | |||
serviceName: string; | |||
serviceName?: string; |
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". The url
is also set to http://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:
serviceName is an optional string. If omitted, the exporter will first try to get the service name from the Resource. If no service name can be detected on the Resource, a fallback name of "OpenTelemetry Service" will be used.
if (typeof this._serviceName !== 'string') { | ||
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 comment
The reason will be displayed to describe this comment to others. Learn more.
I would prefer to have const
for 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.
do you mean like thi?
const defaultServiceName = String(
spans[0].resource.labels[SERVICE_RESOURCE.NAME] ||
'OpenTelemetry Service');
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.
No he means defining a constant somewhere like const DEFAULT_SERVICE_NAME = 'OpenTelemetry Service'
then doing
String(spans[0].resource.labels[SERVICE_RESOURCE.NAME] || DEFAULT_SERVICE_NAME);
|
…ing open-telemetry#1136 (open-telemetry#1138) * ci: [Bug] DNS Lookup and Promise Lookup test for error NOT_FOUND failing open-telemetry#1136 * chore: automatically fix lint issue
Which problem is this PR solving?
service.name
as zipkin service name #919Short description of the changes