Skip to content

Commit d0ad8a2

Browse files
authored
Merge pull request #6 from Dharin-shah/update-opentelemetry
Update opentelemetry
2 parents 33f9492 + dc51dd1 commit d0ad8a2

File tree

4 files changed

+734
-306
lines changed

4 files changed

+734
-306
lines changed

packages/opentelemetry/lib/tracing/exporterFactory.js

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@ import { ZipkinExporter } from '@opentelemetry/exporter-zipkin';
33
import { PrometheusExporter } from '@opentelemetry/exporter-prometheus';
44
import { ConsoleSpanExporter, SpanExporter } from '@opentelemetry/tracing'; // eslint-disable-line no-unused-vars
55

6-
const DEFAULT_SERVICE_NAME = 'appium';
7-
86
const AVAILABLE_EXPORTERS = {
97
JAEGER: 'jaeger',
108
ZIPKIN: 'zipkin',
@@ -22,9 +20,9 @@ const AVAILABLE_EXPORTERS = {
2220
function buildExporter (exporterType, config = null) {
2321
switch (exporterType) {
2422
case AVAILABLE_EXPORTERS.JAEGER:
25-
return new JaegerExporter(config || { serviceName: DEFAULT_SERVICE_NAME });
23+
return new JaegerExporter(config);
2624
case AVAILABLE_EXPORTERS.ZIPKIN:
27-
return new ZipkinExporter(config || { serviceName: DEFAULT_SERVICE_NAME });
25+
return new ZipkinExporter(config || undefined);
2826
case AVAILABLE_EXPORTERS.PROMETHEUS:
2927
return new PrometheusExporter(config || {});
3028
case AVAILABLE_EXPORTERS.CONSOLE:

packages/opentelemetry/lib/tracing/tracerProvider.js

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,17 @@ import { SpanProcessor, SpanExporter } from '@opentelemetry/tracing'; // eslint-
88
import { ExporterConfig } from '@opentelemetry/exporter-jaeger'; // eslint-disable-line no-unused-vars
99
import _ from 'lodash';
1010
import { forEachPromise } from '../utils';
11+
import { Resource } from '@opentelemetry/resources';
12+
import { SemanticResourceAttributes } from '@opentelemetry/semantic-conventions';
13+
14+
const DEFAULT_SERVICE_NAME = 'appium';
1115

1216
//Delegate
1317
class TracerProvider {
14-
constructor () {
15-
this.provider = new NodeTracerProvider();
18+
constructor (serviceName = DEFAULT_SERVICE_NAME) {
19+
this.provider = new NodeTracerProvider({
20+
resource: new Resource({ [SemanticResourceAttributes.SERVICE_NAME]: serviceName }),
21+
});
1622
this.exporterInstances = {};
1723
this._currentConfig = {
1824
active: true,

0 commit comments

Comments
 (0)