feat(opentelemetry-js): infer zipkin service name from resource#1138
feat(opentelemetry-js): infer zipkin service name from resource#1138mayurkale22 merged 9 commits intoopen-telemetry:masterfrom rezakrimi:zipkin-service-name
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 <dyladan@users.noreply.github.com>
making config object optional for zipkin Co-authored-by: Daniel Dyla <dyladan@users.noreply.github.com>
mayurkale22
left a comment
There was a problem hiding this comment.
Overall LGTM, added two comments.
| export interface ExporterConfig { | ||
| logger?: api.Logger; | ||
| serviceName: string; | ||
| serviceName?: string; |
There was a problem hiding this comment.
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.
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.
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.
I would prefer to have const for this.
There was a problem hiding this comment.
do you mean like thi?
const defaultServiceName = String(
spans[0].resource.labels[SERVICE_RESOURCE.NAME] ||
'OpenTelemetry Service');
There was a problem hiding this comment.
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.nameas zipkin service name #919Short description of the changes