From 56c032ec71c0baa0120a5cc841c015a290fad654 Mon Sep 17 00:00:00 2001 From: Daniel Dyla Date: Tue, 1 Jun 2021 15:07:13 -0400 Subject: [PATCH 01/11] chore: set default service name (#2227) --- README.md | 2 + .../src/utils/environment.ts | 2 + .../README.md | 10 +- .../src/CollectorMetricExporter.ts | 5 - .../src/CollectorTraceExporter.ts | 5 - .../test/CollectorMetricExporter.test.ts | 3 - .../test/CollectorTraceExporter.test.ts | 3 - .../test/helper.ts | 36 +- .../README.md | 8 +- .../src/CollectorMetricExporter.ts | 5 - .../src/CollectorTraceExporter.ts | 5 - .../test/CollectorMetricExporter.test.ts | 1 - .../test/CollectorTraceExporter.test.ts | 1 - .../README.md | 8 +- .../src/CollectorExporterBase.ts | 3 - .../browser/CollectorMetricExporter.ts | 5 - .../browser/CollectorTraceExporter.ts | 5 - .../platform/node/CollectorMetricExporter.ts | 5 - .../platform/node/CollectorTraceExporter.ts | 5 - .../src/transform.ts | 5 +- .../src/transformMetrics.ts | 5 +- .../src/types.ts | 1 - .../browser/CollectorMetricExporter.test.ts | 2 - .../browser/CollectorTraceExporter.test.ts | 1 - .../common/CollectorMetricExporter.test.ts | 16 - .../common/CollectorTraceExporter.test.ts | 19 - .../test/helper.ts | 58 +- .../test/node/CollectorMetricExporter.test.ts | 1 - .../test/node/CollectorTraceExporter.test.ts | 1 - .../package.json | 1 + .../src/jaeger.ts | 59 +- .../src/types.ts | 1 - .../test/jaeger.test.ts | 139 +++-- .../package.json | 4 +- .../src/zipkin.ts | 12 +- .../test/common/transform.test.ts | 29 +- .../test/node/zipkin.test.ts | 548 ++++++------------ packages/opentelemetry-metrics/src/Meter.ts | 2 +- .../src/MeterProvider.ts | 4 +- .../opentelemetry-resources/src/Resource.ts | 6 +- .../platform/browser/default-service-name.ts | 19 + .../src/platform/browser/detect-resources.ts | 2 +- .../src/platform/browser/index.ts | 1 + .../src/platform/node/default-service-name.ts | 19 + .../src/platform/node/detect-resources.ts | 2 +- .../platform/node/detectors/EnvDetector.ts | 31 +- .../src/platform/node/index.ts | 1 + .../test/Resource.test.ts | 27 +- .../opentelemetry-sdk-node/test/sdk.test.ts | 30 +- .../src/BasicTracerProvider.ts | 4 +- 50 files changed, 503 insertions(+), 664 deletions(-) create mode 100644 packages/opentelemetry-resources/src/platform/browser/default-service-name.ts create mode 100644 packages/opentelemetry-resources/src/platform/node/default-service-name.ts diff --git a/README.md b/README.md index 8164207055c..8232a4f5a52 100644 --- a/README.md +++ b/README.md @@ -232,6 +232,8 @@ To request automatic tracing support for a module not on this list, please [file - `JaegerHttpTracePropagator` renamed to `JaegerPropagator` +- `serviceName` configuration removed from Collector exporters. Use `service.name` Resource attribute instead. + ### 0.18.x to 0.19.0 - API is now a peer dependency. This means that users will need to include `@opentelemetry/api` as a dependency of their project in order to use the SDK. NPM version 7+ (Node 15+) should do this automatically. diff --git a/packages/opentelemetry-core/src/utils/environment.ts b/packages/opentelemetry-core/src/utils/environment.ts index 8e621a0d864..78b7f1f248e 100644 --- a/packages/opentelemetry-core/src/utils/environment.ts +++ b/packages/opentelemetry-core/src/utils/environment.ts @@ -76,6 +76,7 @@ export type ENVIRONMENT = { OTEL_EXPORTER_ZIPKIN_ENDPOINT?: string; OTEL_LOG_LEVEL?: DiagLogLevel; OTEL_RESOURCE_ATTRIBUTES?: string; + OTEL_SERVICE_NAME?: string; OTEL_TRACES_EXPORTER?: string; OTEL_TRACES_SAMPLER_ARG?: string; OTEL_TRACES_SAMPLER?: string; @@ -115,6 +116,7 @@ export const DEFAULT_ENVIRONMENT: Required = { OTEL_NO_PATCH_MODULES: [], OTEL_PROPAGATORS: ['tracecontext', 'baggage'], OTEL_RESOURCE_ATTRIBUTES: '', + OTEL_SERVICE_NAME: '', OTEL_SPAN_ATTRIBUTE_COUNT_LIMIT: 128, OTEL_SPAN_EVENT_COUNT_LIMIT: 128, OTEL_SPAN_LINK_COUNT_LIMIT: 128, diff --git a/packages/opentelemetry-exporter-collector-grpc/README.md b/packages/opentelemetry-exporter-collector-grpc/README.md index 840afb71042..03a1bd41c4b 100644 --- a/packages/opentelemetry-exporter-collector-grpc/README.md +++ b/packages/opentelemetry-exporter-collector-grpc/README.md @@ -13,6 +13,11 @@ This module provides exporter for web and node to be used with [opentelemetry-co npm install --save @opentelemetry/exporter-collector-grpc ``` +## Service Name + +The OpenTelemetry Collector Exporter does not have a service name configuration. +In order to set the service name, use the `service.name` resource attribute as prescribed in the [OpenTelemetry Resource Semantic Conventions][semconv-resource-service-name]. + ## Traces in Node - GRPC The CollectorTraceExporter in Node expects the URL to only be the hostname. It will not work with `/v1/traces`. @@ -22,7 +27,6 @@ const { BasicTracerProvider, SimpleSpanProcessor } = require('@opentelemetry/tra const { CollectorTraceExporter } = require('@opentelemetry/exporter-collector-grpc'); const collectorOptions = { - serviceName: 'basic-service', // url is optional and can be omitted - default is localhost:4317 url: ':', }; @@ -47,7 +51,6 @@ const { BasicTracerProvider, SimpleSpanProcessor } = require('@opentelemetry/tra const { CollectorTraceExporter } = require('@opentelemetry/exporter-collector-grpc'); const collectorOptions = { - serviceName: 'basic-service', // url is optional and can be omitted - default is localhost:4317 url: ':', credentials: grpc.credentials.createSsl(), @@ -88,7 +91,6 @@ const metadata = new grpc.Metadata(); metadata.set('k', 'v'); const collectorOptions = { - serviceName: 'basic-service', // url is optional and can be omitted - default is localhost:4317 url: ':', metadata, // // an optional grpc.Metadata object to be sent with each request @@ -114,7 +116,6 @@ The CollectorTraceExporter in Node expects the URL to only be the hostname. It w const { MeterProvider } = require('@opentelemetry/metrics'); const { CollectorMetricExporter } = require('@opentelemetry/exporter-collector-grpc'); const collectorOptions = { - serviceName: 'basic-service', // url is optional and can be omitted - default is localhost:4317 url: ':', }; @@ -161,3 +162,4 @@ Apache 2.0 - See [LICENSE][license-url] for more information. [npm-url]: https://www.npmjs.com/package/@opentelemetry/exporter-collector-grpc [npm-img]: https://badge.fury.io/js/%40opentelemetry%2Fexporter-collector-grpc.svg [opentelemetry-collector-url]: https://github.com/open-telemetry/opentelemetry-collector +[semconv-resource-service-name]: https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/resource/semantic_conventions/README.md#service diff --git a/packages/opentelemetry-exporter-collector-grpc/src/CollectorMetricExporter.ts b/packages/opentelemetry-exporter-collector-grpc/src/CollectorMetricExporter.ts index a983474cf13..84a880c16df 100644 --- a/packages/opentelemetry-exporter-collector-grpc/src/CollectorMetricExporter.ts +++ b/packages/opentelemetry-exporter-collector-grpc/src/CollectorMetricExporter.ts @@ -24,7 +24,6 @@ import { CollectorExporterNodeBase } from './CollectorExporterNodeBase'; import { getEnv } from '@opentelemetry/core'; import { validateAndNormalizeUrl } from './util'; -const DEFAULT_SERVICE_NAME = 'collector-metric-exporter'; const DEFAULT_COLLECTOR_URL = 'localhost:4317'; /** @@ -59,10 +58,6 @@ export class CollectorMetricExporter : DEFAULT_COLLECTOR_URL; } - getDefaultServiceName(config: CollectorExporterConfigNode): string { - return config.serviceName || DEFAULT_SERVICE_NAME; - } - getServiceClientType() { return ServiceClientType.METRICS; } diff --git a/packages/opentelemetry-exporter-collector-grpc/src/CollectorTraceExporter.ts b/packages/opentelemetry-exporter-collector-grpc/src/CollectorTraceExporter.ts index 91163e3406c..aae731d10c6 100644 --- a/packages/opentelemetry-exporter-collector-grpc/src/CollectorTraceExporter.ts +++ b/packages/opentelemetry-exporter-collector-grpc/src/CollectorTraceExporter.ts @@ -24,7 +24,6 @@ import { CollectorExporterConfigNode, ServiceClientType } from './types'; import { getEnv } from '@opentelemetry/core'; import { validateAndNormalizeUrl } from './util'; -const DEFAULT_SERVICE_NAME = 'collector-trace-exporter'; const DEFAULT_COLLECTOR_URL = 'localhost:4317'; /** @@ -52,10 +51,6 @@ export class CollectorTraceExporter : DEFAULT_COLLECTOR_URL; } - getDefaultServiceName(config: CollectorExporterConfigNode): string { - return config.serviceName || DEFAULT_SERVICE_NAME; - } - getServiceClientType() { return ServiceClientType.SPANS; } diff --git a/packages/opentelemetry-exporter-collector-grpc/test/CollectorMetricExporter.test.ts b/packages/opentelemetry-exporter-collector-grpc/test/CollectorMetricExporter.test.ts index 989c4a10f2f..a0cb218a7ed 100644 --- a/packages/opentelemetry-exporter-collector-grpc/test/CollectorMetricExporter.test.ts +++ b/packages/opentelemetry-exporter-collector-grpc/test/CollectorMetricExporter.test.ts @@ -131,7 +131,6 @@ const testCollectorMetricExporter = (params: TestParams) => collectorExporter = new CollectorMetricExporter({ url: 'grpcs://' + address, credentials, - serviceName: 'basic-service', metadata: params.metadata, }); // Overwrites the start time to make tests consistent @@ -169,7 +168,6 @@ const testCollectorMetricExporter = (params: TestParams) => // Need to stub/spy on the underlying logger as the 'diag' instance is global const spyLoggerWarn = sinon.stub(diag, 'warn'); collectorExporter = new CollectorMetricExporter({ - serviceName: 'basic-service', url: `http://${address}`, headers: { foo: 'bar', @@ -181,7 +179,6 @@ const testCollectorMetricExporter = (params: TestParams) => it('should warn about path in url', () => { const spyLoggerWarn = sinon.stub(diag, 'warn'); collectorExporter = new CollectorMetricExporter({ - serviceName: 'basic-service', url: `http://${address}/v1/metrics` }); const args = spyLoggerWarn.args[0]; diff --git a/packages/opentelemetry-exporter-collector-grpc/test/CollectorTraceExporter.test.ts b/packages/opentelemetry-exporter-collector-grpc/test/CollectorTraceExporter.test.ts index 0bcca66ef7c..1c91cae6a76 100644 --- a/packages/opentelemetry-exporter-collector-grpc/test/CollectorTraceExporter.test.ts +++ b/packages/opentelemetry-exporter-collector-grpc/test/CollectorTraceExporter.test.ts @@ -124,7 +124,6 @@ const testCollectorExporter = (params: TestParams) => ) : undefined; collectorExporter = new CollectorTraceExporter({ - serviceName: 'basic-service', url: 'grpcs://' + address, credentials, metadata: params.metadata, @@ -146,7 +145,6 @@ const testCollectorExporter = (params: TestParams) => // Need to stub/spy on the underlying logger as the 'diag' instance is global const spyLoggerWarn = sinon.stub(diag, 'warn'); collectorExporter = new CollectorTraceExporter({ - serviceName: 'basic-service', url: `http://${address}`, headers: { foo: 'bar', @@ -158,7 +156,6 @@ const testCollectorExporter = (params: TestParams) => it('should warn about path in url', () => { const spyLoggerWarn = sinon.stub(diag, 'warn'); collectorExporter = new CollectorTraceExporter({ - serviceName: 'basic-service', url: `http://${address}/v1/trace`, }); const args = spyLoggerWarn.args[0]; diff --git a/packages/opentelemetry-exporter-collector-grpc/test/helper.ts b/packages/opentelemetry-exporter-collector-grpc/test/helper.ts index 94591f5a2f8..6e66e5a8661 100644 --- a/packages/opentelemetry-exporter-collector-grpc/test/helper.ts +++ b/packages/opentelemetry-exporter-collector-grpc/test/helper.ts @@ -28,6 +28,7 @@ import { Resource } from '@opentelemetry/resources'; import { ReadableSpan } from '@opentelemetry/tracing'; import * as assert from 'assert'; import * as grpc from '@grpc/grpc-js'; +import { VERSION } from '@opentelemetry/core'; const meterProvider = new metrics.MeterProvider({ interval: 30000, @@ -157,11 +158,11 @@ export const mockedReadableSpan: ReadableSpan = { }, ], duration: [0, 8885000], - resource: new Resource({ + resource: Resource.default().merge(new Resource({ service: 'ui', version: 1, cost: 112.12, - }), + })), instrumentationLibrary: { name: 'default', version: '0.0.1' }, }; @@ -409,11 +410,32 @@ export function ensureResourceIsCorrect( assert.deepStrictEqual(resource, { attributes: [ { - key: 'service.name', - value: { - stringValue: 'basic-service', - value: 'stringValue', - }, + "key": "service.name", + "value": { + "stringValue": `unknown_service:${process.argv0}`, + "value": "stringValue" + } + }, + { + "key": "telemetry.sdk.language", + "value": { + "stringValue": "nodejs", + "value": "stringValue" + } + }, + { + "key": "telemetry.sdk.name", + "value": { + "stringValue": "opentelemetry", + "value": "stringValue" + } + }, + { + "key": "telemetry.sdk.version", + "value": { + "stringValue": VERSION, + "value": "stringValue" + } }, { key: 'service', diff --git a/packages/opentelemetry-exporter-collector-proto/README.md b/packages/opentelemetry-exporter-collector-proto/README.md index 4d8bee9f08e..cd22a8769b0 100644 --- a/packages/opentelemetry-exporter-collector-proto/README.md +++ b/packages/opentelemetry-exporter-collector-proto/README.md @@ -13,6 +13,11 @@ This module provides exporter for node to be used with [opentelemetry-collector] npm install --save @opentelemetry/exporter-collector-proto ``` +## Service Name + +The OpenTelemetry Collector Exporter does not have a service name configuration. +In order to set the service name, use the `service.name` resource attribute as prescribed in the [OpenTelemetry Resource Semantic Conventions][semconv-resource-service-name]. + ## Traces in Node - PROTO over http ```js @@ -20,7 +25,6 @@ const { BasicTracerProvider, SimpleSpanProcessor } = require('@opentelemetry/tra const { CollectorTraceExporter } = require('@opentelemetry/exporter-collector-proto'); const collectorOptions = { - serviceName: 'basic-service', url: '', // url is optional and can be omitted - default is http://localhost:55681/v1/traces headers: { foo: 'bar' @@ -41,7 +45,6 @@ provider.register(); const { MeterProvider } = require('@opentelemetry/metrics'); const { CollectorMetricExporter } = require('@opentelemetry/exporter-collector-proto'); const collectorOptions = { - serviceName: 'basic-service', url: '', // url is optional and can be omitted - default is http://localhost:55681/v1/metrics }; const exporter = new CollectorMetricExporter(collectorOptions); @@ -84,3 +87,4 @@ Apache 2.0 - See [LICENSE][license-url] for more information. [npm-url]: https://www.npmjs.com/package/@opentelemetry/exporter-collector-proto [npm-img]: https://badge.fury.io/js/%40opentelemetry%2Fexporter-collector-proto.svg [opentelemetry-collector-url]: https://github.com/open-telemetry/opentelemetry-collector +[semconv-resource-service-name]: https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/resource/semantic_conventions/README.md#service diff --git a/packages/opentelemetry-exporter-collector-proto/src/CollectorMetricExporter.ts b/packages/opentelemetry-exporter-collector-proto/src/CollectorMetricExporter.ts index 73c4156d3b4..76a93d98fe5 100644 --- a/packages/opentelemetry-exporter-collector-proto/src/CollectorMetricExporter.ts +++ b/packages/opentelemetry-exporter-collector-proto/src/CollectorMetricExporter.ts @@ -24,7 +24,6 @@ import { ServiceClientType } from './types'; import { CollectorExporterNodeBase } from './CollectorExporterNodeBase'; import { getEnv, baggageUtils } from '@opentelemetry/core'; -const DEFAULT_SERVICE_NAME = 'collector-metric-exporter'; const DEFAULT_COLLECTOR_URL = 'http://localhost:4317/v1/metrics'; /** @@ -69,10 +68,6 @@ export class CollectorMetricExporter : DEFAULT_COLLECTOR_URL; } - getDefaultServiceName(config: CollectorExporterNodeConfigBase): string { - return config.serviceName || DEFAULT_SERVICE_NAME; - } - getServiceClientType() { return ServiceClientType.METRICS; } diff --git a/packages/opentelemetry-exporter-collector-proto/src/CollectorTraceExporter.ts b/packages/opentelemetry-exporter-collector-proto/src/CollectorTraceExporter.ts index 4c08ddb6681..124eee5a2d4 100644 --- a/packages/opentelemetry-exporter-collector-proto/src/CollectorTraceExporter.ts +++ b/packages/opentelemetry-exporter-collector-proto/src/CollectorTraceExporter.ts @@ -24,7 +24,6 @@ import { import { ServiceClientType } from './types'; import { getEnv, baggageUtils } from '@opentelemetry/core'; -const DEFAULT_SERVICE_NAME = 'collector-trace-exporter'; const DEFAULT_COLLECTOR_URL = 'http://localhost:4317/v1/traces'; /** @@ -62,10 +61,6 @@ export class CollectorTraceExporter : DEFAULT_COLLECTOR_URL; } - getDefaultServiceName(config: CollectorExporterNodeConfigBase): string { - return config.serviceName || DEFAULT_SERVICE_NAME; - } - getServiceClientType() { return ServiceClientType.SPANS; } diff --git a/packages/opentelemetry-exporter-collector-proto/test/CollectorMetricExporter.test.ts b/packages/opentelemetry-exporter-collector-proto/test/CollectorMetricExporter.test.ts index 5f4c4447a5e..71f52a265b9 100644 --- a/packages/opentelemetry-exporter-collector-proto/test/CollectorMetricExporter.test.ts +++ b/packages/opentelemetry-exporter-collector-proto/test/CollectorMetricExporter.test.ts @@ -99,7 +99,6 @@ describe('CollectorMetricExporter - node with proto over http', () => { foo: 'bar', }, hostname: 'foo', - serviceName: 'bar', attributes: {}, url: 'http://foo.bar.com', keepAlive: true, diff --git a/packages/opentelemetry-exporter-collector-proto/test/CollectorTraceExporter.test.ts b/packages/opentelemetry-exporter-collector-proto/test/CollectorTraceExporter.test.ts index fd812f7a4ad..d33e8563b18 100644 --- a/packages/opentelemetry-exporter-collector-proto/test/CollectorTraceExporter.test.ts +++ b/packages/opentelemetry-exporter-collector-proto/test/CollectorTraceExporter.test.ts @@ -90,7 +90,6 @@ describe('CollectorTraceExporter - node with proto over http', () => { foo: 'bar', }, hostname: 'foo', - serviceName: 'bar', attributes: {}, url: 'http://foo.bar.com', keepAlive: true, diff --git a/packages/opentelemetry-exporter-collector/README.md b/packages/opentelemetry-exporter-collector/README.md index 33934ed95e1..93902d93269 100644 --- a/packages/opentelemetry-exporter-collector/README.md +++ b/packages/opentelemetry-exporter-collector/README.md @@ -13,6 +13,11 @@ This module provides exporter for web and node to be used with [opentelemetry-co npm install --save @opentelemetry/exporter-collector ``` +## Service Name + +The OpenTelemetry Collector Exporter does not have a service name configuration. +In order to set the service name, use the `service.name` resource attribute as prescribed in the [OpenTelemetry Resource Semantic Conventions][semconv-resource-service-name]. + ## Traces in Web The CollectorTraceExporter in Web expects the endpoint to end in `/v1/traces`. @@ -78,7 +83,6 @@ const { BasicTracerProvider, BatchSpanProcessor } = require('@opentelemetry/trac const { CollectorTraceExporter } = require('@opentelemetry/exporter-collector'); const collectorOptions = { - serviceName: 'basic-service', url: '', // url is optional and can be omitted - default is http://localhost:55681/v1/trace headers: { foo: 'bar' @@ -105,7 +109,6 @@ provider.register(); const { MeterProvider } = require('@opentelemetry/metrics'); const { CollectorMetricExporter } = require('@opentelemetry/exporter-collector'); const collectorOptions = { - serviceName: 'basic-service', url: '', // url is optional and can be omitted - default is http://localhost:55681/v1/metrics concurrencyLimit: 1, // an optional limit on pending requests }; @@ -159,3 +162,4 @@ Apache 2.0 - See [LICENSE][license-url] for more information. [npm-url-proto]: https://www.npmjs.com/package/@opentelemetry/exporter-collector-proto [npm-img]: https://badge.fury.io/js/%40opentelemetry%2Fexporter-collector.svg [opentelemetry-collector-url]: https://github.com/open-telemetry/opentelemetry-collector +[semconv-resource-service-name]: https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/resource/semantic_conventions/README.md#service diff --git a/packages/opentelemetry-exporter-collector/src/CollectorExporterBase.ts b/packages/opentelemetry-exporter-collector/src/CollectorExporterBase.ts index c8a4d47637b..f4705d90316 100644 --- a/packages/opentelemetry-exporter-collector/src/CollectorExporterBase.ts +++ b/packages/opentelemetry-exporter-collector/src/CollectorExporterBase.ts @@ -30,7 +30,6 @@ export abstract class CollectorExporterBase< ExportItem, ServiceRequest > { - public readonly serviceName: string; public readonly url: string; public readonly hostname: string | undefined; public readonly attributes?: SpanAttributes; @@ -43,7 +42,6 @@ export abstract class CollectorExporterBase< * @param config */ constructor(config: T = {} as T) { - this.serviceName = this.getDefaultServiceName(config); this.url = this.getDefaultUrl(config); if (typeof config.hostname === 'string') { this.hostname = config.hostname; @@ -140,6 +138,5 @@ export abstract class CollectorExporterBase< onError: (error: CollectorExporterError) => void ): void; abstract getDefaultUrl(config: T): string; - abstract getDefaultServiceName(config: T): string; abstract convert(objects: ExportItem[]): ServiceRequest; } diff --git a/packages/opentelemetry-exporter-collector/src/platform/browser/CollectorMetricExporter.ts b/packages/opentelemetry-exporter-collector/src/platform/browser/CollectorMetricExporter.ts index 4b8ce05b410..8d281e8c326 100644 --- a/packages/opentelemetry-exporter-collector/src/platform/browser/CollectorMetricExporter.ts +++ b/packages/opentelemetry-exporter-collector/src/platform/browser/CollectorMetricExporter.ts @@ -22,7 +22,6 @@ import { toCollectorExportMetricServiceRequest } from '../../transformMetrics'; import { getEnv, baggageUtils } from '@opentelemetry/core'; const DEFAULT_COLLECTOR_URL = 'http://localhost:55681/v1/metrics'; -const DEFAULT_SERVICE_NAME = 'collector-metric-exporter'; /** * Collector Metric Exporter for Web @@ -65,8 +64,4 @@ export class CollectorMetricExporter ? getEnv().OTEL_EXPORTER_OTLP_ENDPOINT : DEFAULT_COLLECTOR_URL; } - - getDefaultServiceName(config: CollectorExporterConfigBase): string { - return config.serviceName || DEFAULT_SERVICE_NAME; - } } diff --git a/packages/opentelemetry-exporter-collector/src/platform/browser/CollectorTraceExporter.ts b/packages/opentelemetry-exporter-collector/src/platform/browser/CollectorTraceExporter.ts index 8115e3a5469..305875a0883 100644 --- a/packages/opentelemetry-exporter-collector/src/platform/browser/CollectorTraceExporter.ts +++ b/packages/opentelemetry-exporter-collector/src/platform/browser/CollectorTraceExporter.ts @@ -21,7 +21,6 @@ import { toCollectorExportTraceServiceRequest } from '../../transform'; import * as collectorTypes from '../../types'; import { getEnv, baggageUtils } from '@opentelemetry/core'; -const DEFAULT_SERVICE_NAME = 'collector-trace-exporter'; const DEFAULT_COLLECTOR_URL = 'http://localhost:55681/v1/traces'; /** @@ -57,8 +56,4 @@ export class CollectorTraceExporter ? getEnv().OTEL_EXPORTER_OTLP_ENDPOINT : DEFAULT_COLLECTOR_URL; } - - getDefaultServiceName(config: CollectorExporterConfigBase): string { - return config.serviceName ?? DEFAULT_SERVICE_NAME; - } } diff --git a/packages/opentelemetry-exporter-collector/src/platform/node/CollectorMetricExporter.ts b/packages/opentelemetry-exporter-collector/src/platform/node/CollectorMetricExporter.ts index 90800cc250c..dcffc1ac955 100644 --- a/packages/opentelemetry-exporter-collector/src/platform/node/CollectorMetricExporter.ts +++ b/packages/opentelemetry-exporter-collector/src/platform/node/CollectorMetricExporter.ts @@ -21,7 +21,6 @@ import { CollectorExporterNodeBase } from './CollectorExporterNodeBase'; import { toCollectorExportMetricServiceRequest } from '../../transformMetrics'; import { getEnv, baggageUtils } from '@opentelemetry/core'; -const DEFAULT_SERVICE_NAME = 'collector-metric-exporter'; const DEFAULT_COLLECTOR_URL = 'http://localhost:55681/v1/metrics'; /** @@ -65,8 +64,4 @@ export class CollectorMetricExporter ? getEnv().OTEL_EXPORTER_OTLP_ENDPOINT : DEFAULT_COLLECTOR_URL; } - - getDefaultServiceName(config: CollectorExporterNodeConfigBase): string { - return config.serviceName || DEFAULT_SERVICE_NAME; - } } diff --git a/packages/opentelemetry-exporter-collector/src/platform/node/CollectorTraceExporter.ts b/packages/opentelemetry-exporter-collector/src/platform/node/CollectorTraceExporter.ts index f33d90400df..73544912080 100644 --- a/packages/opentelemetry-exporter-collector/src/platform/node/CollectorTraceExporter.ts +++ b/packages/opentelemetry-exporter-collector/src/platform/node/CollectorTraceExporter.ts @@ -21,7 +21,6 @@ import * as collectorTypes from '../../types'; import { toCollectorExportTraceServiceRequest } from '../../transform'; import { getEnv, baggageUtils } from '@opentelemetry/core'; -const DEFAULT_SERVICE_NAME = 'collector-trace-exporter'; const DEFAULT_COLLECTOR_URL = 'http://localhost:55681/v1/traces'; /** @@ -58,8 +57,4 @@ export class CollectorTraceExporter ? getEnv().OTEL_EXPORTER_OTLP_ENDPOINT : DEFAULT_COLLECTOR_URL; } - - getDefaultServiceName(config: CollectorExporterNodeConfigBase): string { - return config.serviceName || DEFAULT_SERVICE_NAME; - } } diff --git a/packages/opentelemetry-exporter-collector/src/transform.ts b/packages/opentelemetry-exporter-collector/src/transform.ts index 37770ef759b..0554f055f98 100644 --- a/packages/opentelemetry-exporter-collector/src/transform.ts +++ b/packages/opentelemetry-exporter-collector/src/transform.ts @@ -285,10 +285,7 @@ export function toCollectorExportTraceServiceRequest< const additionalAttributes = Object.assign( {}, - collectorTraceExporterBase.attributes, - { - 'service.name': collectorTraceExporterBase.serviceName, - } + collectorTraceExporterBase.attributes ); return { diff --git a/packages/opentelemetry-exporter-collector/src/transformMetrics.ts b/packages/opentelemetry-exporter-collector/src/transformMetrics.ts index b992a3b5ee1..424bb77a437 100644 --- a/packages/opentelemetry-exporter-collector/src/transformMetrics.ts +++ b/packages/opentelemetry-exporter-collector/src/transformMetrics.ts @@ -177,10 +177,7 @@ export function toCollectorExportMetricServiceRequest< > = groupMetricsByResourceAndLibrary(metrics); const additionalAttributes = Object.assign( {}, - collectorExporterBase.attributes, - { - 'service.name': collectorExporterBase.serviceName, - } + collectorExporterBase.attributes ); return { resourceMetrics: toCollectorResourceMetrics( diff --git a/packages/opentelemetry-exporter-collector/src/types.ts b/packages/opentelemetry-exporter-collector/src/types.ts index f0b02825f3f..d1de81259e0 100644 --- a/packages/opentelemetry-exporter-collector/src/types.ts +++ b/packages/opentelemetry-exporter-collector/src/types.ts @@ -343,7 +343,6 @@ export interface ExportServiceError { export interface CollectorExporterConfigBase { headers?: Partial>; hostname?: string; - serviceName?: string; attributes?: SpanAttributes; url?: string; concurrencyLimit?: number; diff --git a/packages/opentelemetry-exporter-collector/test/browser/CollectorMetricExporter.test.ts b/packages/opentelemetry-exporter-collector/test/browser/CollectorMetricExporter.test.ts index 5f40d55c2ef..d5208d20a0a 100644 --- a/packages/opentelemetry-exporter-collector/test/browser/CollectorMetricExporter.test.ts +++ b/packages/opentelemetry-exporter-collector/test/browser/CollectorMetricExporter.test.ts @@ -84,7 +84,6 @@ describe('CollectorMetricExporter - web', () => { beforeEach(() => { collectorExporter = new CollectorMetricExporter({ url: 'http://foo.bar.com', - serviceName: 'bar', }); // Overwrites the start time to make tests consistent Object.defineProperty(collectorExporter, '_startTime', { @@ -193,7 +192,6 @@ describe('CollectorMetricExporter - web', () => { (window.navigator as any).sendBeacon = false; collectorExporter = new CollectorMetricExporter({ url: 'http://foo.bar.com', - serviceName: 'bar', }); // Overwrites the start time to make tests consistent Object.defineProperty(collectorExporter, '_startTime', { diff --git a/packages/opentelemetry-exporter-collector/test/browser/CollectorTraceExporter.test.ts b/packages/opentelemetry-exporter-collector/test/browser/CollectorTraceExporter.test.ts index f0950cb3f27..f0b8e6a1d28 100644 --- a/packages/opentelemetry-exporter-collector/test/browser/CollectorTraceExporter.test.ts +++ b/packages/opentelemetry-exporter-collector/test/browser/CollectorTraceExporter.test.ts @@ -54,7 +54,6 @@ describe('CollectorTraceExporter - web', () => { beforeEach(() => { collectorExporterConfig = { hostname: 'foo', - serviceName: 'bar', attributes: {}, url: 'http://foo.bar.com', }; diff --git a/packages/opentelemetry-exporter-collector/test/common/CollectorMetricExporter.test.ts b/packages/opentelemetry-exporter-collector/test/common/CollectorMetricExporter.test.ts index c455c0d1ad0..63aea69a14a 100644 --- a/packages/opentelemetry-exporter-collector/test/common/CollectorMetricExporter.test.ts +++ b/packages/opentelemetry-exporter-collector/test/common/CollectorMetricExporter.test.ts @@ -41,9 +41,6 @@ class CollectorMetricExporter extends CollectorExporterBase< getDefaultUrl(config: CollectorExporterConfig) { return config.url || ''; } - getDefaultServiceName(config: CollectorExporterConfig): string { - return config.serviceName || 'collector-metric-exporter'; - } convert( metrics: MetricRecord[] ): collectorTypes.opentelemetryProto.collector.metrics.v1.ExportMetricsServiceRequest { @@ -67,7 +64,6 @@ describe('CollectorMetricExporter - common', () => { onInitSpy = sinon.stub(CollectorMetricExporter.prototype, 'onInit'); collectorExporterConfig = { hostname: 'foo', - serviceName: 'bar', attributes: {}, url: 'http://foo.bar.com', }; @@ -100,10 +96,6 @@ describe('CollectorMetricExporter - common', () => { assert.strictEqual(collectorExporter.hostname, 'foo'); }); - it('should set serviceName', () => { - assert.strictEqual(collectorExporter.serviceName, 'bar'); - }); - it('should set url', () => { assert.strictEqual(collectorExporter.url, 'http://foo.bar.com'); }); @@ -113,13 +105,6 @@ describe('CollectorMetricExporter - common', () => { beforeEach(() => { collectorExporter = new CollectorMetricExporter(); }); - - it('should set default serviceName', () => { - assert.strictEqual( - collectorExporter.serviceName, - 'collector-metric-exporter' - ); - }); }); }); @@ -201,7 +186,6 @@ describe('CollectorMetricExporter - common', () => { ); collectorExporterConfig = { hostname: 'foo', - serviceName: 'bar', attributes: {}, url: 'http://foo.bar.com', }; diff --git a/packages/opentelemetry-exporter-collector/test/common/CollectorTraceExporter.test.ts b/packages/opentelemetry-exporter-collector/test/common/CollectorTraceExporter.test.ts index d104fd26c1b..4d025ad191e 100644 --- a/packages/opentelemetry-exporter-collector/test/common/CollectorTraceExporter.test.ts +++ b/packages/opentelemetry-exporter-collector/test/common/CollectorTraceExporter.test.ts @@ -46,9 +46,6 @@ class CollectorTraceExporter extends CollectorExporterBase< getDefaultUrl(config: CollectorExporterConfig): string { return config.url || ''; } - getDefaultServiceName(config: CollectorExporterConfig): string { - return config.serviceName || 'collector-exporter'; - } convert( spans: ReadableSpan[] @@ -72,7 +69,6 @@ describe('CollectorTraceExporter - common', () => { onInitSpy = sinon.stub(CollectorTraceExporter.prototype, 'onInit'); collectorExporterConfig = { hostname: 'foo', - serviceName: 'bar', attributes: {}, url: 'http://foo.bar.com', }; @@ -92,24 +88,10 @@ describe('CollectorTraceExporter - common', () => { assert.strictEqual(collectorExporter.hostname, 'foo'); }); - it('should set serviceName', () => { - assert.strictEqual(collectorExporter.serviceName, 'bar'); - }); - it('should set url', () => { assert.strictEqual(collectorExporter.url, 'http://foo.bar.com'); }); }); - - describe('when config is missing certain params', () => { - beforeEach(() => { - collectorExporter = new CollectorTraceExporter(); - }); - - it('should set default serviceName', () => { - assert.strictEqual(collectorExporter.serviceName, 'collector-exporter'); - }); - }); }); describe('export', () => { @@ -221,7 +203,6 @@ describe('CollectorTraceExporter - common', () => { ); collectorExporterConfig = { hostname: 'foo', - serviceName: 'bar', attributes: {}, url: 'http://foo.bar.com', }; diff --git a/packages/opentelemetry-exporter-collector/test/helper.ts b/packages/opentelemetry-exporter-collector/test/helper.ts index dde640298e0..66a4a9ed5de 100644 --- a/packages/opentelemetry-exporter-collector/test/helper.ts +++ b/packages/opentelemetry-exporter-collector/test/helper.ts @@ -24,7 +24,7 @@ import { ValueRecorder, ValueType, } from '@opentelemetry/api-metrics'; -import { hexToBase64, InstrumentationLibrary } from '@opentelemetry/core'; +import { hexToBase64, InstrumentationLibrary, VERSION } from '@opentelemetry/core'; import * as metrics from '@opentelemetry/metrics'; import { Resource } from '@opentelemetry/resources'; import { ReadableSpan } from '@opentelemetry/tracing'; @@ -203,11 +203,12 @@ export const mockedReadableSpan: ReadableSpan = { }, ], duration: [0, 8885000], - resource: new Resource({ - service: 'ui', - version: 1, - cost: 112.12, - }), + resource: Resource.default() + .merge(new Resource({ + service: 'ui', + version: 1, + cost: 112.12, + })), instrumentationLibrary: { name: 'default', version: '0.0.1' }, }; @@ -532,35 +533,22 @@ export function ensureSpanIsCorrect( export function ensureWebResourceIsCorrect( resource: collectorTypes.opentelemetryProto.resource.v1.Resource ) { - assert.deepStrictEqual(resource, { - attributes: [ - { - key: 'service.name', - value: { - stringValue: 'bar', - }, - }, - { - key: 'service', - value: { - stringValue: 'ui', - }, - }, - { - key: 'version', - value: { - intValue: 1, - }, - }, - { - key: 'cost', - value: { - doubleValue: 112.12, - }, - }, - ], - droppedAttributesCount: 0, - }); + assert.strictEqual(resource.attributes.length, 7); + assert.strictEqual(resource.attributes[0].key, 'service.name'); + assert.strictEqual(resource.attributes[0].value.stringValue, 'unknown_service'); + assert.strictEqual(resource.attributes[1].key, 'telemetry.sdk.language'); + assert.strictEqual(resource.attributes[1].value.stringValue, 'webjs'); + assert.strictEqual(resource.attributes[2].key, 'telemetry.sdk.name'); + assert.strictEqual(resource.attributes[2].value.stringValue, 'opentelemetry'); + assert.strictEqual(resource.attributes[3].key, 'telemetry.sdk.version'); + assert.strictEqual(resource.attributes[3].value.stringValue, VERSION); + assert.strictEqual(resource.attributes[4].key, 'service'); + assert.strictEqual(resource.attributes[4].value.stringValue, 'ui'); + assert.strictEqual(resource.attributes[5].key, 'version'); + assert.strictEqual(resource.attributes[5].value.intValue, 1); + assert.strictEqual(resource.attributes[6].key, 'cost'); + assert.strictEqual(resource.attributes[6].value.doubleValue, 112.12); + assert.strictEqual(resource.droppedAttributesCount, 0); } export function ensureCounterIsCorrect( diff --git a/packages/opentelemetry-exporter-collector/test/node/CollectorMetricExporter.test.ts b/packages/opentelemetry-exporter-collector/test/node/CollectorMetricExporter.test.ts index dc3c0a98ff8..750b196a2c1 100644 --- a/packages/opentelemetry-exporter-collector/test/node/CollectorMetricExporter.test.ts +++ b/packages/opentelemetry-exporter-collector/test/node/CollectorMetricExporter.test.ts @@ -129,7 +129,6 @@ describe('CollectorMetricExporter - node with json over http', () => { foo: 'bar', }, hostname: 'foo', - serviceName: 'bar', attributes: {}, url: 'http://foo.bar.com', keepAlive: true, diff --git a/packages/opentelemetry-exporter-collector/test/node/CollectorTraceExporter.test.ts b/packages/opentelemetry-exporter-collector/test/node/CollectorTraceExporter.test.ts index ec9fac3653e..d64ef15db11 100644 --- a/packages/opentelemetry-exporter-collector/test/node/CollectorTraceExporter.test.ts +++ b/packages/opentelemetry-exporter-collector/test/node/CollectorTraceExporter.test.ts @@ -115,7 +115,6 @@ describe('CollectorTraceExporter - node with json over http', () => { foo: 'bar', }, hostname: 'foo', - serviceName: 'bar', attributes: {}, url: 'http://foo.bar.com', keepAlive: true, diff --git a/packages/opentelemetry-exporter-jaeger/package.json b/packages/opentelemetry-exporter-jaeger/package.json index b0bfd07521c..53314e2353a 100644 --- a/packages/opentelemetry-exporter-jaeger/package.json +++ b/packages/opentelemetry-exporter-jaeger/package.json @@ -60,6 +60,7 @@ }, "dependencies": { "@opentelemetry/core": "0.19.0", + "@opentelemetry/semantic-conventions": "0.19.0", "@opentelemetry/tracing": "0.19.0", "jaeger-client": "^3.15.0" } diff --git a/packages/opentelemetry-exporter-jaeger/src/jaeger.ts b/packages/opentelemetry-exporter-jaeger/src/jaeger.ts index 7de46984e98..335767366d6 100644 --- a/packages/opentelemetry-exporter-jaeger/src/jaeger.ts +++ b/packages/opentelemetry-exporter-jaeger/src/jaeger.ts @@ -18,6 +18,7 @@ import { diag } from '@opentelemetry/api'; import { ExportResult, ExportResultCode, getEnv } from '@opentelemetry/core'; import { ReadableSpan, SpanExporter } from '@opentelemetry/tracing'; import { Socket } from 'dgram'; +import { ResourceAttributes } from '@opentelemetry/semantic-conventions'; import { spanToThrift } from './transform'; import * as jaegerTypes from './types'; @@ -25,16 +26,16 @@ import * as jaegerTypes from './types'; * Format and sends span information to Jaeger Exporter. */ export class JaegerExporter implements SpanExporter { - private readonly _process: jaegerTypes.ThriftProcess; - private readonly _sender: typeof jaegerTypes.UDPSender; private readonly _onShutdownFlushTimeout: number; + private readonly _localConfig: jaegerTypes.ExporterConfig; private _isShutdown = false; private _shutdownFlushTimeout: NodeJS.Timeout | undefined; private _shuttingDownPromise: Promise = Promise.resolve(); - constructor(config: jaegerTypes.ExporterConfig) { + private _sender?: typeof jaegerTypes.UDPSender; + + constructor(config?: jaegerTypes.ExporterConfig) { const localConfig = Object.assign({}, config); - const tags: jaegerTypes.Tag[] = localConfig.tags || []; this._onShutdownFlushTimeout = typeof localConfig.flushTimeout === 'number' ? localConfig.flushTimeout @@ -54,24 +55,8 @@ export class JaegerExporter implements SpanExporter { localConfig.password = localConfig.password || env.OTEL_EXPORTER_JAEGER_PASSWORD; localConfig.host = localConfig.host || env.OTEL_EXPORTER_JAEGER_AGENT_HOST; - if (localConfig.endpoint) { - this._sender = new jaegerTypes.HTTPSender(localConfig); - } else { - this._sender = localConfig.endpoint = new jaegerTypes.UDPSender( - localConfig - ); - } - - if (this._sender._client instanceof Socket) { - // unref socket to prevent it from keeping the process running - this._sender._client.unref(); - } - this._process = { - serviceName: localConfig.serviceName, - tags: jaegerTypes.ThriftUtils.getThriftTags(tags), - }; - this._sender.setProcess(this._process); + this._localConfig = localConfig; } /** Exports a list of spans to Jaeger. */ @@ -144,12 +129,12 @@ export class JaegerExporter implements SpanExporter { // Flush all spans on each export. No-op if span buffer is empty await this._flush(); - if (done) return done({ code: ExportResultCode.SUCCESS }); + if (done) return process.nextTick(done, { code: ExportResultCode.SUCCESS }); } private async _append(span: jaegerTypes.ThriftSpan): Promise { return new Promise((resolve, reject) => { - this._sender.append(span, (count: number, err?: string) => { + this._getSender(span).append(span, (count: number, err?: string) => { if (err) { return reject(new Error(err)); } @@ -158,8 +143,36 @@ export class JaegerExporter implements SpanExporter { }); } + private _getSender(span: jaegerTypes.ThriftSpan): typeof jaegerTypes.UDPSender { + if (this._sender) { + return this._sender; + } + + const sender = this._localConfig.endpoint ? new jaegerTypes.HTTPSender(this._localConfig) : new jaegerTypes.UDPSender(this._localConfig); + + if (sender._client instanceof Socket) { + // unref socket to prevent it from keeping the process running + sender._client.unref(); + } + + const serviceNameTag = span.tags.find(t => t.key === ResourceAttributes.SERVICE_NAME) + const serviceName = serviceNameTag?.vStr || "unknown_service"; + + sender.setProcess({ + serviceName, + tags: jaegerTypes.ThriftUtils.getThriftTags(this._localConfig.tags || []), + }); + + this._sender = sender; + return sender; + } + private async _flush(): Promise { await new Promise((resolve, reject) => { + if (!this._sender) { + return resolve(); + } + this._sender.flush((_count: number, err?: string) => { if (err) { return reject(new Error(err)); diff --git a/packages/opentelemetry-exporter-jaeger/src/types.ts b/packages/opentelemetry-exporter-jaeger/src/types.ts index 9e5c3f0055f..4a6ec67f12f 100644 --- a/packages/opentelemetry-exporter-jaeger/src/types.ts +++ b/packages/opentelemetry-exporter-jaeger/src/types.ts @@ -18,7 +18,6 @@ * Options for Jaeger configuration */ export interface ExporterConfig { - serviceName: string; tags?: Tag[]; host?: string; // default: 'localhost' port?: number; // default: 6832 diff --git a/packages/opentelemetry-exporter-jaeger/test/jaeger.test.ts b/packages/opentelemetry-exporter-jaeger/test/jaeger.test.ts index afa0605497e..0766e5a72a0 100644 --- a/packages/opentelemetry-exporter-jaeger/test/jaeger.test.ts +++ b/packages/opentelemetry-exporter-jaeger/test/jaeger.test.ts @@ -23,25 +23,67 @@ import { ReadableSpan } from '@opentelemetry/tracing'; import { TraceFlags } from '@opentelemetry/api'; import { Resource } from '@opentelemetry/resources'; import * as nock from 'nock'; +import { ResourceAttributes } from '@opentelemetry/semantic-conventions'; describe('JaegerExporter', () => { + const readableSpan: ReadableSpan = { + name: 'my-span1', + kind: api.SpanKind.CLIENT, + spanContext: () => { + return { + traceId: 'd4cda95b652f4a1592b449d5929fda1b', + spanId: '6e0c63257de34c92', + traceFlags: TraceFlags.NONE, + }; + }, + startTime: [1566156729, 709], + endTime: [1566156731, 709], + ended: true, + status: { + code: api.SpanStatusCode.ERROR, + }, + attributes: {}, + links: [], + events: [], + duration: [32, 800000000], + resource: new Resource({ + [ResourceAttributes.SERVICE_NAME]: 'opentelemetry' + }), + instrumentationLibrary: { + name: 'default', + version: '0.0.1', + }, + }; describe('constructor', () => { afterEach(() => { delete process.env.OTEL_EXPORTER_JAEGER_AGENT_HOST; }); it('should construct an exporter', () => { - const exporter = new JaegerExporter({ serviceName: 'opentelemetry' }); + const exporter = new JaegerExporter(); assert.ok(typeof exporter.export === 'function'); assert.ok(typeof exporter.shutdown === 'function'); - const process: ThriftProcess = exporter['_sender']._process; - assert.strictEqual(process.serviceName, 'opentelemetry'); - assert.strictEqual(process.tags.length, 0); + }); + + it('should get service name from the the service name resource attribute of the first exported span', done => { + const mockedEndpoint = 'http://testendpoint'; + const scope =nock(mockedEndpoint) + .post('/') + .reply(202) + + const exporter = new JaegerExporter({ + endpoint: mockedEndpoint, + }); + exporter.export([readableSpan], result => { + assert.strictEqual(result.code, ExportResultCode.SUCCESS); + assert.strictEqual(exporter['_sender']._batch.process.serviceName, 'opentelemetry'); + scope.done(); + done(); + }); }); it('should construct an exporter with host, port, logger and tags', () => { const exporter = new JaegerExporter({ - serviceName: 'opentelemetry', host: 'remotehost', port: 8080, tags: [{ key: 'opentelemetry-exporter-jaeger', value: '0.1.0' }], @@ -49,7 +91,12 @@ describe('JaegerExporter', () => { assert.ok(typeof exporter.export === 'function'); assert.ok(typeof exporter.shutdown === 'function'); - const process: ThriftProcess = exporter['_sender']._process; + const process: ThriftProcess = exporter['_getSender']({ + tags: [{ + key: "service.name", + vStr: "opentelemetry" + }] + } as any)._process; assert.strictEqual(exporter['_sender']._host, 'remotehost'); assert.strictEqual(process.serviceName, 'opentelemetry'); assert.strictEqual(process.tags.length, 1); @@ -59,32 +106,44 @@ describe('JaegerExporter', () => { }); it('should default to localhost if no host is configured', () => { - const exporter = new JaegerExporter({ - serviceName: 'opentelemetry', - }); - assert.strictEqual(exporter['_sender']._host, 'localhost'); + const exporter = new JaegerExporter(); + const sender = exporter['_getSender']({ + tags: [{ + key: "service.name", + vStr: "opentelemetry" + }] + } as any); + assert.strictEqual(sender._host, 'localhost'); }); it('should respect jaeger host env variable', () => { process.env.OTEL_EXPORTER_JAEGER_AGENT_HOST = 'env-set-host'; - const exporter = new JaegerExporter({ - serviceName: 'test-service', - }); - assert.strictEqual(exporter['_sender']._host, 'env-set-host'); + const exporter = new JaegerExporter(); + const sender = exporter['_getSender']({ + tags: [{ + key: "service.name", + vStr: "opentelemetry" + }] + } as any); + assert.strictEqual(sender._host, 'env-set-host'); }); it('should prioritize host option over env variable', () => { process.env.OTEL_EXPORTER_JAEGER_AGENT_HOST = 'env-set-host'; const exporter = new JaegerExporter({ - serviceName: 'test-service', host: 'option-set-host', }); - assert.strictEqual(exporter['_sender']._host, 'option-set-host'); + const sender = exporter['_getSender']({ + tags: [{ + key: "service.name", + vStr: "opentelemetry" + }] + } as any); + assert.strictEqual(sender._host, 'option-set-host'); }); it('should construct an exporter with flushTimeout', () => { const exporter = new JaegerExporter({ - serviceName: 'opentelemetry', flushTimeout: 5000, }); assert.ok(typeof exporter.export === 'function'); @@ -94,9 +153,7 @@ describe('JaegerExporter', () => { }); it('should construct an exporter without flushTimeout', () => { - const exporter = new JaegerExporter({ - serviceName: 'opentelemetry', - }); + const exporter = new JaegerExporter(); assert.ok(typeof exporter.export === 'function'); assert.ok(typeof exporter.shutdown === 'function'); @@ -105,39 +162,10 @@ describe('JaegerExporter', () => { }); describe('export', () => { - const readableSpan: ReadableSpan = { - name: 'my-span1', - kind: api.SpanKind.CLIENT, - spanContext: () => { - return { - traceId: 'd4cda95b652f4a1592b449d5929fda1b', - spanId: '6e0c63257de34c92', - traceFlags: TraceFlags.NONE, - }; - }, - startTime: [1566156729, 709], - endTime: [1566156731, 709], - ended: true, - status: { - code: api.SpanStatusCode.ERROR, - }, - attributes: {}, - links: [], - events: [], - duration: [32, 800000000], - resource: Resource.empty(), - instrumentationLibrary: { - name: 'default', - version: '0.0.1', - }, - }; - let exporter: JaegerExporter; beforeEach(() => { - exporter = new JaegerExporter({ - serviceName: 'opentelemetry', - }); + exporter = new JaegerExporter(); }); afterEach(() => { @@ -156,7 +184,7 @@ describe('JaegerExporter', () => { }); }); - it('should use httpSender if config.endpoint is setten', done => { + it('should use httpSender if config.endpoint is set', done => { const mockedEndpoint = 'http://testendpoint'; nock(mockedEndpoint) .post('/') @@ -166,14 +194,14 @@ describe('JaegerExporter', () => { 'application/x-thrift' ); assert.strictEqual(this.req.headers.host, 'testendpoint'); - done(); }); const exporter = new JaegerExporter({ - serviceName: 'opentelemetry', endpoint: mockedEndpoint, }); - assert.strictEqual(exporter['_sender'].constructor.name, 'HTTPSender'); - exporter.export([readableSpan], () => {}); + exporter.export([readableSpan], () => { + assert.strictEqual(exporter['_sender'].constructor.name, 'HTTPSender'); + done(); + }); }); it('should return failed export result on error', () => { @@ -184,7 +212,6 @@ describe('JaegerExporter', () => { .post('/') .replyWithError(expectedError); const exporter = new JaegerExporter({ - serviceName: 'opentelemetry', endpoint: mockedEndpoint, }); diff --git a/packages/opentelemetry-exporter-zipkin/package.json b/packages/opentelemetry-exporter-zipkin/package.json index b59dea7e3e2..03d06876add 100644 --- a/packages/opentelemetry-exporter-zipkin/package.json +++ b/packages/opentelemetry-exporter-zipkin/package.json @@ -85,7 +85,7 @@ "dependencies": { "@opentelemetry/core": "0.19.0", "@opentelemetry/resources": "0.19.0", - "@opentelemetry/tracing": "0.19.0", - "@opentelemetry/semantic-conventions": "0.19.0" + "@opentelemetry/semantic-conventions": "0.19.0", + "@opentelemetry/tracing": "0.19.0" } } diff --git a/packages/opentelemetry-exporter-zipkin/src/zipkin.ts b/packages/opentelemetry-exporter-zipkin/src/zipkin.ts index c0cd5bbe35e..cdf9df19800 100644 --- a/packages/opentelemetry-exporter-zipkin/src/zipkin.ts +++ b/packages/opentelemetry-exporter-zipkin/src/zipkin.ts @@ -64,12 +64,12 @@ export class ZipkinExporter implements SpanExporter { spans: ReadableSpan[], resultCallback: (result: ExportResult) => void ) { - if (typeof this._serviceName !== 'string') { - this._serviceName = String( + const serviceName = String( + this._serviceName || spans[0].resource.attributes[ResourceAttributes.SERVICE_NAME] || - this.DEFAULT_SERVICE_NAME - ); - } + this.DEFAULT_SERVICE_NAME + ); + diag.debug('Zipkin exporter export'); if (this._isShutdown) { setTimeout(() => @@ -81,7 +81,7 @@ export class ZipkinExporter implements SpanExporter { return; } const promise = new Promise(resolve => { - this._sendSpans(spans, this._serviceName!, result => { + this._sendSpans(spans, serviceName, result => { resolve(); resultCallback(result); const index = this._sendingPromises.indexOf(promise); diff --git a/packages/opentelemetry-exporter-zipkin/test/common/transform.test.ts b/packages/opentelemetry-exporter-zipkin/test/common/transform.test.ts index e1336ed1510..46f3be7ca1e 100644 --- a/packages/opentelemetry-exporter-zipkin/test/common/transform.test.ts +++ b/packages/opentelemetry-exporter-zipkin/test/common/transform.test.ts @@ -21,9 +21,9 @@ import { VERSION, } from '@opentelemetry/core'; import { Resource } from '@opentelemetry/resources'; -import { ResourceAttributes } from '@opentelemetry/semantic-conventions'; import { BasicTracerProvider, Span } from '@opentelemetry/tracing'; import * as assert from 'assert'; +import { ResourceAttributes } from '@opentelemetry/semantic-conventions'; import { statusCodeTagName, statusDescriptionTagName, @@ -32,7 +32,13 @@ import { _toZipkinTags, } from '../../src/transform'; import * as zipkinTypes from '../../src/types'; -const tracer = new BasicTracerProvider().getTracer('default'); +const tracer = new BasicTracerProvider({ + resource: Resource.default().merge( + new Resource({ + [ResourceAttributes.SERVICE_NAME]: 'zipkin-test', + }) + ), +}).getTracer('default'); const language = tracer.resource.attributes[ResourceAttributes.TELEMETRY_SDK_LANGUAGE]; @@ -48,6 +54,7 @@ const DUMMY_RESOURCE = new Resource({ service: 'ui', version: 1, cost: 112.12, + [ResourceAttributes.SERVICE_NAME]: 'zipkin-test', }); describe('transform', () => { @@ -95,6 +102,7 @@ describe('transform', () => { key1: 'value1', key2: 'value2', [statusCodeTagName]: 'UNSET', + [ResourceAttributes.SERVICE_NAME]: 'zipkin-test', 'telemetry.sdk.language': language, 'telemetry.sdk.name': 'opentelemetry', 'telemetry.sdk.version': VERSION, @@ -133,6 +141,7 @@ describe('transform', () => { parentId: undefined, tags: { [statusCodeTagName]: 'UNSET', + [ResourceAttributes.SERVICE_NAME]: 'zipkin-test', 'telemetry.sdk.language': language, 'telemetry.sdk.name': 'opentelemetry', 'telemetry.sdk.version': VERSION, @@ -181,6 +190,7 @@ describe('transform', () => { parentId: undefined, tags: { [statusCodeTagName]: 'UNSET', + [ResourceAttributes.SERVICE_NAME]: 'zipkin-test', 'telemetry.sdk.language': language, 'telemetry.sdk.name': 'opentelemetry', 'telemetry.sdk.version': VERSION, @@ -221,6 +231,7 @@ describe('transform', () => { cost: '112.12', service: 'ui', version: '1', + [ResourceAttributes.SERVICE_NAME]: 'zipkin-test', }); }); it('should map OpenTelemetry SpanStatus.code to a Zipkin tag', () => { @@ -245,13 +256,18 @@ describe('transform', () => { span.status, statusCodeTagName, statusDescriptionTagName, - Resource.empty() + Resource.empty().merge( + new Resource({ + [ResourceAttributes.SERVICE_NAME]: 'zipkin-test', + }) + ) ); assert.deepStrictEqual(tags, { key1: 'value1', key2: 'value2', [statusCodeTagName]: 'ERROR', + [ResourceAttributes.SERVICE_NAME]: 'zipkin-test', }); }); it('should map OpenTelemetry SpanStatus.message to a Zipkin tag', () => { @@ -277,7 +293,11 @@ describe('transform', () => { span.status, statusCodeTagName, statusDescriptionTagName, - Resource.empty() + Resource.empty().merge( + new Resource({ + [ResourceAttributes.SERVICE_NAME]: 'zipkin-test', + }) + ) ); assert.deepStrictEqual(tags, { @@ -285,6 +305,7 @@ describe('transform', () => { key2: 'value2', [statusCodeTagName]: 'ERROR', [statusDescriptionTagName]: status.message, + [ResourceAttributes.SERVICE_NAME]: 'zipkin-test', }); }); }); diff --git a/packages/opentelemetry-exporter-zipkin/test/node/zipkin.test.ts b/packages/opentelemetry-exporter-zipkin/test/node/zipkin.test.ts index 846e30ab06a..31192fbd31a 100644 --- a/packages/opentelemetry-exporter-zipkin/test/node/zipkin.test.ts +++ b/packages/opentelemetry-exporter-zipkin/test/node/zipkin.test.ts @@ -313,388 +313,220 @@ describe('Zipkin Exporter - node', () => { }); }); - it('should set serviceName to "Opentelemetry Service" by default', () => { - const scope = nock('http://localhost:9411') - .post('/api/v2/spans') - .replyWithError(new Error('My Socket Error')); - - const parentSpanId = '5c1c63257de34c67'; - const startTime = 1566156729709; - const duration = 2000; - - const span1: ReadableSpan = { - name: 'my-span', - kind: api.SpanKind.INTERNAL, - parentSpanId, - spanContext: () => { - return { - traceId: 'd4cda95b652f4a1592b449d5929fda1b', - spanId: '6e0c63257de34c92', - traceFlags: TraceFlags.NONE, - }; - }, - startTime: [startTime, 0], - endTime: [startTime + duration, 0], - ended: true, - duration: [duration, 0], - status: { - code: api.SpanStatusCode.OK, - }, - attributes: { - key1: 'value1', - key2: 'value2', - }, - links: [], - events: [ - { - name: 'my-event', - time: [startTime + 10, 0], - attributes: { key3: 'value3' }, - }, - ], - resource: Resource.empty(), - instrumentationLibrary: { name: 'default', version: '0.0.1' }, - }; - const span2: ReadableSpan = { - name: 'my-span', - kind: api.SpanKind.SERVER, - spanContext: () => { - return { - traceId: 'd4cda95b652f4a1592b449d5929fda1b', - spanId: '6e0c63257de34c92', - traceFlags: TraceFlags.NONE, - }; - }, - startTime: [startTime, 0], - endTime: [startTime + duration, 0], - ended: true, - duration: [duration, 0], - status: { - code: api.SpanStatusCode.OK, - }, - attributes: {}, - links: [], - events: [], - resource: Resource.empty(), - instrumentationLibrary: { name: 'default', version: '0.0.1' }, - }; - - const exporter = new ZipkinExporter({}); - - exporter.export([span1, span2], (result: ExportResult) => { - scope.done(); - assert.equal(exporter['_serviceName'], 'OpenTelemetry Service'); - }); - }); - - it('should set serviceName if resource has one', () => { - const resource_service_name = 'resource_service_name'; + it('should call globalErrorHandler on error', () => { + const expectedError = new Error('Whoops'); const scope = nock('http://localhost:9411') .post('/api/v2/spans') - .replyWithError(new Error('My Socket Error')); + .replyWithError(expectedError); - const parentSpanId = '5c1c63257de34c67'; - const startTime = 1566156729709; - const duration = 2000; - - const span1: ReadableSpan = { - name: 'my-span', - kind: api.SpanKind.INTERNAL, - parentSpanId, - spanContext: () => { - return { - traceId: 'd4cda95b652f4a1592b449d5929fda1b', - spanId: '6e0c63257de34c92', - traceFlags: TraceFlags.NONE, - }; - }, - startTime: [startTime, 0], - endTime: [startTime + duration, 0], - ended: true, - duration: [duration, 0], - status: { - code: api.SpanStatusCode.OK, - }, - attributes: { - key1: 'value1', - key2: 'value2', - }, - links: [], - events: [ - { - name: 'my-event', - time: [startTime + 10, 0], - attributes: { key3: 'value3' }, - }, - ], - resource: new Resource({ - [ResourceAttributes.SERVICE_NAME]: resource_service_name, - }), - instrumentationLibrary: { name: 'default', version: '0.0.1' }, - }; - const span2: ReadableSpan = { - name: 'my-span', - kind: api.SpanKind.SERVER, - spanContext: () => { - return { - traceId: 'd4cda95b652f4a1592b449d5929fda1b', - spanId: '6e0c63257de34c92', - traceFlags: TraceFlags.NONE, - }; - }, - startTime: [startTime, 0], - endTime: [startTime + duration, 0], - ended: true, - duration: [duration, 0], - status: { - code: api.SpanStatusCode.OK, - }, - attributes: {}, - links: [], - events: [], - resource: Resource.empty(), - instrumentationLibrary: { name: 'default', version: '0.0.1' }, - }; - - const exporter = new ZipkinExporter({}); - - exporter.export([span1, span2], (result: ExportResult) => { - scope.done(); - assert.equal(exporter['_serviceName'], resource_service_name); - - // checking if service name remains consistent in further exports - exporter.export([span2], (result: ExportResult) => { - scope.done(); - assert.equal(exporter['_serviceName'], resource_service_name); - }); + const exporter = new ZipkinExporter({ + serviceName: 'my-service', }); - it('should call globalErrorHandler on error', () => { - const expectedError = new Error('Whoops'); - const scope = nock('http://localhost:9411') - .post('/api/v2/spans') - .replyWithError(expectedError); - - const exporter = new ZipkinExporter({ - serviceName: 'my-service', - }); - - exporter.export([getReadableSpan()], (result: ExportResult) => { - assert.deepStrictEqual(result.code, ExportResultCode.FAILED); - assert.deepStrictEqual(result.error, expectedError); - scope.done(); - }); + exporter.export([getReadableSpan()], (result: ExportResult) => { + assert.deepStrictEqual(result.code, ExportResultCode.FAILED); + assert.deepStrictEqual(result.error, expectedError); + scope.done(); }); }); + }); - it('should set serviceName per-span if resource has one', () => { - const resource_service_name = 'resource_service_name'; - const resource_service_name_prime = 'resource_service_name_prime'; - - let requestBody: zipkinTypes.Span[]; - const scope = nock('http://localhost:9411') - .post('/api/v2/spans', body => { - requestBody = body; - return true; - }) - .replyWithError(new Error('My Socket Error')); - - const parentSpanId = '5c1c63257de34c67'; - const startTime = 1566156729709; - const duration = 2000; - - const span1: ReadableSpan = { - name: 'my-span', - kind: api.SpanKind.INTERNAL, - parentSpanId, - spanContext: () => { - return { - traceId: 'd4cda95b652f4a1592b449d5929fda1b', - spanId: '6e0c63257de34c92', - traceFlags: TraceFlags.NONE, - }; - }, - startTime: [startTime, 0], - endTime: [startTime + duration, 0], - ended: true, - duration: [duration, 0], - status: { - code: api.SpanStatusCode.OK, - }, - attributes: { - key1: 'value1', - key2: 'value2', - }, - links: [], - events: [ - { - name: 'my-event', - time: [startTime + 10, 0], - attributes: { key3: 'value3' }, - }, - ], - resource: new Resource({ - [ResourceAttributes.SERVICE_NAME]: resource_service_name, - }), - instrumentationLibrary: { name: 'default', version: '0.0.1' }, - }; - const span2: ReadableSpan = { - name: 'my-span', - kind: api.SpanKind.SERVER, - spanContext: () => { - return { - traceId: 'd4cda95b652f4a1592b449d5929fda1b', - spanId: '6e0c63257de34c92', - traceFlags: TraceFlags.NONE, - }; - }, - startTime: [startTime, 0], - endTime: [startTime + duration, 0], - ended: true, - duration: [duration, 0], - status: { - code: api.SpanStatusCode.OK, + it('should set serviceName per-span if resource has one', () => { + const resource_service_name = 'resource_service_name'; + const resource_service_name_prime = 'resource_service_name_prime'; + + let requestBody: zipkinTypes.Span[]; + const scope = nock('http://localhost:9411') + .post('/api/v2/spans', body => { + requestBody = body; + return true; + }) + .replyWithError(new Error('My Socket Error')); + + const parentSpanId = '5c1c63257de34c67'; + const startTime = 1566156729709; + const duration = 2000; + + const span1: ReadableSpan = { + name: 'my-span', + kind: api.SpanKind.INTERNAL, + parentSpanId, + spanContext: () => ({ + traceId: 'd4cda95b652f4a1592b449d5929fda1b', + spanId: '6e0c63257de34c92', + traceFlags: TraceFlags.NONE, + }), + startTime: [startTime, 0], + endTime: [startTime + duration, 0], + ended: true, + duration: [duration, 0], + status: { + code: api.SpanStatusCode.OK, + }, + attributes: { + key1: 'value1', + key2: 'value2', + }, + links: [], + events: [ + { + name: 'my-event', + time: [startTime + 10, 0], + attributes: { key3: 'value3' }, }, - attributes: {}, - links: [], - events: [], - resource: new Resource({ - [ResourceAttributes.SERVICE_NAME]: resource_service_name_prime, - }), - instrumentationLibrary: { name: 'default', version: '0.0.1' }, - }; - - const exporter = new ZipkinExporter({}); - - exporter.export([span1, span2], (result: ExportResult) => { - requestBody; - scope.done(); - assert.equal( - requestBody[0].localEndpoint.serviceName, - resource_service_name - ); - assert.equal( - requestBody[1].localEndpoint.serviceName, - resource_service_name_prime - ); - }); + ], + resource: new Resource({ + [ResourceAttributes.SERVICE_NAME]: resource_service_name, + }), + instrumentationLibrary: { name: 'default', version: '0.0.1' }, + }; + const span2: ReadableSpan = { + name: 'my-span', + kind: api.SpanKind.SERVER, + spanContext: () => ({ + traceId: 'd4cda95b652f4a1592b449d5929fda1b', + spanId: '6e0c63257de34c92', + traceFlags: TraceFlags.NONE, + }), + startTime: [startTime, 0], + endTime: [startTime + duration, 0], + ended: true, + duration: [duration, 0], + status: { + code: api.SpanStatusCode.OK, + }, + attributes: {}, + links: [], + events: [], + resource: new Resource({ + [ResourceAttributes.SERVICE_NAME]: resource_service_name_prime, + }), + instrumentationLibrary: { name: 'default', version: '0.0.1' }, + }; + + const exporter = new ZipkinExporter({}); + + exporter.export([span1, span2], (result: ExportResult) => { + requestBody; + scope.done(); + assert.equal( + requestBody[0].localEndpoint.serviceName, + resource_service_name + ); + assert.equal( + requestBody[1].localEndpoint.serviceName, + resource_service_name_prime + ); }); + }); - it('should set serviceName per-span if span has attribute', () => { - const span_service_name = 'span_service_name'; - const span_service_name_prime = 'span_service_name_prime'; - - let requestBody: any; - const scope = nock('http://localhost:9411') - .post('/api/v2/spans', body => { - requestBody = body; - return true; - }) - .replyWithError(new Error('My Socket Error')); - - const parentSpanId = '5c1c63257de34c67'; - const startTime = 1566156729709; - const duration = 2000; - - const span1: ReadableSpan = { - name: 'my-span', - kind: api.SpanKind.INTERNAL, - parentSpanId, - spanContext: () => { - return { - traceId: 'd4cda95b652f4a1592b449d5929fda1b', - spanId: '6e0c63257de34c92', - traceFlags: TraceFlags.NONE, - }; - }, - startTime: [startTime, 0], - endTime: [startTime + duration, 0], - ended: true, - duration: [duration, 0], - status: { - code: api.SpanStatusCode.OK, - }, - attributes: { - key1: 'value1', - key2: 'value2', - [ResourceAttributes.SERVICE_NAME]: span_service_name, - }, - links: [], - events: [ - { - name: 'my-event', - time: [startTime + 10, 0], - attributes: { key3: 'value3' }, - }, - ], - resource: Resource.empty(), - instrumentationLibrary: { name: 'default', version: '0.0.1' }, - }; - const span2: ReadableSpan = { - name: 'my-span', - kind: api.SpanKind.SERVER, - spanContext: () => { - return { - traceId: 'd4cda95b652f4a1592b449d5929fda1b', - spanId: '6e0c63257de34c92', - traceFlags: TraceFlags.NONE, - }; - }, - startTime: [startTime, 0], - endTime: [startTime + duration, 0], - ended: true, - duration: [duration, 0], - status: { - code: api.SpanStatusCode.OK, - }, - attributes: { - [ResourceAttributes.SERVICE_NAME]: span_service_name_prime, + it('should set serviceName per-span if span has attribute', () => { + const span_service_name = 'span_service_name'; + const span_service_name_prime = 'span_service_name_prime'; + + let requestBody: any; + const scope = nock('http://localhost:9411') + .post('/api/v2/spans', body => { + requestBody = body; + return true; + }) + .replyWithError(new Error('My Socket Error')); + + const parentSpanId = '5c1c63257de34c67'; + const startTime = 1566156729709; + const duration = 2000; + + const span1: ReadableSpan = { + name: 'my-span', + kind: api.SpanKind.INTERNAL, + parentSpanId, + spanContext: () => ({ + traceId: 'd4cda95b652f4a1592b449d5929fda1b', + spanId: '6e0c63257de34c92', + traceFlags: TraceFlags.NONE, + }), + startTime: [startTime, 0], + endTime: [startTime + duration, 0], + ended: true, + duration: [duration, 0], + status: { + code: api.SpanStatusCode.OK, + }, + attributes: { + key1: 'value1', + key2: 'value2', + [ResourceAttributes.SERVICE_NAME]: span_service_name, + }, + links: [], + events: [ + { + name: 'my-event', + time: [startTime + 10, 0], + attributes: { key3: 'value3' }, }, - links: [], - events: [], - resource: Resource.empty(), - instrumentationLibrary: { name: 'default', version: '0.0.1' }, - }; - - const exporter = new ZipkinExporter({}); - - exporter.export([span1, span2], (result: ExportResult) => { - requestBody; - scope.done(); - assert.equal( - requestBody[0].localEndpoint.serviceName, - span_service_name - ); - assert.equal( - requestBody[1].localEndpoint.serviceName, - span_service_name_prime - ); - }); + ], + resource: Resource.empty(), + instrumentationLibrary: { name: 'default', version: '0.0.1' }, + }; + const span2: ReadableSpan = { + name: 'my-span', + kind: api.SpanKind.SERVER, + spanContext: () => ({ + traceId: 'd4cda95b652f4a1592b449d5929fda1b', + spanId: '6e0c63257de34c92', + traceFlags: TraceFlags.NONE, + }), + startTime: [startTime, 0], + endTime: [startTime + duration, 0], + ended: true, + duration: [duration, 0], + status: { + code: api.SpanStatusCode.OK, + }, + attributes: { + [ResourceAttributes.SERVICE_NAME]: span_service_name_prime, + }, + links: [], + events: [], + resource: Resource.empty(), + instrumentationLibrary: { name: 'default', version: '0.0.1' }, + }; + + const exporter = new ZipkinExporter({}); + + exporter.export([span1, span2], (result: ExportResult) => { + requestBody; + scope.done(); + assert.equal( + requestBody[0].localEndpoint.serviceName, + span_service_name + ); + assert.equal( + requestBody[1].localEndpoint.serviceName, + span_service_name_prime + ); }); + }); - it('should support setting url via env', () => { + describe('when env.OTEL_EXPORTER_ZIPKIN_ENDPOINT is set', () => { + before(() => { process.env.OTEL_EXPORTER_ZIPKIN_ENDPOINT = 'http://localhost:9412'; + }) + after(() => { + delete process.env.OTEL_EXPORTER_ZIPKIN_ENDPOINT + }) + it('should use url from env', () => { const scope = nock('http://localhost:9412').post('/').reply(200); - + const exporter = new ZipkinExporter({ serviceName: 'my-service', }); - + exporter.export([getReadableSpan()], (result: ExportResult) => { scope.done(); assert.strictEqual(result.code, ExportResultCode.SUCCESS); }); }); }); - - describe('shutdown', () => { - before(() => { - nock.disableNetConnect(); - }); - - after(() => { - nock.enableNetConnect(); - }); - }); }); diff --git a/packages/opentelemetry-metrics/src/Meter.ts b/packages/opentelemetry-metrics/src/Meter.ts index 348c554dec0..32f295694c6 100644 --- a/packages/opentelemetry-metrics/src/Meter.ts +++ b/packages/opentelemetry-metrics/src/Meter.ts @@ -57,7 +57,7 @@ export class Meter implements api.Meter { const mergedConfig = merge({}, DEFAULT_CONFIG, config); this._processor = mergedConfig.processor ?? new UngroupedProcessor(); this._resource = - mergedConfig.resource || Resource.createTelemetrySDKResource(); + mergedConfig.resource || Resource.empty(); this._instrumentationLibrary = instrumentationLibrary; // start the push controller const exporter = mergedConfig.exporter || new NoopExporter(); diff --git a/packages/opentelemetry-metrics/src/MeterProvider.ts b/packages/opentelemetry-metrics/src/MeterProvider.ts index b38243ae130..1d0cf1f0987 100644 --- a/packages/opentelemetry-metrics/src/MeterProvider.ts +++ b/packages/opentelemetry-metrics/src/MeterProvider.ts @@ -33,8 +33,8 @@ export class MeterProvider implements api.MeterProvider { constructor(config: MeterConfig = {}) { const mergedConfig = merge({}, DEFAULT_CONFIG, config); - this.resource = - mergedConfig.resource ?? Resource.createTelemetrySDKResource(); + this.resource = mergedConfig.resource || Resource.empty(); + this.resource = Resource.default().merge(this.resource); this._config = Object.assign({}, mergedConfig, { resource: this.resource, }); diff --git a/packages/opentelemetry-resources/src/Resource.ts b/packages/opentelemetry-resources/src/Resource.ts index ea5ed0ab375..161995ac0f2 100644 --- a/packages/opentelemetry-resources/src/Resource.ts +++ b/packages/opentelemetry-resources/src/Resource.ts @@ -17,6 +17,7 @@ import { ResourceAttributes as SemanticResourceAttributes } from '@opentelemetry/semantic-conventions'; import { SDK_INFO } from '@opentelemetry/core'; import { ResourceAttributes } from './types'; +import { defaultServiceName } from './platform'; /** * A Resource describes the entity for which a signals (metrics or trace) are @@ -35,15 +36,16 @@ export class Resource { /** * Returns a Resource that indentifies the SDK in use. */ - static createTelemetrySDKResource(): Resource { + static default(): Resource { return new Resource({ + [SemanticResourceAttributes.SERVICE_NAME]: defaultServiceName(), [SemanticResourceAttributes.TELEMETRY_SDK_LANGUAGE]: SDK_INFO[SemanticResourceAttributes.TELEMETRY_SDK_LANGUAGE], [SemanticResourceAttributes.TELEMETRY_SDK_NAME]: SDK_INFO[SemanticResourceAttributes.TELEMETRY_SDK_NAME], [SemanticResourceAttributes.TELEMETRY_SDK_VERSION]: SDK_INFO[SemanticResourceAttributes.TELEMETRY_SDK_VERSION], - }); + }) } constructor( diff --git a/packages/opentelemetry-resources/src/platform/browser/default-service-name.ts b/packages/opentelemetry-resources/src/platform/browser/default-service-name.ts new file mode 100644 index 00000000000..c31f3bedd9b --- /dev/null +++ b/packages/opentelemetry-resources/src/platform/browser/default-service-name.ts @@ -0,0 +1,19 @@ +/* + * Copyright The OpenTelemetry Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +export function defaultServiceName() { + return 'unknown_service'; +} \ No newline at end of file diff --git a/packages/opentelemetry-resources/src/platform/browser/detect-resources.ts b/packages/opentelemetry-resources/src/platform/browser/detect-resources.ts index 7ea78b8d392..3a815e8825b 100644 --- a/packages/opentelemetry-resources/src/platform/browser/detect-resources.ts +++ b/packages/opentelemetry-resources/src/platform/browser/detect-resources.ts @@ -22,5 +22,5 @@ import { Resource } from '../../Resource'; * is async to match the signature of corresponding method for node. */ export const detectResources = async (): Promise => { - return Resource.createTelemetrySDKResource(); + return Resource.empty(); }; diff --git a/packages/opentelemetry-resources/src/platform/browser/index.ts b/packages/opentelemetry-resources/src/platform/browser/index.ts index f90eb34a5fe..742d36add7d 100644 --- a/packages/opentelemetry-resources/src/platform/browser/index.ts +++ b/packages/opentelemetry-resources/src/platform/browser/index.ts @@ -14,4 +14,5 @@ * limitations under the License. */ +export * from './default-service-name'; export * from './detect-resources'; diff --git a/packages/opentelemetry-resources/src/platform/node/default-service-name.ts b/packages/opentelemetry-resources/src/platform/node/default-service-name.ts new file mode 100644 index 00000000000..0f5b870a63a --- /dev/null +++ b/packages/opentelemetry-resources/src/platform/node/default-service-name.ts @@ -0,0 +1,19 @@ +/* + * Copyright The OpenTelemetry Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +export function defaultServiceName() { + return `unknown_service:${process.argv0}`; +} \ No newline at end of file diff --git a/packages/opentelemetry-resources/src/platform/node/detect-resources.ts b/packages/opentelemetry-resources/src/platform/node/detect-resources.ts index a8e07ba42c3..74a4d337b2e 100644 --- a/packages/opentelemetry-resources/src/platform/node/detect-resources.ts +++ b/packages/opentelemetry-resources/src/platform/node/detect-resources.ts @@ -48,7 +48,7 @@ export const detectResources = async ( return resources.reduce( (acc, resource) => acc.merge(resource), - Resource.createTelemetrySDKResource() + Resource.empty() ); }; diff --git a/packages/opentelemetry-resources/src/platform/node/detectors/EnvDetector.ts b/packages/opentelemetry-resources/src/platform/node/detectors/EnvDetector.ts index bd2449921b2..b496433b4d2 100644 --- a/packages/opentelemetry-resources/src/platform/node/detectors/EnvDetector.ts +++ b/packages/opentelemetry-resources/src/platform/node/detectors/EnvDetector.ts @@ -16,6 +16,7 @@ import { diag } from '@opentelemetry/api'; import { getEnv } from '@opentelemetry/core'; +import { ResourceAttributes as SemanticResourceAttributes } from '@opentelemetry/semantic-conventions'; import { Detector, Resource, @@ -55,20 +56,26 @@ class EnvDetector implements Detector { * @param config The resource detection config */ async detect(_config?: ResourceDetectionConfig): Promise { - try { - const rawAttributes = getEnv().OTEL_RESOURCE_ATTRIBUTES; - if (!rawAttributes) { - diag.debug( - 'EnvDetector failed: Environment variable "OTEL_RESOURCE_ATTRIBUTES" is missing.' - ); - return Resource.empty(); + const attributes: ResourceAttributes = {}; + const env = getEnv(); + + const rawAttributes = env.OTEL_RESOURCE_ATTRIBUTES; + const serviceName = env.OTEL_SERVICE_NAME; + + if (rawAttributes) { + try { + const parsedAttributes = this._parseResourceAttributes(rawAttributes); + Object.assign(attributes, parsedAttributes); + } catch (e) { + diag.debug(`EnvDetector failed: ${e.message}`); } - const attributes = this._parseResourceAttributes(rawAttributes); - return new Resource(attributes); - } catch (e) { - diag.debug(`EnvDetector failed: ${e.message}`); - return Resource.empty(); } + + if (serviceName) { + attributes[SemanticResourceAttributes.SERVICE_NAME] = serviceName; + } + + return new Resource(attributes); } /** diff --git a/packages/opentelemetry-resources/src/platform/node/index.ts b/packages/opentelemetry-resources/src/platform/node/index.ts index 7e82a09dd5d..00426f781ca 100644 --- a/packages/opentelemetry-resources/src/platform/node/index.ts +++ b/packages/opentelemetry-resources/src/platform/node/index.ts @@ -14,5 +14,6 @@ * limitations under the License. */ +export * from './default-service-name'; export * from './detect-resources'; export * from './detectors'; diff --git a/packages/opentelemetry-resources/test/Resource.test.ts b/packages/opentelemetry-resources/test/Resource.test.ts index 4e5962895cd..d321a4422c0 100644 --- a/packages/opentelemetry-resources/test/Resource.test.ts +++ b/packages/opentelemetry-resources/test/Resource.test.ts @@ -17,7 +17,7 @@ import * as assert from 'assert'; import { SDK_INFO } from '@opentelemetry/core'; import { Resource } from '../src'; -import { assertTelemetrySDKResource } from './util/resource-assertions'; +import { ResourceAttributes } from '@opentelemetry/semantic-conventions'; describe('Resource', () => { const resource1 = new Resource({ @@ -84,15 +84,15 @@ describe('Resource', () => { 'custom.number': 42, 'custom.boolean': true, }); - assert.equal(resource.attributes['custom.string'], 'strvalue'); - assert.equal(resource.attributes['custom.number'], 42); - assert.equal(resource.attributes['custom.boolean'], true); + assert.strictEqual(resource.attributes['custom.string'], 'strvalue'); + assert.strictEqual(resource.attributes['custom.number'], 42); + assert.strictEqual(resource.attributes['custom.boolean'], true); }); describe('.empty()', () => { - it('should return an empty resource', () => { + it('should return an empty resource (except required service name)', () => { const resource = Resource.empty(); - assert.equal(Object.entries(resource.attributes), 0); + assert.deepStrictEqual(Object.keys(resource.attributes), []); }); it('should return the same empty resource', () => { @@ -100,14 +100,13 @@ describe('Resource', () => { }); }); - describe('.createTelemetrySDKResource()', () => { - it('should return a telemetry SDK resource', () => { - const resource = Resource.createTelemetrySDKResource(); - assertTelemetrySDKResource(resource, { - language: SDK_INFO.LANGUAGE, - name: SDK_INFO.NAME, - version: SDK_INFO.VERSION, - }); + describe('.default()', () => { + it('should return a default resource', () => { + const resource = Resource.default(); + assert.strictEqual(resource.attributes[ResourceAttributes.TELEMETRY_SDK_NAME], SDK_INFO[ResourceAttributes.TELEMETRY_SDK_NAME]); + assert.strictEqual(resource.attributes[ResourceAttributes.TELEMETRY_SDK_LANGUAGE], SDK_INFO[ResourceAttributes.TELEMETRY_SDK_LANGUAGE]); + assert.strictEqual(resource.attributes[ResourceAttributes.TELEMETRY_SDK_VERSION], SDK_INFO[ResourceAttributes.TELEMETRY_SDK_VERSION]); + assert.strictEqual(resource.attributes[ResourceAttributes.SERVICE_NAME], `unknown_service:${process.argv0}`); }); }); }); diff --git a/packages/opentelemetry-sdk-node/test/sdk.test.ts b/packages/opentelemetry-sdk-node/test/sdk.test.ts index 920d29f6f24..3f80f61678c 100644 --- a/packages/opentelemetry-sdk-node/test/sdk.test.ts +++ b/packages/opentelemetry-sdk-node/test/sdk.test.ts @@ -302,7 +302,7 @@ describe('Node SDK', () => { }); const resource: Resource = sdk['_resource']; assert.ok(resource); - assert.deepStrictEqual(resource, Resource.createTelemetrySDKResource()); + assert.deepStrictEqual(resource, Resource.empty()); scope.done(); }); @@ -392,34 +392,6 @@ describe('Node SDK', () => { ); }); - describe('with missing environment variable', () => { - beforeEach(() => { - delete process.env.OTEL_RESOURCE_ATTRIBUTES; - }); - - it('prints correct error messages when EnvDetector has no env variable', async () => { - const sdk = new NodeSDK({ - autoDetectResources: true, - }); - const mockedLoggerMethod = Sinon.fake(); - diag.setLogger( - { - debug: mockedLoggerMethod, - } as any, - DiagLogLevel.DEBUG - ); - - await sdk.detectResources(); - - assert.ok( - callArgsContains( - mockedLoggerMethod, - 'EnvDetector failed: Environment variable "OTEL_RESOURCE_ATTRIBUTES" is missing.' - ) - ); - }); - }); - describe('with a faulty environment variable', () => { beforeEach(() => { process.env.OTEL_RESOURCE_ATTRIBUTES = 'bad=~attribute'; diff --git a/packages/opentelemetry-tracing/src/BasicTracerProvider.ts b/packages/opentelemetry-tracing/src/BasicTracerProvider.ts index 4166d773942..d8ca406c1c5 100644 --- a/packages/opentelemetry-tracing/src/BasicTracerProvider.ts +++ b/packages/opentelemetry-tracing/src/BasicTracerProvider.ts @@ -75,8 +75,8 @@ export class BasicTracerProvider implements TracerProvider { constructor(config: TracerConfig = {}) { const mergedConfig = merge({}, DEFAULT_CONFIG, config); - this.resource = - mergedConfig.resource ?? Resource.createTelemetrySDKResource(); + this.resource = mergedConfig.resource ?? Resource.empty(); + this.resource = Resource.default().merge(this.resource); this._config = Object.assign({}, mergedConfig, { resource: this.resource, }); From d5517812b31d9206131bf1df4f8a3b5183ab07fb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gerhard=20St=C3=B6bich?= Date: Tue, 1 Jun 2021 21:40:04 +0200 Subject: [PATCH 02/11] chore: update typescript to 4.3 and enable noImplicitOverride (#2241) Co-authored-by: Daniel Dyla --- backwards-compatability/node10/package.json | 2 +- backwards-compatability/node12/package.json | 2 +- backwards-compatability/node8/package.json | 2 +- .../package.json | 2 +- package.json | 10 +++---- .../opentelemetry-api-metrics/package.json | 2 +- .../test/api/api.test.ts | 2 +- .../package.json | 2 +- .../package.json | 2 +- .../opentelemetry-context-zone/package.json | 2 +- packages/opentelemetry-core/package.json | 2 +- .../package.json | 2 +- .../package.json | 2 +- .../src/CollectorExporterNodeBase.ts | 4 +-- .../package.json | 2 +- .../src/types.ts | 2 +- .../package.json | 2 +- .../package.json | 2 +- .../package.json | 2 +- .../package.json | 2 +- .../src/fetch.ts | 4 +-- .../package.json | 2 +- .../src/grpc-js/index.ts | 4 +-- .../src/grpc/index.ts | 4 +-- .../package.json | 2 +- .../src/http.ts | 2 +- .../package.json | 2 +- .../src/xhr.ts | 4 +-- .../package.json | 2 +- .../src/platform/browser/instrumentation.ts | 4 +-- .../test/common/Instrumentation.test.ts | 6 ++-- .../test/common/autoLoader.test.ts | 4 +-- .../test/common/autoLoaderUtils.test.ts | 4 +-- packages/opentelemetry-metrics/package.json | 2 +- .../src/BaseObserverMetric.ts | 2 +- .../src/SumObserverMetric.ts | 2 +- packages/opentelemetry-node/package.json | 2 +- .../src/NodeTracerProvider.ts | 6 ++-- .../opentelemetry-propagator-b3/package.json | 2 +- .../package.json | 2 +- .../package.json | 2 +- .../package.json | 2 +- packages/opentelemetry-resources/package.json | 2 +- packages/opentelemetry-sdk-node/package.json | 2 +- .../package.json | 2 +- .../package.json | 2 +- .../src/shim.ts | 30 +++++++++---------- packages/opentelemetry-tracing/package.json | 2 +- .../test/BasicTracerProvider.test.ts | 2 +- .../test/export/TestTracingSpanExporter.ts | 6 ++-- packages/opentelemetry-web/package.json | 2 +- .../src/WebTracerProvider.ts | 2 +- packages/template/package.json | 2 +- tsconfig.base.json | 1 + 54 files changed, 86 insertions(+), 85 deletions(-) diff --git a/backwards-compatability/node10/package.json b/backwards-compatability/node10/package.json index e16056a20ef..4e28f51035a 100644 --- a/backwards-compatability/node10/package.json +++ b/backwards-compatability/node10/package.json @@ -13,7 +13,7 @@ }, "devDependencies": { "@types/node": "10.17.59", - "typescript": "4.2.4" + "typescript": "4.3.2" }, "author": "OpenTelemetry Authors", "license": "Apache-2.0" diff --git a/backwards-compatability/node12/package.json b/backwards-compatability/node12/package.json index 38dab3f3e0a..5d8f6304fc4 100644 --- a/backwards-compatability/node12/package.json +++ b/backwards-compatability/node12/package.json @@ -13,7 +13,7 @@ }, "devDependencies": { "@types/node": "12.20.11", - "typescript": "4.2.4" + "typescript": "4.3.2" }, "author": "OpenTelemetry Authors", "license": "Apache-2.0" diff --git a/backwards-compatability/node8/package.json b/backwards-compatability/node8/package.json index 870628238f2..9b1d4e1af14 100644 --- a/backwards-compatability/node8/package.json +++ b/backwards-compatability/node8/package.json @@ -13,7 +13,7 @@ }, "devDependencies": { "@types/node": "8.10.66", - "typescript": "4.2.4" + "typescript": "4.3.2" }, "author": "OpenTelemetry Authors", "license": "Apache-2.0" diff --git a/integration-tests/propagation-validation-server/package.json b/integration-tests/propagation-validation-server/package.json index 9370b68f8b4..b99969d0f26 100644 --- a/integration-tests/propagation-validation-server/package.json +++ b/integration-tests/propagation-validation-server/package.json @@ -20,7 +20,7 @@ }, "devDependencies": { "@opentelemetry/api": "^0.20.0", - "typescript": "4.2.4" + "typescript": "4.3.2" }, "peerDependencies": { "@opentelemetry/api": "^0.20.0" diff --git a/package.json b/package.json index 93c78d1c34b..1f11b0db1e1 100644 --- a/package.json +++ b/package.json @@ -47,21 +47,21 @@ "devDependencies": { "@commitlint/cli": "12.1.1", "@commitlint/config-conventional": "12.1.1", - "@typescript-eslint/eslint-plugin": "4.22.0", - "@typescript-eslint/parser": "4.22.0", + "@typescript-eslint/eslint-plugin": "4.25.0", + "@typescript-eslint/parser": "4.25.0", "beautify-benchmark": "0.2.4", "benchmark": "2.1.4", - "eslint": "7.25.0", + "eslint": "7.27.0", "eslint-config-airbnb-base": "14.2.1", "eslint-plugin-header": "3.1.1", - "eslint-plugin-import": "2.22.1", + "eslint-plugin-import": "2.23.3", "eslint-plugin-node": "11.1.0", "gh-pages": "3.1.0", "husky": "4.3.8", "lerna": "3.22.1", "lerna-changelog": "1.0.1", "markdownlint-cli": "0.27.1", - "typescript": "4.2.4", + "typescript": "4.3.2", "update-ts-references": "2.3.0" }, "husky": { diff --git a/packages/opentelemetry-api-metrics/package.json b/packages/opentelemetry-api-metrics/package.json index 79e9d1c7c0e..e4e05255acd 100644 --- a/packages/opentelemetry-api-metrics/package.json +++ b/packages/opentelemetry-api-metrics/package.json @@ -72,7 +72,7 @@ "nyc": "15.1.0", "ts-loader": "8.2.0", "ts-mocha": "8.0.0", - "typescript": "4.2.4", + "typescript": "4.3.2", "webpack": "4.46.0" } } diff --git a/packages/opentelemetry-api-metrics/test/api/api.test.ts b/packages/opentelemetry-api-metrics/test/api/api.test.ts index 674e9aebd49..e9a837230ec 100644 --- a/packages/opentelemetry-api-metrics/test/api/api.test.ts +++ b/packages/opentelemetry-api-metrics/test/api/api.test.ts @@ -38,7 +38,7 @@ describe('API', () => { }); class TestMeterProvider extends NoopMeterProvider { - getMeter() { + override getMeter() { return dummyMeter; } } diff --git a/packages/opentelemetry-context-async-hooks/package.json b/packages/opentelemetry-context-async-hooks/package.json index 6578681517f..1513c49ce7e 100644 --- a/packages/opentelemetry-context-async-hooks/package.json +++ b/packages/opentelemetry-context-async-hooks/package.json @@ -50,7 +50,7 @@ "rimraf": "3.0.2", "ts-mocha": "8.0.0", "ts-node": "9.1.1", - "typescript": "4.2.4" + "typescript": "4.3.2" }, "peerDependencies": { "@opentelemetry/api": "^0.20.0" diff --git a/packages/opentelemetry-context-zone-peer-dep/package.json b/packages/opentelemetry-context-zone-peer-dep/package.json index ec2cac84987..4f026dd2e90 100644 --- a/packages/opentelemetry-context-zone-peer-dep/package.json +++ b/packages/opentelemetry-context-zone-peer-dep/package.json @@ -68,7 +68,7 @@ "ts-loader": "8.2.0", "ts-mocha": "8.0.0", "ts-node": "9.1.1", - "typescript": "4.2.4", + "typescript": "4.3.2", "webpack": "4.46.0", "webpack-cli": "4.6.0", "zone.js": "0.11.4" diff --git a/packages/opentelemetry-context-zone/package.json b/packages/opentelemetry-context-zone/package.json index de4f2493e6e..acd4ffe2fd1 100644 --- a/packages/opentelemetry-context-zone/package.json +++ b/packages/opentelemetry-context-zone/package.json @@ -61,7 +61,7 @@ "ts-loader": "8.2.0", "ts-mocha": "8.0.0", "ts-node": "9.1.1", - "typescript": "4.2.4", + "typescript": "4.3.2", "webpack": "4.46.0", "webpack-cli": "4.6.0", "webpack-merge": "5.7.3" diff --git a/packages/opentelemetry-core/package.json b/packages/opentelemetry-core/package.json index 203df4e8334..fa168f9ba78 100644 --- a/packages/opentelemetry-core/package.json +++ b/packages/opentelemetry-core/package.json @@ -76,7 +76,7 @@ "ts-loader": "8.2.0", "ts-mocha": "8.0.0", "ts-node": "9.1.1", - "typescript": "4.2.4", + "typescript": "4.3.2", "webpack": "4.46.0" }, "peerDependencies": { diff --git a/packages/opentelemetry-exporter-collector-grpc/package.json b/packages/opentelemetry-exporter-collector-grpc/package.json index 2c05c1d97b0..6b4be1752cf 100644 --- a/packages/opentelemetry-exporter-collector-grpc/package.json +++ b/packages/opentelemetry-exporter-collector-grpc/package.json @@ -60,7 +60,7 @@ "ts-loader": "8.2.0", "ts-mocha": "8.0.0", "ts-node": "9.1.1", - "typescript": "4.2.4" + "typescript": "4.3.2" }, "peerDependencies": { "@opentelemetry/api": "^0.20.0" diff --git a/packages/opentelemetry-exporter-collector-proto/package.json b/packages/opentelemetry-exporter-collector-proto/package.json index 276557a17d8..725bad7e55f 100644 --- a/packages/opentelemetry-exporter-collector-proto/package.json +++ b/packages/opentelemetry-exporter-collector-proto/package.json @@ -60,7 +60,7 @@ "ts-loader": "8.2.0", "ts-mocha": "8.0.0", "ts-node": "9.1.1", - "typescript": "4.2.4" + "typescript": "4.3.2" }, "peerDependencies": { "@opentelemetry/api": "^0.20.0" diff --git a/packages/opentelemetry-exporter-collector-proto/src/CollectorExporterNodeBase.ts b/packages/opentelemetry-exporter-collector-proto/src/CollectorExporterNodeBase.ts index 3a8bc2dfa6f..7fbb4f60570 100644 --- a/packages/opentelemetry-exporter-collector-proto/src/CollectorExporterNodeBase.ts +++ b/packages/opentelemetry-exporter-collector-proto/src/CollectorExporterNodeBase.ts @@ -57,7 +57,7 @@ export abstract class CollectorExporterNodeBase< this._sendingPromises.push(promise); } - onInit(config: CollectorExporterNodeConfigBase): void { + override onInit(config: CollectorExporterNodeConfigBase): void { this._isShutdown = false; // defer to next tick and lazy load to avoid loading protobufjs too early // and making this impossible to be instrumented @@ -68,7 +68,7 @@ export abstract class CollectorExporterNodeBase< }); } - send( + override send( objects: ExportItem[], onSuccess: () => void, onError: (error: collectorTypes.CollectorExporterError) => void diff --git a/packages/opentelemetry-exporter-collector/package.json b/packages/opentelemetry-exporter-collector/package.json index a71b6417422..6b259563b4f 100644 --- a/packages/opentelemetry-exporter-collector/package.json +++ b/packages/opentelemetry-exporter-collector/package.json @@ -76,7 +76,7 @@ "ts-loader": "8.2.0", "ts-mocha": "8.0.0", "ts-node": "9.1.1", - "typescript": "4.2.4", + "typescript": "4.3.2", "webpack": "4.46.0", "webpack-cli": "4.6.0", "webpack-merge": "5.7.3" diff --git a/packages/opentelemetry-exporter-collector/src/types.ts b/packages/opentelemetry-exporter-collector/src/types.ts index d1de81259e0..e8ae3ff65e4 100644 --- a/packages/opentelemetry-exporter-collector/src/types.ts +++ b/packages/opentelemetry-exporter-collector/src/types.ts @@ -315,7 +315,7 @@ export namespace opentelemetryProto { */ export class CollectorExporterError extends Error { readonly code?: number; - readonly name: string = 'CollectorExporterError'; + override readonly name: string = 'CollectorExporterError'; readonly data?: string; constructor(message?: string, code?: number, data?: string) { diff --git a/packages/opentelemetry-exporter-jaeger/package.json b/packages/opentelemetry-exporter-jaeger/package.json index 53314e2353a..e9014e70a65 100644 --- a/packages/opentelemetry-exporter-jaeger/package.json +++ b/packages/opentelemetry-exporter-jaeger/package.json @@ -53,7 +53,7 @@ "sinon": "10.0.0", "ts-mocha": "8.0.0", "ts-node": "9.1.1", - "typescript": "4.2.4" + "typescript": "4.3.2" }, "peerDependencies": { "@opentelemetry/api": "^0.20.0" diff --git a/packages/opentelemetry-exporter-prometheus/package.json b/packages/opentelemetry-exporter-prometheus/package.json index cb3157afca0..7fcc3d0aa31 100644 --- a/packages/opentelemetry-exporter-prometheus/package.json +++ b/packages/opentelemetry-exporter-prometheus/package.json @@ -50,7 +50,7 @@ "sinon": "10.0.0", "ts-mocha": "8.0.0", "ts-node": "9.1.1", - "typescript": "4.2.4" + "typescript": "4.3.2" }, "peerDependencies": { "@opentelemetry/api": "^0.20.0" diff --git a/packages/opentelemetry-exporter-zipkin/package.json b/packages/opentelemetry-exporter-zipkin/package.json index 03d06876add..2b409e9e909 100644 --- a/packages/opentelemetry-exporter-zipkin/package.json +++ b/packages/opentelemetry-exporter-zipkin/package.json @@ -74,7 +74,7 @@ "ts-loader": "8.2.0", "ts-mocha": "8.0.0", "ts-node": "9.1.1", - "typescript": "4.2.4", + "typescript": "4.3.2", "webpack": "4.46.0", "webpack-cli": "4.6.0", "webpack-merge": "5.7.3" diff --git a/packages/opentelemetry-instrumentation-fetch/package.json b/packages/opentelemetry-instrumentation-fetch/package.json index 5e9bb8d8ddc..23659ed8a89 100644 --- a/packages/opentelemetry-instrumentation-fetch/package.json +++ b/packages/opentelemetry-instrumentation-fetch/package.json @@ -72,7 +72,7 @@ "ts-loader": "8.2.0", "ts-mocha": "8.0.0", "ts-node": "9.1.1", - "typescript": "4.2.4", + "typescript": "4.3.2", "webpack": "4.46.0", "webpack-cli": "4.6.0", "webpack-merge": "5.7.3" diff --git a/packages/opentelemetry-instrumentation-fetch/src/fetch.ts b/packages/opentelemetry-instrumentation-fetch/src/fetch.ts index ef12407ff99..42b45b2d8e2 100644 --- a/packages/opentelemetry-instrumentation-fetch/src/fetch.ts +++ b/packages/opentelemetry-instrumentation-fetch/src/fetch.ts @@ -458,7 +458,7 @@ export class FetchInstrumentation extends InstrumentationBase< /** * implements enable function */ - enable() { + override enable() { if (isWrapped(window.fetch)) { this._unwrap(window, 'fetch'); api.diag.debug('removing previous patch for constructor'); @@ -469,7 +469,7 @@ export class FetchInstrumentation extends InstrumentationBase< /** * implements unpatch function */ - disable() { + override disable() { this._unwrap(window, 'fetch'); this._usedResources = new WeakSet(); } diff --git a/packages/opentelemetry-instrumentation-grpc/package.json b/packages/opentelemetry-instrumentation-grpc/package.json index 34f9e5d4cdb..f12cb09f1e3 100644 --- a/packages/opentelemetry-instrumentation-grpc/package.json +++ b/packages/opentelemetry-instrumentation-grpc/package.json @@ -63,7 +63,7 @@ "sinon": "10.0.0", "ts-mocha": "8.0.0", "ts-node": "9.1.1", - "typescript": "4.2.4" + "typescript": "4.3.2" }, "peerDependencies": { "@opentelemetry/api": "^0.20.0" diff --git a/packages/opentelemetry-instrumentation-grpc/src/grpc-js/index.ts b/packages/opentelemetry-instrumentation-grpc/src/grpc-js/index.ts index 9db03116670..753ac06b7b4 100644 --- a/packages/opentelemetry-instrumentation-grpc/src/grpc-js/index.ts +++ b/packages/opentelemetry-instrumentation-grpc/src/grpc-js/index.ts @@ -57,14 +57,14 @@ import { AttributeNames } from '../enums/AttributeNames'; export class GrpcJsInstrumentation extends InstrumentationBase { constructor( - protected _config: GrpcInstrumentationConfig & InstrumentationConfig = {}, + protected override _config: GrpcInstrumentationConfig & InstrumentationConfig = {}, name: string, version: string ) { super(name, version, _config); } - public setConfig( + public override setConfig( config: GrpcInstrumentationConfig & InstrumentationConfig = {} ) { this._config = Object.assign({}, config); diff --git a/packages/opentelemetry-instrumentation-grpc/src/grpc/index.ts b/packages/opentelemetry-instrumentation-grpc/src/grpc/index.ts index 84deb7b228a..ade2ea3aabc 100644 --- a/packages/opentelemetry-instrumentation-grpc/src/grpc/index.ts +++ b/packages/opentelemetry-instrumentation-grpc/src/grpc/index.ts @@ -56,14 +56,14 @@ export class GrpcNativeInstrumentation extends InstrumentationBase< typeof grpcTypes > { constructor( - protected _config: GrpcInstrumentationConfig & InstrumentationConfig = {}, + protected override _config: GrpcInstrumentationConfig & InstrumentationConfig = {}, name: string, version: string ) { super(name, version, _config); } - public setConfig( + public override setConfig( config: GrpcInstrumentationConfig & InstrumentationConfig = {} ) { this._config = Object.assign({}, config); diff --git a/packages/opentelemetry-instrumentation-http/package.json b/packages/opentelemetry-instrumentation-http/package.json index 34f3b22af00..84b9954f3e0 100644 --- a/packages/opentelemetry-instrumentation-http/package.json +++ b/packages/opentelemetry-instrumentation-http/package.json @@ -65,7 +65,7 @@ "superagent": "6.1.0", "ts-mocha": "8.0.0", "ts-node": "9.1.1", - "typescript": "4.2.4" + "typescript": "4.3.2" }, "peerDependencies": { "@opentelemetry/api": "^0.20.0" diff --git a/packages/opentelemetry-instrumentation-http/src/http.ts b/packages/opentelemetry-instrumentation-http/src/http.ts index 25c22e7fbf2..b3a2db9931f 100644 --- a/packages/opentelemetry-instrumentation-http/src/http.ts +++ b/packages/opentelemetry-instrumentation-http/src/http.ts @@ -73,7 +73,7 @@ export class HttpInstrumentation extends InstrumentationBase { return this._config; } - setConfig(config: HttpInstrumentationConfig & InstrumentationConfig = {}) { + override setConfig(config: HttpInstrumentationConfig & InstrumentationConfig = {}) { this._config = Object.assign({}, config); } diff --git a/packages/opentelemetry-instrumentation-xml-http-request/package.json b/packages/opentelemetry-instrumentation-xml-http-request/package.json index 5f3a3362784..dc1b140a37b 100644 --- a/packages/opentelemetry-instrumentation-xml-http-request/package.json +++ b/packages/opentelemetry-instrumentation-xml-http-request/package.json @@ -71,7 +71,7 @@ "ts-loader": "8.2.0", "ts-mocha": "8.0.0", "ts-node": "9.1.1", - "typescript": "4.2.4", + "typescript": "4.3.2", "webpack": "4.46.0", "webpack-cli": "4.6.0", "webpack-merge": "5.7.3" diff --git a/packages/opentelemetry-instrumentation-xml-http-request/src/xhr.ts b/packages/opentelemetry-instrumentation-xml-http-request/src/xhr.ts index 0cca5535c62..25ff68ec18b 100644 --- a/packages/opentelemetry-instrumentation-xml-http-request/src/xhr.ts +++ b/packages/opentelemetry-instrumentation-xml-http-request/src/xhr.ts @@ -510,7 +510,7 @@ export class XMLHttpRequestInstrumentation extends InstrumentationBase { it('should enable instrumentation by default', () => { let called = false; class TestInstrumentation2 extends TestInstrumentation { - enable() { + override enable() { called = true; } } diff --git a/packages/opentelemetry-instrumentation/test/common/autoLoader.test.ts b/packages/opentelemetry-instrumentation/test/common/autoLoader.test.ts index 4d9aa12e756..181eb12c0ea 100644 --- a/packages/opentelemetry-instrumentation/test/common/autoLoader.test.ts +++ b/packages/opentelemetry-instrumentation/test/common/autoLoader.test.ts @@ -29,8 +29,8 @@ class FooInstrumentation extends InstrumentationBase { init() { return []; } - enable() {} - disable() {} + override enable() {} + override disable() {} } describe('autoLoader', () => { diff --git a/packages/opentelemetry-instrumentation/test/common/autoLoaderUtils.test.ts b/packages/opentelemetry-instrumentation/test/common/autoLoaderUtils.test.ts index ae2de445021..24772250046 100644 --- a/packages/opentelemetry-instrumentation/test/common/autoLoaderUtils.test.ts +++ b/packages/opentelemetry-instrumentation/test/common/autoLoaderUtils.test.ts @@ -27,9 +27,9 @@ class FooInstrumentation extends InstrumentationBase { return []; } - enable() {} + override enable() {} - disable() {} + override disable() {} } // const fooInstrumentation = new FooInstrumentation(); diff --git a/packages/opentelemetry-metrics/package.json b/packages/opentelemetry-metrics/package.json index eb4da1f6288..609b62c7503 100644 --- a/packages/opentelemetry-metrics/package.json +++ b/packages/opentelemetry-metrics/package.json @@ -56,7 +56,7 @@ "sinon": "10.0.0", "ts-mocha": "8.0.0", "ts-node": "9.1.1", - "typescript": "4.2.4" + "typescript": "4.3.2" }, "peerDependencies": { "@opentelemetry/api": "^0.20.0" diff --git a/packages/opentelemetry-metrics/src/BaseObserverMetric.ts b/packages/opentelemetry-metrics/src/BaseObserverMetric.ts index 30ae3af1e85..a3098f119cc 100644 --- a/packages/opentelemetry-metrics/src/BaseObserverMetric.ts +++ b/packages/opentelemetry-metrics/src/BaseObserverMetric.ts @@ -55,7 +55,7 @@ export abstract class BaseObserverMetric ); } - async getMetricRecord(): Promise { + override async getMetricRecord(): Promise { const observerResult = new ObserverResult(); await this._callback(observerResult); diff --git a/packages/opentelemetry-metrics/src/SumObserverMetric.ts b/packages/opentelemetry-metrics/src/SumObserverMetric.ts index 2f4c723ec90..7244bc88d4d 100644 --- a/packages/opentelemetry-metrics/src/SumObserverMetric.ts +++ b/packages/opentelemetry-metrics/src/SumObserverMetric.ts @@ -45,7 +45,7 @@ export class SumObserverMetric ); } - protected _processResults(observerResult: ObserverResult) { + protected override _processResults(observerResult: ObserverResult) { observerResult.values.forEach((value, labels) => { const instrument = this.bind(labels); // SumObserver is monotonic which means it should only accept values diff --git a/packages/opentelemetry-node/package.json b/packages/opentelemetry-node/package.json index 7d7be4daf42..187699480f1 100644 --- a/packages/opentelemetry-node/package.json +++ b/packages/opentelemetry-node/package.json @@ -57,7 +57,7 @@ "sinon": "10.0.0", "ts-mocha": "8.0.0", "ts-node": "9.1.1", - "typescript": "4.2.4" + "typescript": "4.3.2" }, "peerDependencies": { "@opentelemetry/api": "^0.20.0" diff --git a/packages/opentelemetry-node/src/NodeTracerProvider.ts b/packages/opentelemetry-node/src/NodeTracerProvider.ts index e2f5f5fba09..326200a2964 100644 --- a/packages/opentelemetry-node/src/NodeTracerProvider.ts +++ b/packages/opentelemetry-node/src/NodeTracerProvider.ts @@ -36,7 +36,7 @@ import { JaegerPropagator } from '@opentelemetry/propagator-jaeger'; * @param config Configuration object for SDK registration */ export class NodeTracerProvider extends BasicTracerProvider { - protected static readonly _registeredPropagators = new Map< + protected static override readonly _registeredPropagators = new Map< string, PROPAGATOR_FACTORY >([ @@ -56,7 +56,7 @@ export class NodeTracerProvider extends BasicTracerProvider { super(config); } - register(config: SDKRegistrationConfig = {}) { + override register(config: SDKRegistrationConfig = {}) { if (config.contextManager === undefined) { const ContextManager = semver.gte(process.version, '14.8.0') ? AsyncLocalStorageContextManager @@ -68,7 +68,7 @@ export class NodeTracerProvider extends BasicTracerProvider { super.register(config); } - protected _getPropagator(name: string): TextMapPropagator | undefined { + protected override _getPropagator(name: string): TextMapPropagator | undefined { return ( super._getPropagator(name) || NodeTracerProvider._registeredPropagators.get(name)?.() diff --git a/packages/opentelemetry-propagator-b3/package.json b/packages/opentelemetry-propagator-b3/package.json index 3218776db9f..ee37dd9b5ae 100644 --- a/packages/opentelemetry-propagator-b3/package.json +++ b/packages/opentelemetry-propagator-b3/package.json @@ -59,6 +59,6 @@ "rimraf": "3.0.2", "ts-loader": "8.2.0", "ts-mocha": "8.0.0", - "typescript": "4.2.4" + "typescript": "4.3.2" } } diff --git a/packages/opentelemetry-propagator-jaeger/package.json b/packages/opentelemetry-propagator-jaeger/package.json index b944425dd8d..4ee8beae3b1 100644 --- a/packages/opentelemetry-propagator-jaeger/package.json +++ b/packages/opentelemetry-propagator-jaeger/package.json @@ -67,7 +67,7 @@ "ts-loader": "8.2.0", "ts-mocha": "8.0.0", "ts-node": "9.1.1", - "typescript": "4.2.4", + "typescript": "4.3.2", "webpack": "4.46.0" }, "peerDependencies": { diff --git a/packages/opentelemetry-resource-detector-aws/package.json b/packages/opentelemetry-resource-detector-aws/package.json index 1a774da5eb8..0072c00cc2c 100644 --- a/packages/opentelemetry-resource-detector-aws/package.json +++ b/packages/opentelemetry-resource-detector-aws/package.json @@ -51,7 +51,7 @@ "sinon": "10.0.0", "ts-mocha": "8.0.0", "ts-node": "9.1.1", - "typescript": "4.2.4" + "typescript": "4.3.2" }, "peerDependencies": { "@opentelemetry/api": "^0.20.0" diff --git a/packages/opentelemetry-resource-detector-gcp/package.json b/packages/opentelemetry-resource-detector-gcp/package.json index 57486e71309..4bb08dee6c2 100644 --- a/packages/opentelemetry-resource-detector-gcp/package.json +++ b/packages/opentelemetry-resource-detector-gcp/package.json @@ -51,7 +51,7 @@ "rimraf": "3.0.2", "ts-mocha": "8.0.0", "ts-node": "9.1.1", - "typescript": "4.2.4" + "typescript": "4.3.2" }, "peerDependencies": { "@opentelemetry/api": "^0.20.0" diff --git a/packages/opentelemetry-resources/package.json b/packages/opentelemetry-resources/package.json index c566fa2a283..54dc765e51e 100644 --- a/packages/opentelemetry-resources/package.json +++ b/packages/opentelemetry-resources/package.json @@ -60,7 +60,7 @@ "sinon": "10.0.0", "ts-mocha": "8.0.0", "ts-node": "9.1.1", - "typescript": "4.2.4" + "typescript": "4.3.2" }, "peerDependencies": { "@opentelemetry/api": "^0.20.0" diff --git a/packages/opentelemetry-sdk-node/package.json b/packages/opentelemetry-sdk-node/package.json index 2840d175032..93c0a8e3c0b 100644 --- a/packages/opentelemetry-sdk-node/package.json +++ b/packages/opentelemetry-sdk-node/package.json @@ -70,6 +70,6 @@ "sinon": "10.0.0", "ts-loader": "8.2.0", "ts-mocha": "8.0.0", - "typescript": "4.2.4" + "typescript": "4.3.2" } } diff --git a/packages/opentelemetry-semantic-conventions/package.json b/packages/opentelemetry-semantic-conventions/package.json index 9394b076568..6d6fc4892f5 100644 --- a/packages/opentelemetry-semantic-conventions/package.json +++ b/packages/opentelemetry-semantic-conventions/package.json @@ -54,6 +54,6 @@ "sinon": "10.0.0", "ts-mocha": "8.0.0", "ts-node": "9.1.1", - "typescript": "4.2.4" + "typescript": "4.3.2" } } diff --git a/packages/opentelemetry-shim-opentracing/package.json b/packages/opentelemetry-shim-opentracing/package.json index 24e94538aa8..c39054cefee 100644 --- a/packages/opentelemetry-shim-opentracing/package.json +++ b/packages/opentelemetry-shim-opentracing/package.json @@ -52,7 +52,7 @@ "ts-node": "9.1.1", "tslint-consistent-codestyle": "1.16.0", "tslint-microsoft-contrib": "6.2.0", - "typescript": "4.2.4" + "typescript": "4.3.2" }, "peerDependencies": { "@opentelemetry/api": "^0.20.0" diff --git a/packages/opentelemetry-shim-opentracing/src/shim.ts b/packages/opentelemetry-shim-opentracing/src/shim.ts index 18632de9d36..0659409ad9c 100644 --- a/packages/opentelemetry-shim-opentracing/src/shim.ts +++ b/packages/opentelemetry-shim-opentracing/src/shim.ts @@ -95,14 +95,14 @@ export class SpanContextShim extends opentracing.SpanContext { /** * Returns the trace ID as a string. */ - toTraceId(): string { + override toTraceId(): string { return this._spanContext.traceId; } /** * Returns the span ID as a string. */ - toSpanId(): string { + override toSpanId(): string { return this._spanContext.spanId; } @@ -130,7 +130,7 @@ export class TracerShim extends opentracing.Tracer { this._propagators = propagators; } - startSpan( + override startSpan( name: string, options: opentracing.SpanOptions = {} ): opentracing.Span { @@ -155,7 +155,7 @@ export class TracerShim extends opentracing.Tracer { return new SpanShim(this, span, baggage); } - _inject( + override _inject( spanContext: opentracing.SpanContext, format: string, carrier: unknown @@ -182,7 +182,7 @@ export class TracerShim extends opentracing.Tracer { } } - _extract(format: string, carrier: unknown): opentracing.SpanContext | null { + override _extract(format: string, carrier: unknown): opentracing.SpanContext | null { if (format === opentracing.FORMAT_BINARY) { api.diag.warn('OpentracingShim.extract() does not support FORMAT_BINARY'); // @todo: Implement binary format @@ -243,14 +243,14 @@ export class SpanShim extends opentracing.Span { * * @returns a {@link SpanContextShim} containing the underlying context. */ - context(): opentracing.SpanContext { + override context(): opentracing.SpanContext { return this._contextShim; } /** * Returns the {@link opentracing.Tracer} that created the span. */ - tracer(): opentracing.Tracer { + override tracer(): opentracing.Tracer { return this._tracerShim; } @@ -259,7 +259,7 @@ export class SpanShim extends opentracing.Span { * * @param name the Span name. */ - setOperationName(name: string): this { + override setOperationName(name: string): this { this._span.updateName(name); return this; } @@ -270,7 +270,7 @@ export class SpanShim extends opentracing.Span { * * @param finishTime An optional timestamp to explicitly set the span's end time. */ - finish(finishTime?: number): void { + override finish(finishTime?: number): void { this._span.end(finishTime); } @@ -279,7 +279,7 @@ export class SpanShim extends opentracing.Span { * @param eventName name of the event. * @param payload an arbitrary object to be attached to the event. */ - logEvent(eventName: string, payload?: SpanAttributes): void { + override logEvent(eventName: string, payload?: SpanAttributes): void { this._span.addEvent(eventName, payload); } @@ -287,7 +287,7 @@ export class SpanShim extends opentracing.Span { * Logs a set of key value pairs. Since OpenTelemetry only supports events, * the KV pairs are used as attributes on an event named "log". */ - log(keyValuePairs: SpanAttributes, _timestamp?: number): this { + override log(keyValuePairs: SpanAttributes, _timestamp?: number): this { // @todo: Handle timestamp this._span.addEvent('log', keyValuePairs); return this; @@ -297,7 +297,7 @@ export class SpanShim extends opentracing.Span { * Adds a set of tags to the span. * @param keyValueMap set of KV pairs representing tags */ - addTags(keyValueMap: SpanAttributes): this { + override addTags(keyValueMap: SpanAttributes): this { this._span.setAttributes(keyValueMap); return this; } @@ -308,7 +308,7 @@ export class SpanShim extends opentracing.Span { * @param key key for the tag * @param value value for the tag */ - setTag(key: string, value: SpanAttributeValue): this { + override setTag(key: string, value: SpanAttributeValue): this { if ( key === opentracing.Tags.ERROR && (value === true || value === 'true') @@ -321,11 +321,11 @@ export class SpanShim extends opentracing.Span { return this; } - getBaggageItem(key: string): string | undefined { + override getBaggageItem(key: string): string | undefined { return this._contextShim.getBaggageItem(key); } - setBaggageItem(key: string, value: string): this { + override setBaggageItem(key: string, value: string): this { this._contextShim.setBaggageItem(key, value); return this; } diff --git a/packages/opentelemetry-tracing/package.json b/packages/opentelemetry-tracing/package.json index f417007a6f7..73dad83f60a 100644 --- a/packages/opentelemetry-tracing/package.json +++ b/packages/opentelemetry-tracing/package.json @@ -74,7 +74,7 @@ "ts-loader": "8.2.0", "ts-mocha": "8.0.0", "ts-node": "9.1.1", - "typescript": "4.2.4", + "typescript": "4.3.2", "webpack": "4.46.0" }, "peerDependencies": { diff --git a/packages/opentelemetry-tracing/test/BasicTracerProvider.test.ts b/packages/opentelemetry-tracing/test/BasicTracerProvider.test.ts index 906fb79e9d4..43432fcb056 100644 --- a/packages/opentelemetry-tracing/test/BasicTracerProvider.test.ts +++ b/packages/opentelemetry-tracing/test/BasicTracerProvider.test.ts @@ -225,7 +225,7 @@ describe('BasicTracerProvider', () => { describe('exporter', () => { class CustomTracerProvider extends BasicTracerProvider { - protected _getSpanExporter(name: string): SpanExporter | undefined { + protected override _getSpanExporter(name: string): SpanExporter | undefined { return name === 'memory' ? new InMemorySpanExporter() : BasicTracerProvider._registeredExporters.get(name)?.(); diff --git a/packages/opentelemetry-tracing/test/export/TestTracingSpanExporter.ts b/packages/opentelemetry-tracing/test/export/TestTracingSpanExporter.ts index 499faf91ebd..758f38a26d8 100644 --- a/packages/opentelemetry-tracing/test/export/TestTracingSpanExporter.ts +++ b/packages/opentelemetry-tracing/test/export/TestTracingSpanExporter.ts @@ -58,7 +58,7 @@ export class TestTracingSpanExporter extends InMemorySpanExporter { ); } - export( + override export( spans: ReadableSpan[], resultCallback: (result: ExportResult) => void ): void { @@ -71,13 +71,13 @@ export class TestTracingSpanExporter extends InMemorySpanExporter { super.export(spans, resultCallback); } - shutdown(): Promise { + override shutdown(): Promise { return super.shutdown().then(() => { this._exporterCreatedSpans = []; }); } - reset() { + override reset() { super.reset(); this._exporterCreatedSpans = []; } diff --git a/packages/opentelemetry-web/package.json b/packages/opentelemetry-web/package.json index 3025afae7aa..50b7f862d84 100644 --- a/packages/opentelemetry-web/package.json +++ b/packages/opentelemetry-web/package.json @@ -72,7 +72,7 @@ "ts-loader": "8.2.0", "ts-mocha": "8.0.0", "ts-node": "9.1.1", - "typescript": "4.2.4", + "typescript": "4.3.2", "webpack": "4.46.0", "webpack-cli": "4.6.0", "webpack-merge": "5.7.3" diff --git a/packages/opentelemetry-web/src/WebTracerProvider.ts b/packages/opentelemetry-web/src/WebTracerProvider.ts index 0212f132af9..15065502cb2 100644 --- a/packages/opentelemetry-web/src/WebTracerProvider.ts +++ b/packages/opentelemetry-web/src/WebTracerProvider.ts @@ -55,7 +55,7 @@ export class WebTracerProvider extends BasicTracerProvider { * * @param config Configuration object for SDK registration */ - register(config: SDKRegistrationConfig = {}) { + override register(config: SDKRegistrationConfig = {}) { if (config.contextManager === undefined) { config.contextManager = new StackContextManager(); } diff --git a/packages/template/package.json b/packages/template/package.json index 4c4901cff6b..4b334dc9073 100644 --- a/packages/template/package.json +++ b/packages/template/package.json @@ -66,7 +66,7 @@ ], "devDependencies": { "@types/node": "14.14.43", - "typescript": "4.2.4" + "typescript": "4.3.2" }, "Add these to devDependencies for testing": { "@types/mocha": "8.2.0", diff --git a/tsconfig.base.json b/tsconfig.base.json index 83c860a1689..b2d1a3bd96f 100644 --- a/tsconfig.base.json +++ b/tsconfig.base.json @@ -11,6 +11,7 @@ "noFallthroughCasesInSwitch": true, "noImplicitReturns": true, "noUnusedLocals": true, + "noImplicitOverride": true, "pretty": true, "sourceMap": true, "strict": true, From aea89cf7a48395f3d403e1158122bc559b09e899 Mon Sep 17 00:00:00 2001 From: Naseem Date: Tue, 1 Jun 2021 16:14:20 -0400 Subject: [PATCH 03/11] feat: add startActiveSpan method to Tracer (#2221) Co-authored-by: Daniel Dyla --- package.json | 3 +- packages/opentelemetry-tracing/src/Tracer.ts | 128 ++++++++++++------ .../opentelemetry-tracing/test/Tracer.test.ts | 82 ++++++++++- 3 files changed, 169 insertions(+), 44 deletions(-) diff --git a/package.json b/package.json index 1f11b0db1e1..338d235fc77 100644 --- a/package.json +++ b/package.json @@ -32,7 +32,8 @@ "lint:examples": "eslint ./examples/**/*.js", "lint:examples:fix": "eslint ./examples/**/*.js --fix", "lint:markdown": "./node_modules/.bin/markdownlint $(git ls-files '*.md') -i ./CHANGELOG.md", - "lint:markdown:fix": "./node_modules/.bin/markdownlint $(git ls-files '*.md') -i ./CHANGELOG.md --fix" + "lint:markdown:fix": "./node_modules/.bin/markdownlint $(git ls-files '*.md') -i ./CHANGELOG.md --fix", + "reset": "lerna clean -y && rm -rf node_modules && npm i && npm run compile && npm run lint:fix" }, "repository": "open-telemetry/opentelemetry-js", "keywords": [ diff --git a/packages/opentelemetry-tracing/src/Tracer.ts b/packages/opentelemetry-tracing/src/Tracer.ts index ff05bade169..446e944189b 100644 --- a/packages/opentelemetry-tracing/src/Tracer.ts +++ b/packages/opentelemetry-tracing/src/Tracer.ts @@ -54,46 +54,6 @@ export class Tracer implements api.Tracer { this.instrumentationLibrary = instrumentationLibrary; } - startActiveSpan ReturnType>( - name: string, - arg2: F | api.SpanOptions, - arg3?: F | api.Context, - arg4?: F - ): ReturnType | undefined { - let fn: F | undefined, - options: api.SpanOptions | undefined, - activeContext: api.Context | undefined; - - if (arguments.length === 2 && typeof arg2 === 'function') { - fn = arg2; - } else if ( - arguments.length === 3 && - typeof arg2 === 'object' && - typeof arg3 === 'function' - ) { - options = arg2; - fn = arg3; - } else if ( - arguments.length === 4 && - typeof arg2 === 'object' && - typeof arg3 === 'object' && - typeof arg4 === 'function' - ) { - options = arg2; - activeContext = arg3; - fn = arg4; - } - - const parentContext = activeContext ?? api.context.active(); - const span = this.startSpan(name, options, parentContext); - const contextWithSpanSet = api.trace.setSpan(parentContext, span); - - if (fn) { - return api.context.with(contextWithSpanSet, fn, undefined, span); - } - return; - } - /** * Starts a new Span or returns the default NoopSpan based on the sampling * decision. @@ -163,6 +123,94 @@ export class Tracer implements api.Tracer { return span; } + /** + * Starts a new {@link Span} and calls the given function passing it the + * created span as first argument. + * Additionally the new span gets set in context and this context is activated + * for the duration of the function call. + * + * @param name The name of the span + * @param [options] SpanOptions used for span creation + * @param [context] Context to use to extract parent + * @param fn function called in the context of the span and receives the newly created span as an argument + * @returns return value of fn + * @example + * const something = tracer.startActiveSpan('op', span => { + * try { + * do some work + * span.setStatus({code: SpanStatusCode.OK}); + * return something; + * } catch (err) { + * span.setStatus({ + * code: SpanStatusCode.ERROR, + * message: err.message, + * }); + * throw err; + * } finally { + * span.end(); + * } + * }); + * @example + * const span = tracer.startActiveSpan('op', span => { + * try { + * do some work + * return span; + * } catch (err) { + * span.setStatus({ + * code: SpanStatusCode.ERROR, + * message: err.message, + * }); + * throw err; + * } + * }); + * do some more work + * span.end(); + */ + startActiveSpan ReturnType>( + name: string, + fn: F + ): ReturnType; + startActiveSpan ReturnType>( + name: string, + opts: api.SpanOptions, + fn: F + ): ReturnType; + startActiveSpan ReturnType>( + name: string, + opts: api.SpanOptions, + ctx: api.Context, + fn: F + ): ReturnType; + startActiveSpan ReturnType>( + name: string, + arg2?: F | api.SpanOptions, + arg3?: F | api.Context, + arg4?: F + ): ReturnType | undefined { + let opts: api.SpanOptions | undefined; + let ctx: api.Context | undefined; + let fn: F; + + if (arguments.length < 2) { + return; + } else if (arguments.length === 2) { + fn = arg2 as F; + } else if (arguments.length === 3) { + opts = arg2 as api.SpanOptions | undefined; + fn = arg3 as F; + } else { + opts = arg2 as api.SpanOptions | undefined; + ctx = arg3 as api.Context | undefined; + fn = arg4 as F; + } + + const parentContext = ctx ?? api.context.active(); + const span = this.startSpan(name, opts, parentContext); + const contextWithSpanSet = api.trace.setSpan(parentContext, span); + + return api.context.with(contextWithSpanSet, fn, undefined, span); + } + /** Returns the active {@link SpanLimits}. */ getSpanLimits(): SpanLimits { return this._spanLimits; diff --git a/packages/opentelemetry-tracing/test/Tracer.test.ts b/packages/opentelemetry-tracing/test/Tracer.test.ts index 08b2b66c792..aa42daf0e8c 100644 --- a/packages/opentelemetry-tracing/test/Tracer.test.ts +++ b/packages/opentelemetry-tracing/test/Tracer.test.ts @@ -13,24 +13,28 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - import { + context, + createContextKey, INVALID_TRACEID, ROOT_CONTEXT, Sampler, SamplingDecision, - TraceFlags, SpanContext, trace, + TraceFlags } from '@opentelemetry/api'; +import { getSpan } from '@opentelemetry/api/build/src/trace/context-utils'; import { AlwaysOffSampler, AlwaysOnSampler, InstrumentationLibrary, - suppressTracing, + suppressTracing } from '@opentelemetry/core'; import * as assert from 'assert'; import { BasicTracerProvider, Span, Tracer } from '../src'; +import { TestStackContextManager } from './export/TestStackContextManager'; +import * as sinon from 'sinon'; describe('Tracer', () => { const tracerProvider = new BasicTracerProvider(); @@ -49,7 +53,13 @@ describe('Tracer', () => { } } + beforeEach(() => { + const contextManager = new TestStackContextManager().enable(); + context.setGlobalContextManager(contextManager); + }); + afterEach(() => { + context.disable(); delete envSource.OTEL_TRACES_SAMPLER; delete envSource.OTEL_TRACES_SAMPLER_ARG; }); @@ -220,4 +230,70 @@ describe('Tracer', () => { assert.strictEqual(context.traceFlags, TraceFlags.NONE); span.end(); }); + + it('should start an active span with name and function args', () => { + const tracer = new Tracer( + { name: 'default', version: '0.0.1' }, + { sampler: new TestSampler() }, + tracerProvider + ); + + const spy = sinon.spy(tracer, "startSpan"); + + assert.strictEqual(tracer.startActiveSpan('my-span', span => { + try { + assert(spy.calledWith('my-span')) + assert.strictEqual(getSpan(context.active()), span) + return 1 + } finally { + span.end(); + } + }), 1); + }); + + it('should start an active span with name, options and function args', () => { + + const tracer = new Tracer( + { name: 'default', version: '0.0.1' }, + { sampler: new TestSampler() }, + tracerProvider + ); + + const spy = sinon.spy(tracer, "startSpan"); + + assert.strictEqual(tracer.startActiveSpan('my-span', {attributes: {foo: 'bar'}}, span => { + try { + assert(spy.calledWith('my-span', {attributes: {foo: 'bar'}})) + assert.strictEqual(getSpan(context.active()), span) + return 1 + } finally { + span.end(); + } + }), 1); + }); + + it('should start an active span with name, options, context and function args', () => { + const tracer = new Tracer( + { name: 'default', version: '0.0.1' }, + { sampler: new TestSampler() }, + tracerProvider + ); + + const ctxKey = createContextKey('foo'); + + const ctx = context.active().setValue(ctxKey, 'bar') + + const spy = sinon.spy(tracer, "startSpan"); + + assert.strictEqual(tracer.startActiveSpan('my-span', {attributes: {foo: 'bar'}}, ctx, span => { + try { + assert(spy.calledWith('my-span', {attributes: {foo: 'bar'}}, ctx)) + assert.strictEqual(getSpan(context.active()), span) + assert.strictEqual(ctx.getValue(ctxKey), 'bar') + return 1 + } finally { + span.end(); + } + }), 1); + }); }); From 8bb9752d5ddeeaca2d2d4a56c2d604738e98bea7 Mon Sep 17 00:00:00 2001 From: andrew quartey Date: Tue, 1 Jun 2021 16:28:03 -0400 Subject: [PATCH 04/11] chore: update example (#2222) Co-authored-by: Valentin Marchaud --- .../docker/ot/collector-config.yaml | 21 +++++++++------- .../docker/ot/docker-compose.yaml | 24 ++++++++++++------- examples/basic-tracer-node/index.js | 5 +++- 3 files changed, 32 insertions(+), 18 deletions(-) diff --git a/examples/basic-tracer-node/docker/ot/collector-config.yaml b/examples/basic-tracer-node/docker/ot/collector-config.yaml index b4bc9cb9fc1..b550ca4fa6a 100644 --- a/examples/basic-tracer-node/docker/ot/collector-config.yaml +++ b/examples/basic-tracer-node/docker/ot/collector-config.yaml @@ -1,18 +1,23 @@ receivers: - opencensus: - endpoint: 0.0.0.0:55678 + otlp: + protocols: + grpc: + http: + cors_allowed_origins: + - http://* + - https://* exporters: - zipkin: - url: "http://zipkin-all-in-one:9411/api/v2/spans" + jaeger: + endpoint: jaeger-all-in-one:14250 + insecure: true processors: batch: - queued_retry: service: pipelines: traces: - receivers: [opencensus] - exporters: [zipkin] - processors: [batch, queued_retry] + receivers: [otlp] + exporters: [jaeger] + processors: [batch] diff --git a/examples/basic-tracer-node/docker/ot/docker-compose.yaml b/examples/basic-tracer-node/docker/ot/docker-compose.yaml index 3e486bfb05d..a2068c155b3 100644 --- a/examples/basic-tracer-node/docker/ot/docker-compose.yaml +++ b/examples/basic-tracer-node/docker/ot/docker-compose.yaml @@ -1,19 +1,25 @@ -version: "2" +version: "3.8" services: # Collector - collector: - image: otelcol:latest + otel-collector: + image: otel/opentelemetry-collector:0.27.0 command: ["--config=/conf/collector-config.yaml", "--log-level=DEBUG"] volumes: - ./collector-config.yaml:/conf/collector-config.yaml ports: - - "55678:55678" + - "9464:9464" + - "4317:4317" + - "55681:55681" depends_on: - - zipkin-all-in-one + - jaeger-all-in-one - # Zipkin - zipkin-all-in-one: - image: openzipkin/zipkin:latest + # Jaeger + jaeger-all-in-one: + image: jaegertracing/all-in-one:1.22.0 ports: - - "9411:9411" + - "16686:16686" + - "14268:14268" + - "14250" + + diff --git a/examples/basic-tracer-node/index.js b/examples/basic-tracer-node/index.js index b7092f339d5..c43657e96e9 100644 --- a/examples/basic-tracer-node/index.js +++ b/examples/basic-tracer-node/index.js @@ -7,7 +7,10 @@ const { JaegerExporter } = require('@opentelemetry/exporter-jaeger'); const provider = new BasicTracerProvider(); // Configure span processor to send spans to the exporter -const exporter = new JaegerExporter({ serviceName: 'basic-service' }); +const exporter = new JaegerExporter({ + serviceName: 'basic-service', + endpoint: 'http://localhost:14268/api/traces', +}); provider.addSpanProcessor(new SimpleSpanProcessor(exporter)); provider.addSpanProcessor(new SimpleSpanProcessor(new ConsoleSpanExporter())); From 1d65b3e54fb2ccbdb4a3c8f6887a4935a4ec4674 Mon Sep 17 00:00:00 2001 From: Vera Reynolds Date: Wed, 2 Jun 2021 01:26:31 -0600 Subject: [PATCH 05/11] feat(shim-opentracing): update setTag based on new spec (#2194) Co-authored-by: Daniel Dyla Co-authored-by: Valentin Marchaud --- .../src/shim.ts | 47 ++++++++++--- .../test/Shim.test.ts | 67 +++++++++++++++++-- 2 files changed, 100 insertions(+), 14 deletions(-) diff --git a/packages/opentelemetry-shim-opentracing/src/shim.ts b/packages/opentelemetry-shim-opentracing/src/shim.ts index 0659409ad9c..0e4a890b6bb 100644 --- a/packages/opentelemetry-shim-opentracing/src/shim.ts +++ b/packages/opentelemetry-shim-opentracing/src/shim.ts @@ -19,6 +19,7 @@ import * as opentracing from 'opentracing'; import { SpanAttributes, SpanAttributeValue, + SpanStatusCode, TextMapPropagator, } from '@opentelemetry/api'; @@ -298,7 +299,14 @@ export class SpanShim extends opentracing.Span { * @param keyValueMap set of KV pairs representing tags */ override addTags(keyValueMap: SpanAttributes): this { - this._span.setAttributes(keyValueMap); + for (const [key, value] of Object.entries(keyValueMap)) { + if (this._setErrorAsSpanStatusCode(key, value)) { + continue; + } + if (value !== undefined) { + this._span.setAttribute(key, value); + } + } return this; } @@ -309,11 +317,7 @@ export class SpanShim extends opentracing.Span { * @param value value for the tag */ override setTag(key: string, value: SpanAttributeValue): this { - if ( - key === opentracing.Tags.ERROR && - (value === true || value === 'true') - ) { - this._span.setStatus({ code: api.SpanStatusCode.ERROR }); + if (this._setErrorAsSpanStatusCode(key, value)) { return this; } @@ -330,13 +334,40 @@ export class SpanShim extends opentracing.Span { return this; } - /* - * Returns the underlying {@link types.Span} that the shim + /** + * Returns the underlying {@link api.Span} that the shim * is wrapping. */ getSpan(): api.Span { return this._span; } + + private _setErrorAsSpanStatusCode( + key: string, + value: SpanAttributeValue | undefined + ): boolean { + if (key === opentracing.Tags.ERROR) { + const statusCode = SpanShim._mapErrorTag(value); + this._span.setStatus({ code: statusCode }); + return statusCode !== SpanStatusCode.UNSET; + } + return false; + } + + private static _mapErrorTag( + value: SpanAttributeValue | undefined + ): SpanStatusCode { + switch (value) { + case true: + case 'true': + return SpanStatusCode.ERROR; + case false: + case 'false': + return SpanStatusCode.OK; + default: + return SpanStatusCode.UNSET; + } + } } /** diff --git a/packages/opentelemetry-shim-opentracing/test/Shim.test.ts b/packages/opentelemetry-shim-opentracing/test/Shim.test.ts index 280e78fd005..c8bcd2f92bd 100644 --- a/packages/opentelemetry-shim-opentracing/test/Shim.test.ts +++ b/packages/opentelemetry-shim-opentracing/test/Shim.test.ts @@ -30,6 +30,7 @@ import { INVALID_SPAN_CONTEXT, propagation, ROOT_CONTEXT, + SpanStatusCode, trace, } from '@opentelemetry/api'; import { performance } from 'perf_hooks'; @@ -291,13 +292,67 @@ describe('OpenTracing Shim', () => { otSpan = (span as SpanShim).getSpan() as Span; }); - it('sets tags', () => { - span.setTag('hello', 'world'); - assert.strictEqual(otSpan.attributes.hello, 'world'); + describe('tags', () => { + it('sets tags', () => { + span.setTag('hello', 'world'); + assert.strictEqual(otSpan.attributes.hello, 'world'); - span.addTags({ hello: 'stars', from: 'earth' }); - assert.strictEqual(otSpan.attributes.hello, 'stars'); - assert.strictEqual(otSpan.attributes.from, 'earth'); + span.addTags({ hello: 'stars', from: 'earth' }); + assert.strictEqual(otSpan.attributes.hello, 'stars'); + assert.strictEqual(otSpan.attributes.from, 'earth'); + }); + + it('ignores undefined tags', () => { + span.addTags({ hello: 'stars', from: undefined }); + assert.deepStrictEqual(otSpan.attributes, { hello: 'stars' }); + }); + + it('maps error tag to status code', () => { + span.setTag('error', ''); + assert.strictEqual(otSpan.status.code, SpanStatusCode.UNSET); + + span.setTag('error', true); + assert.strictEqual(otSpan.status.code, SpanStatusCode.ERROR); + + span.setTag('error', false); + assert.strictEqual(otSpan.status.code, SpanStatusCode.OK); + + span.setTag('error', 'true'); + assert.strictEqual(otSpan.status.code, SpanStatusCode.ERROR); + + span.setTag('error', 'false'); + assert.strictEqual(otSpan.status.code, SpanStatusCode.OK); + }); + + it('sets unknown error tag as attribute', () => { + span.setTag('error', 'whoopsie'); + assert.strictEqual(otSpan.status.code, SpanStatusCode.UNSET); + assert.strictEqual(otSpan.attributes.error, 'whoopsie'); + }); + + it('maps error tag to status code when adding multiple tags', () => { + span.addTags({ hello: 'stars', error: '' }); + assert.strictEqual(otSpan.status.code, SpanStatusCode.UNSET); + + span.addTags({ hello: 'stars', error: true }); + assert.strictEqual(otSpan.status.code, SpanStatusCode.ERROR); + + span.addTags({ hello: 'stars', error: false }); + assert.strictEqual(otSpan.status.code, SpanStatusCode.OK); + + span.addTags({ hello: 'stars', error: 'true' }); + assert.strictEqual(otSpan.status.code, SpanStatusCode.ERROR); + + span.addTags({ hello: 'stars', error: 'false' }); + assert.strictEqual(otSpan.status.code, SpanStatusCode.OK); + }); + + it('sets unknown error tag as attribute when adding multiple tags', () => { + span.addTags({ hello: 'stars', error: 'whoopsie' }); + assert.strictEqual(otSpan.status.code, SpanStatusCode.UNSET); + assert.strictEqual(otSpan.attributes.hello, 'stars'); + assert.strictEqual(otSpan.attributes.error, 'whoopsie'); + }); }); it('logs KV pairs', () => { From 975abda29807228ad9fb30858a364ccc8fc445dc Mon Sep 17 00:00:00 2001 From: Bartlomiej Obecny Date: Thu, 3 Jun 2021 09:10:04 +0200 Subject: [PATCH 06/11] chore: adding msnev to approvers (#2248) --- .github/CODEOWNERS | 2 +- README.md | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index 746bcc7fbff..17ec7202848 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -12,4 +12,4 @@ # https://help.github.com/en/articles/about-code-owners # -* @dyladan @mayurkale22 @OlivierAlbertini @vmarchaud @markwolff @obecny @mwear @naseemkullah @legendecas @Flarna @johnbley +* @dyladan @mayurkale22 @OlivierAlbertini @vmarchaud @markwolff @obecny @mwear @naseemkullah @legendecas @Flarna @johnbley @MSNev diff --git a/README.md b/README.md index 8232a4f5a52..d8e140c7ced 100644 --- a/README.md +++ b/README.md @@ -126,6 +126,7 @@ Approvers ([@open-telemetry/js-approvers](https://github.com/orgs/open-telemetry - [Mark Wolff](https://github.com/markwolff), Microsoft - [Matthew Wear](https://github.com/mwear), LightStep - [Naseem K. Ullah](https://github.com/naseemkullah), Transit +- [Neville Wylie](https://github.com/MSNev), Microsoft - [Olivier Albertini](https://github.com/OlivierAlbertini), Ville de Montréal *Find more about the approver role in [community repository](https://github.com/open-telemetry/community/blob/main/community-membership.md#approver).* From 287098d193241b755c0e95ff9d5f599e4efba0bd Mon Sep 17 00:00:00 2001 From: Daniel Dyla Date: Thu, 3 Jun 2021 11:43:31 -0400 Subject: [PATCH 07/11] chore: Link to spec versioning doc (#1737) --- README.md | 6 ++++++ RELEASING.md | 40 +++++++++++++++++++++------------------- 2 files changed, 27 insertions(+), 19 deletions(-) diff --git a/README.md b/README.md index d8e140c7ced..e1f103bc8e6 100644 --- a/README.md +++ b/README.md @@ -58,6 +58,10 @@ This is the JavaScript version of [OpenTelemetry](https://opentelemetry.io/), a | | 0.12.x | 0.11.x | | | 0.11.x | 0.10.x | +## Versioning + +The current version for each package can be found in the respective `package.json` file for that module. For additional details see the [versioning and stability][spec-versioning] document in the specification. + ## Quick start ### Application Owner @@ -434,3 +438,5 @@ Apache 2.0 - See [LICENSE][license-url] for more information. [otel-contrib-instrumentation-document-load]: https://github.com/open-telemetry/opentelemetry-js-contrib/tree/master/plugins/web/opentelemetry-instrumentation-document-load [otel-contrib-instrumentation-hapi]: https://github.com/open-telemetry/opentelemetry-js-contrib/tree/master/plugins/node/opentelemetry-instrumentation-hapi [otel-contrib-instrumentation-koa]: https://github.com/open-telemetry/opentelemetry-js-contrib/tree/master/plugins/node/opentelemetry-instrumentation-koa + +[spec-versioning]: https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/versioning-and-stability.md diff --git a/RELEASING.md b/RELEASING.md index cfb49f3fe61..6f7a8cddf16 100644 --- a/RELEASING.md +++ b/RELEASING.md @@ -1,10 +1,10 @@ -# Releasing OpenTelemetry Packages (for Maintainers Only) +# Releasing OpenTelemetry Packages This document explains how to publish all OT modules at version x.y.z. Ensure that you’re following semver when choosing a version number. Release Process: -- [Releasing OpenTelemetry Packages (for Maintainers Only)](#releasing-opentelemetry-packages-for-maintainers-only) +- [Release Process (Maintainers only)](#release-process) - [Update to latest locally](#update-to-latest-locally) - [Create a new branch](#create-a-new-branch) - [Prepare each package for release](#prepare-each-package-for-release) @@ -19,15 +19,17 @@ Release Process: - [Update CHANGELOG](#update-changelog) - [Known Issues](#known-issues) -## Update to latest locally +## Release Process + +### Update to latest locally Use `git fetch` and `git checkout origin/main` to ensure you’re on the latest commit. Make sure you have no unstaged changes. Ideally, also use `git clean -dfx` to remove all ignored and untracked files. -## Create a new branch +### Create a new branch Create a new branch called `x.y.z-proposal` from the current commit. -## Prepare each package for release +### Prepare each package for release Decide on the next `major.minor.patch` release number based on [semver](http://semver.org/) guidelines. @@ -35,13 +37,13 @@ Decide on the next `major.minor.patch` release number based on [semver](http://s - Use `lerna publish --skip-npm --no-git-tag-version --no-push` to bump the version in all `package.json` - Use `npm run bootstrap` to generate latest `version.ts` files -## Use the Changelog to create a GitHub Release +### Use the Changelog to create a GitHub Release -### Generate the changelog with lerna +#### Generate the changelog with lerna Since we use `lerna`, we can use [lerna-changelog](https://github.com/lerna/lerna-changelog#lerna-changelog) -#### How to use +##### How to use Pass your [github token](https://help.github.com/en/articles/creating-a-personal-access-token-for-the-command-line) to generate the changelog automatically. For security reasons, when you create a Github token, select the permissions: under **repo**, select **Access public repositories**, **Access commit status**. @@ -55,15 +57,15 @@ GITHUB_AUTH= lerna-changelog It will print something like: ```md -## Unreleased (2018-05-24) +### Unreleased (2018-05-24) -#### :bug: Bug Fix +##### :bug: Bug Fix * [#198](https://github.com/my-org/my-repo/pull/198) Avoid an infinite loop ([@helpful-hacker](https://github.com/helpful-hacker)) -#### :house: Internal +##### :house: Internal * [#183](https://github.com/my-org/my-repo/pull/183) Standardize error messages ([@careful-coder](https://github.com/careful-coder)) -#### Commiters: 2 +##### Commiters: 2 - Helpful Hacker ([@helpful-hacker](https://github.com/helpful-hacker)) - [@careful-coder](https://github.com/careful-coder) ``` @@ -76,21 +78,21 @@ You can also use the `--from` and `--to` options to view a different range of pu GITHUB_AUTH=xxxxx lerna-changelog --from=v1.0.0 --to=v2.0.0 ``` -#### Update Changelog file +##### Update Changelog file From what `lerna-changelog` has generated, starts new Unreleased label. Follow the example set by recent Released label. On [GitHub Releases](https://github.com/open-telemetry/opentelemetry-js/releases), follow the example set by recent releases to populate a summary of changes, as well as a list of commits that were applied since the last release. Save it as a draft, don’t publish it. Don’t forget the tag -- call it `vx.y.z` and leave it pointing at `main` for now (this can be changed as long as the GitHub release isn’t published). -## Create a new PR +### Create a new PR Create a pull request titled `chore: x.y.z release proposal`. The commit body should just be a link to the draft notes. Someone who can access draft notes should approve it, looking in particular for test passing, and whether the draft notes are satisfactory. -## Merge and pull +### Merge and pull Merge the PR, and pull the changes locally (using the commands in the first step). Ensure that `chore: x.y.z release proposal` is the most recent commit. -## Publish all packages +### Publish all packages Go into each directory and use `npm publish` (requires permissions) to publish the package. You can use the following script to automate this. @@ -106,16 +108,16 @@ done Check your e-mail and make sure the number of “you’ve published this module” emails matches the number you expect. -## Publish the GitHub Release +### Publish the GitHub Release Publish the GitHub release, ensuring that the tag points to the newly landed commit corresponding to release proposal `x.y.z`. -## Update CHANGELOG +### Update CHANGELOG - After releasing is done, update the [CHANGELOG.md](https://github.com/open-telemetry/opentelemetry-js/blob/main/CHANGELOG.md) and start new Unreleased label. - Create a new commit with the exact title: `Post Release: update CHANGELOG.md`. - Go through PR review and merge it to GitHub main branch. -## Known Issues +### Known Issues - The `examples/` and `getting-started/` folders are not part of lerna packages, we need to manually bump the version in `package.json`. From f79aef422b53f1314cb0b031651875658fc17008 Mon Sep 17 00:00:00 2001 From: Daniel Dyla Date: Thu, 3 Jun 2021 13:02:49 -0400 Subject: [PATCH 08/11] Release Proposal 0.20.0 (#2246) * chore: update tsconfig * chore: 0.20.0 proposal * chore: pin deps * chore: pin deps that were previously pinned --- CHANGELOG.md | 102 ++++++++++++++++++ README.md | 5 +- backwards-compatability/node10/package.json | 6 +- backwards-compatability/node12/package.json | 6 +- backwards-compatability/node8/package.json | 6 +- examples/basic-tracer-node/package.json | 6 +- examples/collector-exporter-node/package.json | 14 +-- examples/grpc-js/package.json | 14 +-- examples/grpc/package.json | 14 +-- examples/http/package.json | 14 +-- examples/https/package.json | 14 +-- examples/metrics/package.json | 8 +- examples/opentracing-shim/package.json | 14 +-- examples/prometheus/package.json | 6 +- examples/tracer-web/package.json | 24 ++--- getting-started/example/package.json | 2 +- .../monitored-example/package.json | 6 +- getting-started/traced-example/package.json | 14 +-- .../ts-example/monitored-example/package.json | 6 +- .../ts-example/traced-example/package.json | 14 +-- .../package.json | 8 +- lerna.json | 2 +- .../opentelemetry-api-metrics/package.json | 2 +- .../opentelemetry-api-metrics/src/version.ts | 2 +- .../package.json | 2 +- .../src/version.ts | 2 +- .../package.json | 2 +- .../src/version.ts | 2 +- .../opentelemetry-context-zone/package.json | 4 +- .../opentelemetry-context-zone/src/version.ts | 2 +- packages/opentelemetry-core/package.json | 6 +- packages/opentelemetry-core/src/version.ts | 2 +- .../package.json | 14 +-- .../src/version.ts | 2 +- .../package.json | 14 +-- .../src/version.ts | 2 +- .../package.json | 12 +-- .../src/version.ts | 2 +- .../package.json | 10 +- .../src/version.ts | 2 +- .../tsconfig.json | 3 + .../package.json | 8 +- .../src/version.ts | 2 +- .../package.json | 10 +- .../src/version.ts | 2 +- .../package.json | 16 +-- .../src/version.ts | 2 +- .../package.json | 16 +-- .../src/version.ts | 2 +- .../package.json | 14 +-- .../src/version.ts | 2 +- .../package.json | 16 +-- .../src/version.ts | 2 +- .../package.json | 4 +- .../src/version.ts | 2 +- packages/opentelemetry-metrics/package.json | 8 +- packages/opentelemetry-metrics/src/version.ts | 2 +- packages/opentelemetry-node/package.json | 16 +-- packages/opentelemetry-node/src/version.ts | 2 +- .../opentelemetry-propagator-b3/package.json | 4 +- .../src/version.ts | 2 +- .../package.json | 4 +- .../src/version.ts | 2 +- .../package.json | 8 +- .../src/version.ts | 2 +- .../package.json | 8 +- .../src/version.ts | 2 +- packages/opentelemetry-resources/package.json | 6 +- .../opentelemetry-resources/src/version.ts | 2 +- packages/opentelemetry-sdk-node/package.json | 22 ++-- .../opentelemetry-sdk-node/src/version.ts | 2 +- .../package.json | 2 +- .../src/version.ts | 2 +- .../package.json | 10 +- .../src/version.ts | 2 +- packages/opentelemetry-tracing/package.json | 8 +- packages/opentelemetry-tracing/src/version.ts | 2 +- packages/opentelemetry-web/package.json | 14 +-- packages/opentelemetry-web/src/version.ts | 2 +- packages/template/package.json | 2 +- 80 files changed, 367 insertions(+), 259 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8d97f8ceadd..9563faa8512 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,108 @@ All notable changes to this project will be documented in this file. ## Unreleased +## 0.20.0 + +### :boom: Breaking Change + +* `opentelemetry-sdk-node`, `opentelemetry-tracing` + * [#2190](https://github.com/open-telemetry/opentelemetry-js/pull/2190) feat: apply spec changes for `TraceParams` ([@weyert](https://github.com/weyert)) +* `opentelemetry-node`, `opentelemetry-propagator-jaeger`, `opentelemetry-shim-opentracing` + * [#2148](https://github.com/open-telemetry/opentelemetry-js/pull/2148) chore: renaming jaeger http trace propagator to jaeger propagator ([@obecny](https://github.com/obecny)) +* `opentelemetry-core`, `opentelemetry-instrumentation-grpc`, `opentelemetry-shim-opentracing`, `opentelemetry-tracing` + * [#2149](https://github.com/open-telemetry/opentelemetry-js/pull/2149) chore: adding sufix propagator to http baggage and http trace context ([@obecny](https://github.com/obecny)) + +### :rocket: (Enhancement) + +* `opentelemetry-shim-opentracing` + * [#2194](https://github.com/open-telemetry/opentelemetry-js/pull/2194) feat(shim-opentracing): update setTag based on new spec ([@vreynolds](https://github.com/vreynolds)) +* `opentelemetry-tracing` + * [#2221](https://github.com/open-telemetry/opentelemetry-js/pull/2221) feat: add startActiveSpan method to Tracer ([@naseemkullah](https://github.com/naseemkullah)) +* `opentelemetry-core`, `opentelemetry-exporter-collector-grpc`, `opentelemetry-exporter-collector-proto`, `opentelemetry-exporter-collector`, `opentelemetry-exporter-jaeger`, `opentelemetry-exporter-zipkin`, `opentelemetry-metrics`, `opentelemetry-resources`, `opentelemetry-sdk-node`, `opentelemetry-tracing` + * [#2227](https://github.com/open-telemetry/opentelemetry-js/pull/2227) chore: set default service name ([@dyladan](https://github.com/dyladan)) +* `opentelemetry-api-metrics`, `opentelemetry-context-async-hooks`, `opentelemetry-context-zone-peer-dep`, `opentelemetry-context-zone`, `opentelemetry-core`, `opentelemetry-exporter-collector-grpc`, `opentelemetry-exporter-collector-proto`, `opentelemetry-exporter-collector`, `opentelemetry-exporter-jaeger`, `opentelemetry-exporter-prometheus`, `opentelemetry-exporter-zipkin`, `opentelemetry-instrumentation-fetch`, `opentelemetry-instrumentation-grpc`, `opentelemetry-instrumentation-http`, `opentelemetry-instrumentation-xml-http-request`, `opentelemetry-instrumentation`, `opentelemetry-metrics`, `opentelemetry-node`, `opentelemetry-propagator-b3`, `opentelemetry-propagator-jaeger`, `opentelemetry-resource-detector-aws`, `opentelemetry-resource-detector-gcp`, `opentelemetry-resources`, `opentelemetry-sdk-node`, `opentelemetry-shim-opentracing`, `opentelemetry-tracing`, `opentelemetry-web` + * [#2225](https://github.com/open-telemetry/opentelemetry-js/pull/2225) chore: upgrading to api ver. 0.20.0 ([@obecny](https://github.com/obecny)) +* `opentelemetry-instrumentation` + * [#2224](https://github.com/open-telemetry/opentelemetry-js/pull/2224) feat(opentelemetry-instrumentation): getConfig and setConfig ([@mottibec](https://github.com/mottibec)) +* `opentelemetry-core`, `opentelemetry-instrumentation-http`, `opentelemetry-propagator-b3`, `opentelemetry-propagator-jaeger`, `opentelemetry-tracing` + * [#2202](https://github.com/open-telemetry/opentelemetry-js/pull/2202) Move suppress tracing context key to SDK ([@dyladan](https://github.com/dyladan)) +* `opentelemetry-core`, `opentelemetry-tracing` + * [#2100](https://github.com/open-telemetry/opentelemetry-js/pull/2100) feat(tracing): allow to configure exporter by environment #1676 ([@vmarchaud](https://github.com/vmarchaud)) +* `opentelemetry-core`, `opentelemetry-exporter-collector-grpc`, `opentelemetry-exporter-collector-proto`, `opentelemetry-exporter-collector` + * [#2117](https://github.com/open-telemetry/opentelemetry-js/pull/2117) feat(exporter-collector): support config from env #2099 ([@vmarchaud](https://github.com/vmarchaud)) +* `opentelemetry-exporter-collector`, `opentelemetry-exporter-zipkin`, `opentelemetry-tracing` + * [#2183](https://github.com/open-telemetry/opentelemetry-js/pull/2183) chore: removing usage of timed event from api ([@obecny](https://github.com/obecny)) +* Other + * [#2195](https://github.com/open-telemetry/opentelemetry-js/pull/2195) fix: remove redundant try-catch from http/https server examples ([@legendecas](https://github.com/legendecas)) +* `opentelemetry-exporter-collector-grpc` + * [#2130](https://github.com/open-telemetry/opentelemetry-js/pull/2130) chore: url validation & README to prevent gRPC footguns. ([@lizthegrey](https://github.com/lizthegrey)) +* `opentelemetry-semantic-conventions` + * [#2167](https://github.com/open-telemetry/opentelemetry-js/pull/2167) semantic-conventions: include built esm files in package ([@t2t2](https://github.com/t2t2)) +* `opentelemetry-instrumentation-xml-http-request` + * [#2134](https://github.com/open-telemetry/opentelemetry-js/pull/2134) feat(instrumentation-xhr): add applyCustomAttributesOnSpan hook ([@mhennoch](https://github.com/mhennoch)) +* `opentelemetry-exporter-prometheus` + * [#2122](https://github.com/open-telemetry/opentelemetry-js/pull/2122) feat: add diag warning when metric name is invalid ([@weyert](https://github.com/weyert)) + +### :bug: (Bug Fix) + +* `opentelemetry-exporter-collector-grpc` + * [#2214](https://github.com/open-telemetry/opentelemetry-js/pull/2214) chore: fixes after last changes to url ([@obecny](https://github.com/obecny)) +* `opentelemetry-tracing` + * [#2185](https://github.com/open-telemetry/opentelemetry-js/pull/2185) fix: use invalid parent for sampler when options.root ([@dyladan](https://github.com/dyladan)) + * [#2171](https://github.com/open-telemetry/opentelemetry-js/pull/2171) fix: move initialization of const above first use #2170 ([@dyladan](https://github.com/dyladan)) +* `opentelemetry-instrumentation-grpc` + * [#2179](https://github.com/open-telemetry/opentelemetry-js/pull/2179) chore(grpc-instrumentation): fix grpc example #2160 ([@vmarchaud](https://github.com/vmarchaud)) +* `opentelemetry-core` + * [#2165](https://github.com/open-telemetry/opentelemetry-js/pull/2165) [sampler] treat invalid SpanContext as no SpanContext ([@thisthat](https://github.com/thisthat)) + +### :books: (Refine Doc) + +* `opentelemetry-node` + * [#2180](https://github.com/open-telemetry/opentelemetry-js/pull/2180) fix docs typo ([@sbrichardson](https://github.com/sbrichardson)) +* Other + * [#2168](https://github.com/open-telemetry/opentelemetry-js/pull/2168) chore: update feature status in readme ([@dyladan](https://github.com/dyladan)) +* `opentelemetry-instrumentation-fetch`, `opentelemetry-instrumentation-grpc`, `opentelemetry-instrumentation-http`, `opentelemetry-instrumentation-xml-http-request`, `opentelemetry-instrumentation`, `opentelemetry-node`, `opentelemetry-sdk-node`, `opentelemetry-web` + * [#2127](https://github.com/open-telemetry/opentelemetry-js/pull/2127) chore: prefer use of global TracerProvider/MeterProvider ([@Flarna](https://github.com/Flarna)) + +### :house: (Internal) + +* `opentelemetry-api-metrics`, `opentelemetry-context-async-hooks`, `opentelemetry-context-zone-peer-dep`, `opentelemetry-context-zone`, `opentelemetry-core`, `opentelemetry-exporter-collector-grpc`, `opentelemetry-exporter-collector-proto`, `opentelemetry-exporter-collector`, `opentelemetry-exporter-jaeger`, `opentelemetry-exporter-prometheus`, `opentelemetry-exporter-zipkin`, `opentelemetry-instrumentation-fetch`, `opentelemetry-instrumentation-grpc`, `opentelemetry-instrumentation-http`, `opentelemetry-instrumentation-xml-http-request`, `opentelemetry-instrumentation`, `opentelemetry-metrics`, `opentelemetry-node`, `opentelemetry-propagator-b3`, `opentelemetry-propagator-jaeger`, `opentelemetry-resource-detector-aws`, `opentelemetry-resource-detector-gcp`, `opentelemetry-resources`, `opentelemetry-sdk-node`, `opentelemetry-semantic-conventions`, `opentelemetry-shim-opentracing`, `opentelemetry-tracing`, `opentelemetry-web`, `template` + * [#2241](https://github.com/open-telemetry/opentelemetry-js/pull/2241) chore: update typescript to 4.3 and enable noImplicitOverride ([@Flarna](https://github.com/Flarna)) + * [#2204](https://github.com/open-telemetry/opentelemetry-js/pull/2204) Remove GTS and prettier ([@dyladan](https://github.com/dyladan)) +* `opentelemetry-instrumentation-http`, `opentelemetry-instrumentation`, `opentelemetry-tracing` + * [#2229](https://github.com/open-telemetry/opentelemetry-js/pull/2229) chore: remove references to NOOP singletons ([@dyladan](https://github.com/dyladan)) +* `opentelemetry-node`, `opentelemetry-sdk-node`, `opentelemetry-web` + * [#2230](https://github.com/open-telemetry/opentelemetry-js/pull/2230) chore: remove references to Noop classes from API ([@dyladan](https://github.com/dyladan)) +* `opentelemetry-api-metrics`, `opentelemetry-context-zone-peer-dep`, `opentelemetry-context-zone`, `opentelemetry-core`, `opentelemetry-exporter-collector`, `opentelemetry-exporter-zipkin`, `opentelemetry-instrumentation-fetch`, `opentelemetry-instrumentation-xml-http-request`, `opentelemetry-instrumentation`, `opentelemetry-propagator-jaeger`, `opentelemetry-tracing`, `opentelemetry-web` + * [#2234](https://github.com/open-telemetry/opentelemetry-js/pull/2234) chore: downgrade karma-webpack ([@dyladan](https://github.com/dyladan)) +* `opentelemetry-sdk-node` + * [#2219](https://github.com/open-telemetry/opentelemetry-js/pull/2219) fix(opentelemetry-sdk-node): move nock to dev dependencies ([@nflaig](https://github.com/nflaig)) +* `opentelemetry-core` + * [#2155](https://github.com/open-telemetry/opentelemetry-js/pull/2155) chore: move tracecontext propagator into trace ([@dyladan](https://github.com/dyladan)) +* `opentelemetry-api-metrics`, `opentelemetry-context-zone-peer-dep`, `opentelemetry-context-zone`, `opentelemetry-core`, `opentelemetry-exporter-collector`, `opentelemetry-exporter-zipkin`, `opentelemetry-instrumentation-fetch`, `opentelemetry-instrumentation-xml-http-request`, `opentelemetry-instrumentation`, `opentelemetry-metrics`, `opentelemetry-propagator-b3`, `opentelemetry-propagator-jaeger`, `opentelemetry-resources`, `opentelemetry-semantic-conventions`, `opentelemetry-tracing`, `opentelemetry-web`, `template` + * [#2112](https://github.com/open-telemetry/opentelemetry-js/pull/2112) feat: add ESM builds for packages used in browser ([@t2t2](https://github.com/t2t2)) + +### Committers: 18 + +* Bartlomiej Obecny ([@obecny](https://github.com/obecny)) +* Daniel Dyla ([@dyladan](https://github.com/dyladan)) +* Gerhard Stöbich ([@Flarna](https://github.com/Flarna)) +* Giovanni Liva ([@thisthat](https://github.com/thisthat)) +* Liz Fong-Jones ([@lizthegrey](https://github.com/lizthegrey)) +* MartenH ([@mhennoch](https://github.com/mhennoch)) +* Motti Bechhofer ([@mottibec](https://github.com/mottibec)) +* Naseem ([@naseemkullah](https://github.com/naseemkullah)) +* Nico Flaig ([@nflaig](https://github.com/nflaig)) +* Sergey Lanzman ([@sergeylanzman](https://github.com/sergeylanzman)) +* Severin Neumann ([@svrnm](https://github.com/svrnm)) +* Stephen Richardson ([@sbrichardson](https://github.com/sbrichardson)) +* Valentin Marchaud ([@vmarchaud](https://github.com/vmarchaud)) +* Vera Reynolds ([@vreynolds](https://github.com/vreynolds)) +* Weyert de Boer ([@weyert](https://github.com/weyert)) +* andrew quartey ([@drexler](https://github.com/drexler)) +* legendecas ([@legendecas](https://github.com/legendecas)) +* t2t2 ([@t2t2](https://github.com/t2t2)) + ## 0.19.0 ### :boom: Breaking Change diff --git a/README.md b/README.md index e1f103bc8e6..d72df582db8 100644 --- a/README.md +++ b/README.md @@ -48,6 +48,7 @@ This is the JavaScript version of [OpenTelemetry](https://opentelemetry.io/), a | API Version | Core version | Contrib Version | | ----------- |--------------|-------------------------| +| 0.20.x | 0.20.x | ------ | | v1.0.0-rc.0 | 0.19.x | ------ | | 0.18.x | 0.18.x | 0.14.x | | | 0.17.x | ------ | @@ -229,7 +230,9 @@ To request automatic tracing support for a module not on this list, please [file ## Upgrade guidelines -### 0.19.x to x +### 0.20.x to x + +### 0.19.x to 0.20.0 - `HttpBaggage` renamed to `HttpBaggagePropagator` diff --git a/backwards-compatability/node10/package.json b/backwards-compatability/node10/package.json index 4e28f51035a..b6e7cc1ff55 100644 --- a/backwards-compatability/node10/package.json +++ b/backwards-compatability/node10/package.json @@ -1,6 +1,6 @@ { "name": "backcompat-node10", - "version": "0.19.0", + "version": "0.20.0", "private": true, "description": "Backwards compatability app for node8 types and the OpenTelemetry Node.js SDK", "main": "index.js", @@ -8,8 +8,8 @@ "test:backcompat": "tsc --noEmit index.ts" }, "dependencies": { - "@opentelemetry/sdk-node": "0.19.0", - "@opentelemetry/tracing": "0.19.0" + "@opentelemetry/sdk-node": "0.20.0", + "@opentelemetry/tracing": "0.20.0" }, "devDependencies": { "@types/node": "10.17.59", diff --git a/backwards-compatability/node12/package.json b/backwards-compatability/node12/package.json index 5d8f6304fc4..3ba9d93d78d 100644 --- a/backwards-compatability/node12/package.json +++ b/backwards-compatability/node12/package.json @@ -1,6 +1,6 @@ { "name": "backcompat-node12", - "version": "0.19.0", + "version": "0.20.0", "private": true, "description": "Backwards compatability app for node8 types and the OpenTelemetry Node.js SDK", "main": "index.js", @@ -8,8 +8,8 @@ "test:backcompat": "tsc --noEmit index.ts" }, "dependencies": { - "@opentelemetry/sdk-node": "0.19.0", - "@opentelemetry/tracing": "0.19.0" + "@opentelemetry/sdk-node": "0.20.0", + "@opentelemetry/tracing": "0.20.0" }, "devDependencies": { "@types/node": "12.20.11", diff --git a/backwards-compatability/node8/package.json b/backwards-compatability/node8/package.json index 9b1d4e1af14..36d309111b2 100644 --- a/backwards-compatability/node8/package.json +++ b/backwards-compatability/node8/package.json @@ -1,6 +1,6 @@ { "name": "backcompat-node8", - "version": "0.19.0", + "version": "0.20.0", "private": true, "description": "Backwards compatability app for node8 types and the OpenTelemetry Node.js SDK", "main": "index.js", @@ -8,8 +8,8 @@ "test:backcompat": "tsc --noEmit index.ts" }, "dependencies": { - "@opentelemetry/sdk-node": "0.19.0", - "@opentelemetry/tracing": "0.19.0" + "@opentelemetry/sdk-node": "0.20.0", + "@opentelemetry/tracing": "0.20.0" }, "devDependencies": { "@types/node": "8.10.66", diff --git a/examples/basic-tracer-node/package.json b/examples/basic-tracer-node/package.json index 596bf336f68..a5f4da03177 100644 --- a/examples/basic-tracer-node/package.json +++ b/examples/basic-tracer-node/package.json @@ -1,7 +1,7 @@ { "name": "example-basic-tracer-node", "private": true, - "version": "0.19.0", + "version": "0.20.0", "description": "Example of using @opentelemetry/tracing in Node.js", "main": "index.js", "scripts": { @@ -25,8 +25,8 @@ }, "dependencies": { "@opentelemetry/api": "^0.20.0", - "@opentelemetry/exporter-jaeger": "0.19.0", - "@opentelemetry/tracing": "0.19.0" + "@opentelemetry/exporter-jaeger": "0.20.0", + "@opentelemetry/tracing": "0.20.0" }, "homepage": "https://github.com/open-telemetry/opentelemetry-js#readme" } diff --git a/examples/collector-exporter-node/package.json b/examples/collector-exporter-node/package.json index 76f4c6747f0..9127d7004c5 100644 --- a/examples/collector-exporter-node/package.json +++ b/examples/collector-exporter-node/package.json @@ -1,7 +1,7 @@ { "name": "example-collector-exporter-node", "private": true, - "version": "0.19.0", + "version": "0.20.0", "description": "Example of using @opentelemetry/collector-exporter in Node.js", "main": "index.js", "scripts": { @@ -29,12 +29,12 @@ }, "dependencies": { "@opentelemetry/api": "^0.20.0", - "@opentelemetry/core": "0.19.0", - "@opentelemetry/exporter-collector": "0.19.0", - "@opentelemetry/exporter-collector-grpc": "0.19.0", - "@opentelemetry/exporter-collector-proto": "0.19.0", - "@opentelemetry/metrics": "0.19.0", - "@opentelemetry/tracing": "0.19.0" + "@opentelemetry/core": "0.20.0", + "@opentelemetry/exporter-collector": "0.20.0", + "@opentelemetry/exporter-collector-grpc": "0.20.0", + "@opentelemetry/exporter-collector-proto": "0.20.0", + "@opentelemetry/metrics": "0.20.0", + "@opentelemetry/tracing": "0.20.0" }, "homepage": "https://github.com/open-telemetry/opentelemetry-js#readme" } diff --git a/examples/grpc-js/package.json b/examples/grpc-js/package.json index 62420840b57..45b59ee588d 100644 --- a/examples/grpc-js/package.json +++ b/examples/grpc-js/package.json @@ -1,7 +1,7 @@ { "name": "grpc-js-example", "private": true, - "version": "0.19.0", + "version": "0.20.0", "description": "Example of @grpc/grpc-js integration with OpenTelemetry", "main": "index.js", "scripts": { @@ -30,12 +30,12 @@ "dependencies": { "@grpc/grpc-js": "^1.2.12", "@opentelemetry/api": "^0.20.0", - "@opentelemetry/exporter-jaeger": "0.19.0", - "@opentelemetry/exporter-zipkin": "0.19.0", - "@opentelemetry/instrumentation": "0.19.0", - "@opentelemetry/instrumentation-grpc": "0.19.0", - "@opentelemetry/node": "0.19.0", - "@opentelemetry/tracing": "0.19.0", + "@opentelemetry/exporter-jaeger": "0.20.0", + "@opentelemetry/exporter-zipkin": "0.20.0", + "@opentelemetry/instrumentation": "0.20.0", + "@opentelemetry/instrumentation-grpc": "0.20.0", + "@opentelemetry/node": "0.20.0", + "@opentelemetry/tracing": "0.20.0", "google-protobuf": "^3.9.2" }, "homepage": "https://github.com/open-telemetry/opentelemetry-js#readme", diff --git a/examples/grpc/package.json b/examples/grpc/package.json index 15a264f543d..2c9ff53513b 100644 --- a/examples/grpc/package.json +++ b/examples/grpc/package.json @@ -1,7 +1,7 @@ { "name": "grpc-example", "private": true, - "version": "0.19.0", + "version": "0.20.0", "description": "Example of gRPC integration with OpenTelemetry", "main": "index.js", "scripts": { @@ -29,12 +29,12 @@ }, "dependencies": { "@opentelemetry/api": "^0.20.0", - "@opentelemetry/exporter-jaeger": "0.19.0", - "@opentelemetry/exporter-zipkin": "0.19.0", - "@opentelemetry/instrumentation": "0.19.0", - "@opentelemetry/instrumentation-grpc": "0.19.0", - "@opentelemetry/node": "0.19.0", - "@opentelemetry/tracing": "0.19.0", + "@opentelemetry/exporter-jaeger": "0.20.0", + "@opentelemetry/exporter-zipkin": "0.20.0", + "@opentelemetry/instrumentation": "0.20.0", + "@opentelemetry/instrumentation-grpc": "0.20.0", + "@opentelemetry/node": "0.20.0", + "@opentelemetry/tracing": "0.20.0", "google-protobuf": "^3.9.2", "grpc": "^1.23.3", "node-pre-gyp": "0.14.0" diff --git a/examples/http/package.json b/examples/http/package.json index ffe53eefd8a..0db1c8f2950 100644 --- a/examples/http/package.json +++ b/examples/http/package.json @@ -1,7 +1,7 @@ { "name": "http-example", "private": true, - "version": "0.19.0", + "version": "0.20.0", "description": "Example of HTTP integration with OpenTelemetry", "main": "index.js", "scripts": { @@ -29,12 +29,12 @@ }, "dependencies": { "@opentelemetry/api": "^0.20.0", - "@opentelemetry/exporter-jaeger": "0.19.0", - "@opentelemetry/exporter-zipkin": "0.19.0", - "@opentelemetry/instrumentation": "0.19.0", - "@opentelemetry/instrumentation-http": "0.19.0", - "@opentelemetry/node": "0.19.0", - "@opentelemetry/tracing": "0.19.0" + "@opentelemetry/exporter-jaeger": "0.20.0", + "@opentelemetry/exporter-zipkin": "0.20.0", + "@opentelemetry/instrumentation": "0.20.0", + "@opentelemetry/instrumentation-http": "0.20.0", + "@opentelemetry/node": "0.20.0", + "@opentelemetry/tracing": "0.20.0" }, "homepage": "https://github.com/open-telemetry/opentelemetry-js#readme", "devDependencies": { diff --git a/examples/https/package.json b/examples/https/package.json index 396a7301efb..edf216d0955 100644 --- a/examples/https/package.json +++ b/examples/https/package.json @@ -1,7 +1,7 @@ { "name": "https-example", "private": true, - "version": "0.19.0", + "version": "0.20.0", "description": "Example of HTTPs integration with OpenTelemetry", "main": "build/src/index.js", "types": "build/src/index.d.ts", @@ -30,12 +30,12 @@ }, "dependencies": { "@opentelemetry/api": "^0.20.0", - "@opentelemetry/exporter-jaeger": "0.19.0", - "@opentelemetry/exporter-zipkin": "0.19.0", - "@opentelemetry/instrumentation": "0.19.0", - "@opentelemetry/instrumentation-http": "0.19.0", - "@opentelemetry/node": "0.19.0", - "@opentelemetry/tracing": "0.19.0" + "@opentelemetry/exporter-jaeger": "0.20.0", + "@opentelemetry/exporter-zipkin": "0.20.0", + "@opentelemetry/instrumentation": "0.20.0", + "@opentelemetry/instrumentation-http": "0.20.0", + "@opentelemetry/node": "0.20.0", + "@opentelemetry/tracing": "0.20.0" }, "homepage": "https://github.com/open-telemetry/opentelemetry-js#readme", "devDependencies": { diff --git a/examples/metrics/package.json b/examples/metrics/package.json index fd58c205545..5cc57364849 100644 --- a/examples/metrics/package.json +++ b/examples/metrics/package.json @@ -1,7 +1,7 @@ { "name": "example-metrics", "private": true, - "version": "0.19.0", + "version": "0.20.0", "description": "Example of using @opentelemetry/metrics", "main": "index.js", "scripts": { @@ -26,9 +26,9 @@ "url": "https://github.com/open-telemetry/opentelemetry-js/issues" }, "dependencies": { - "@opentelemetry/core": "0.19.0", - "@opentelemetry/exporter-prometheus": "0.19.0", - "@opentelemetry/metrics": "0.19.0" + "@opentelemetry/core": "0.20.0", + "@opentelemetry/exporter-prometheus": "0.20.0", + "@opentelemetry/metrics": "0.20.0" }, "homepage": "https://github.com/open-telemetry/opentelemetry-js#readme" } diff --git a/examples/opentracing-shim/package.json b/examples/opentracing-shim/package.json index 834ce7caa32..f293ee1278c 100644 --- a/examples/opentracing-shim/package.json +++ b/examples/opentracing-shim/package.json @@ -1,7 +1,7 @@ { "name": "opentracing-shim", "private": true, - "version": "0.19.0", + "version": "0.20.0", "description": "Example of using @opentelemetry/shim-opentracing in Node.js", "main": "index.js", "scripts": { @@ -29,12 +29,12 @@ "url": "https://github.com/open-telemetry/opentelemetry-js/issues" }, "dependencies": { - "@opentelemetry/exporter-jaeger": "0.19.0", - "@opentelemetry/exporter-zipkin": "0.19.0", - "@opentelemetry/instrumentation": "0.19.0", - "@opentelemetry/node": "0.19.0", - "@opentelemetry/shim-opentracing": "0.19.0", - "@opentelemetry/tracing": "0.19.0", + "@opentelemetry/exporter-jaeger": "0.20.0", + "@opentelemetry/exporter-zipkin": "0.20.0", + "@opentelemetry/instrumentation": "0.20.0", + "@opentelemetry/node": "0.20.0", + "@opentelemetry/shim-opentracing": "0.20.0", + "@opentelemetry/tracing": "0.20.0", "opentracing": "^0.14.4" }, "homepage": "https://github.com/open-telemetry/opentelemetry-js#readme", diff --git a/examples/prometheus/package.json b/examples/prometheus/package.json index e63c1f8a48f..16ceeea8090 100644 --- a/examples/prometheus/package.json +++ b/examples/prometheus/package.json @@ -1,6 +1,6 @@ { "name": "prometheus-example", - "version": "0.19.0", + "version": "0.20.0", "description": "Example of using @opentelemetry/metrics and @opentelemetry/exporter-prometheus", "main": "index.js", "scripts": { @@ -9,7 +9,7 @@ "author": "OpenTelemetry Authors", "license": "Apache-2.0", "dependencies": { - "@opentelemetry/exporter-prometheus": "0.19.0", - "@opentelemetry/metrics": "0.19.0" + "@opentelemetry/exporter-prometheus": "0.20.0", + "@opentelemetry/metrics": "0.20.0" } } diff --git a/examples/tracer-web/package.json b/examples/tracer-web/package.json index 40d786daa28..d361e02247b 100644 --- a/examples/tracer-web/package.json +++ b/examples/tracer-web/package.json @@ -1,7 +1,7 @@ { "name": "web-tracer-example", "private": true, - "version": "0.19.0", + "version": "0.20.0", "description": "Example of using @opentelemetry/web in browser", "main": "index.js", "scripts": { @@ -35,17 +35,17 @@ }, "dependencies": { "@opentelemetry/api": "^0.20.0", - "@opentelemetry/context-zone": "0.19.0", - "@opentelemetry/core": "0.19.0", - "@opentelemetry/exporter-collector": "0.19.0", - "@opentelemetry/exporter-zipkin": "0.19.0", - "@opentelemetry/instrumentation": "0.19.0", - "@opentelemetry/instrumentation-fetch": "0.19.0", - "@opentelemetry/instrumentation-xml-http-request": "0.19.0", - "@opentelemetry/metrics": "0.19.0", - "@opentelemetry/propagator-b3": "0.19.0", - "@opentelemetry/tracing": "0.19.0", - "@opentelemetry/web": "0.19.0" + "@opentelemetry/context-zone": "0.20.0", + "@opentelemetry/core": "0.20.0", + "@opentelemetry/exporter-collector": "0.20.0", + "@opentelemetry/exporter-zipkin": "0.20.0", + "@opentelemetry/instrumentation": "0.20.0", + "@opentelemetry/instrumentation-fetch": "0.20.0", + "@opentelemetry/instrumentation-xml-http-request": "0.20.0", + "@opentelemetry/metrics": "0.20.0", + "@opentelemetry/propagator-b3": "0.20.0", + "@opentelemetry/tracing": "0.20.0", + "@opentelemetry/web": "0.20.0" }, "homepage": "https://github.com/open-telemetry/opentelemetry-js#readme" } diff --git a/getting-started/example/package.json b/getting-started/example/package.json index 77109298ba0..32bdfa6be3c 100644 --- a/getting-started/example/package.json +++ b/getting-started/example/package.json @@ -1,6 +1,6 @@ { "name": "@opentelemetry/getting-started-example", - "version": "0.19.0", + "version": "0.20.0", "description": "This repository provides everything required to follow the OpenTelemetry Getting Started Guide", "main": "app.js", "scripts": { diff --git a/getting-started/monitored-example/package.json b/getting-started/monitored-example/package.json index 5d1699c9480..6bd558f200c 100644 --- a/getting-started/monitored-example/package.json +++ b/getting-started/monitored-example/package.json @@ -1,6 +1,6 @@ { "name": "@opentelemetry/getting-started-monitored-example", - "version": "0.19.0", + "version": "0.20.0", "description": "This repository provides everything required to follow the OpenTelemetry Getting Started Guide", "main": "app.js", "scripts": { @@ -9,8 +9,8 @@ "author": "OpenTelemetry Authors", "license": "Apache-2.0", "dependencies": { - "@opentelemetry/exporter-prometheus": "0.19.0", - "@opentelemetry/metrics": "0.19.0", + "@opentelemetry/exporter-prometheus": "0.20.0", + "@opentelemetry/metrics": "0.20.0", "axios": "^0.21.0", "express": "^4.17.1" } diff --git a/getting-started/traced-example/package.json b/getting-started/traced-example/package.json index 5596a60e35f..6caf816e716 100644 --- a/getting-started/traced-example/package.json +++ b/getting-started/traced-example/package.json @@ -1,6 +1,6 @@ { "name": "@opentelemetry/getting-started-traced-example", - "version": "0.19.0", + "version": "0.20.0", "description": "This repository provides everything required to follow the OpenTelemetry Getting Started Guide", "main": "app.js", "scripts": { @@ -9,13 +9,13 @@ "author": "OpenTelemetry Authors", "license": "Apache-2.0", "dependencies": { - "@opentelemetry/core": "0.19.0", - "@opentelemetry/exporter-zipkin": "0.19.0", - "@opentelemetry/node": "0.19.0", - "@opentelemetry/instrumentation": "0.19.0", + "@opentelemetry/core": "0.20.0", + "@opentelemetry/exporter-zipkin": "0.20.0", + "@opentelemetry/node": "0.20.0", + "@opentelemetry/instrumentation": "0.20.0", "@opentelemetry/instrumentation-express": "^0.16.0", - "@opentelemetry/instrumentation-http": "0.19.0", - "@opentelemetry/tracing": "0.19.0", + "@opentelemetry/instrumentation-http": "0.20.0", + "@opentelemetry/tracing": "0.20.0", "axios": "^0.21.0", "express": "^4.17.1" } diff --git a/getting-started/ts-example/monitored-example/package.json b/getting-started/ts-example/monitored-example/package.json index afa9f62e5b4..78d7e23c14b 100644 --- a/getting-started/ts-example/monitored-example/package.json +++ b/getting-started/ts-example/monitored-example/package.json @@ -1,6 +1,6 @@ { "name": "@opentelemetry/getting-started-monitored-ts-example", - "version": "0.19.0", + "version": "0.20.0", "description": "This repository provides everything required to follow the OpenTelemetry Getting Started Guide", "main": "app.ts", "scripts": { @@ -14,8 +14,8 @@ "ts-node": "8.10.2" }, "dependencies": { - "@opentelemetry/exporter-prometheus": "0.19.0", - "@opentelemetry/metrics": "0.19.0", + "@opentelemetry/exporter-prometheus": "0.20.0", + "@opentelemetry/metrics": "0.20.0", "axios": "^0.21.0", "express": "^4.17.1" } diff --git a/getting-started/ts-example/traced-example/package.json b/getting-started/ts-example/traced-example/package.json index c2b56f1f98a..3805f4b6210 100644 --- a/getting-started/ts-example/traced-example/package.json +++ b/getting-started/ts-example/traced-example/package.json @@ -1,6 +1,6 @@ { "name": "@opentelemetry/getting-started-traced-ts-example", - "version": "0.19.0", + "version": "0.20.0", "description": "This repository provides everything required to follow the OpenTelemetry Getting Started Guide", "main": "app.ts", "scripts": { @@ -14,13 +14,13 @@ "ts-node": "9.1.1" }, "dependencies": { - "@opentelemetry/core": "0.19.0", - "@opentelemetry/exporter-zipkin": "0.19.0", - "@opentelemetry/instrumentation": "0.19.0", - "@opentelemetry/node": "0.19.0", + "@opentelemetry/core": "0.20.0", + "@opentelemetry/exporter-zipkin": "0.20.0", + "@opentelemetry/instrumentation": "0.20.0", + "@opentelemetry/node": "0.20.0", "@opentelemetry/instrumentation-express": "^0.16.0", - "@opentelemetry/instrumentation-http": "0.19.0", - "@opentelemetry/tracing": "0.19.0", + "@opentelemetry/instrumentation-http": "0.20.0", + "@opentelemetry/tracing": "0.20.0", "axios": "^0.21.0", "express": "^4.17.1" } diff --git a/integration-tests/propagation-validation-server/package.json b/integration-tests/propagation-validation-server/package.json index b99969d0f26..bb4737bbf38 100644 --- a/integration-tests/propagation-validation-server/package.json +++ b/integration-tests/propagation-validation-server/package.json @@ -1,6 +1,6 @@ { "name": "propagation-validation-server", - "version": "0.19.0", + "version": "0.20.0", "description": "server for w3c tests", "main": "validation_server.js", "private": true, @@ -11,9 +11,9 @@ "compile": "tsc --build" }, "dependencies": { - "@opentelemetry/context-async-hooks": "0.19.0", - "@opentelemetry/core": "0.19.0", - "@opentelemetry/tracing": "0.19.0", + "@opentelemetry/context-async-hooks": "0.20.0", + "@opentelemetry/core": "0.20.0", + "@opentelemetry/tracing": "0.20.0", "axios": "0.21.1", "body-parser": "1.19.0", "express": "4.17.1" diff --git a/lerna.json b/lerna.json index de33e068a29..35849960597 100644 --- a/lerna.json +++ b/lerna.json @@ -8,7 +8,7 @@ "packages/*", "integration-tests/*" ], - "version": "0.19.0", + "version": "0.20.0", "changelog": { "repo": "open-telemetry/opentelemetry-js", "labels": { diff --git a/packages/opentelemetry-api-metrics/package.json b/packages/opentelemetry-api-metrics/package.json index e4e05255acd..19e1e6fa499 100644 --- a/packages/opentelemetry-api-metrics/package.json +++ b/packages/opentelemetry-api-metrics/package.json @@ -1,6 +1,6 @@ { "name": "@opentelemetry/api-metrics", - "version": "0.19.0", + "version": "0.20.0", "description": "Public metrics API for OpenTelemetry", "main": "build/src/index.js", "module": "build/esm/index.js", diff --git a/packages/opentelemetry-api-metrics/src/version.ts b/packages/opentelemetry-api-metrics/src/version.ts index 3fc2009a621..a14ba6ef881 100644 --- a/packages/opentelemetry-api-metrics/src/version.ts +++ b/packages/opentelemetry-api-metrics/src/version.ts @@ -15,4 +15,4 @@ */ // this is autogenerated file, see scripts/version-update.js -export const VERSION = '0.19.0'; +export const VERSION = '0.20.0'; diff --git a/packages/opentelemetry-context-async-hooks/package.json b/packages/opentelemetry-context-async-hooks/package.json index 1513c49ce7e..f6d52df6a34 100644 --- a/packages/opentelemetry-context-async-hooks/package.json +++ b/packages/opentelemetry-context-async-hooks/package.json @@ -1,6 +1,6 @@ { "name": "@opentelemetry/context-async-hooks", - "version": "0.19.0", + "version": "0.20.0", "description": "OpenTelemetry AsyncHooks-based Context Manager", "main": "build/src/index.js", "types": "build/src/index.d.ts", diff --git a/packages/opentelemetry-context-async-hooks/src/version.ts b/packages/opentelemetry-context-async-hooks/src/version.ts index 3fc2009a621..a14ba6ef881 100644 --- a/packages/opentelemetry-context-async-hooks/src/version.ts +++ b/packages/opentelemetry-context-async-hooks/src/version.ts @@ -15,4 +15,4 @@ */ // this is autogenerated file, see scripts/version-update.js -export const VERSION = '0.19.0'; +export const VERSION = '0.20.0'; diff --git a/packages/opentelemetry-context-zone-peer-dep/package.json b/packages/opentelemetry-context-zone-peer-dep/package.json index 4f026dd2e90..4ea6f0bf2df 100644 --- a/packages/opentelemetry-context-zone-peer-dep/package.json +++ b/packages/opentelemetry-context-zone-peer-dep/package.json @@ -1,6 +1,6 @@ { "name": "@opentelemetry/context-zone-peer-dep", - "version": "0.19.0", + "version": "0.20.0", "description": "OpenTelemetry Context Zone with peer dependency for zone.js", "main": "build/src/index.js", "module": "build/esm/index.js", diff --git a/packages/opentelemetry-context-zone-peer-dep/src/version.ts b/packages/opentelemetry-context-zone-peer-dep/src/version.ts index 3fc2009a621..a14ba6ef881 100644 --- a/packages/opentelemetry-context-zone-peer-dep/src/version.ts +++ b/packages/opentelemetry-context-zone-peer-dep/src/version.ts @@ -15,4 +15,4 @@ */ // this is autogenerated file, see scripts/version-update.js -export const VERSION = '0.19.0'; +export const VERSION = '0.20.0'; diff --git a/packages/opentelemetry-context-zone/package.json b/packages/opentelemetry-context-zone/package.json index acd4ffe2fd1..ad9b7a9207a 100644 --- a/packages/opentelemetry-context-zone/package.json +++ b/packages/opentelemetry-context-zone/package.json @@ -1,6 +1,6 @@ { "name": "@opentelemetry/context-zone", - "version": "0.19.0", + "version": "0.20.0", "description": "OpenTelemetry Context Zone", "main": "build/src/index.js", "module": "build/esm/index.js", @@ -67,7 +67,7 @@ "webpack-merge": "5.7.3" }, "dependencies": { - "@opentelemetry/context-zone-peer-dep": "0.19.0", + "@opentelemetry/context-zone-peer-dep": "0.20.0", "zone.js": "^0.11.0" }, "sideEffects": true diff --git a/packages/opentelemetry-context-zone/src/version.ts b/packages/opentelemetry-context-zone/src/version.ts index 3fc2009a621..a14ba6ef881 100644 --- a/packages/opentelemetry-context-zone/src/version.ts +++ b/packages/opentelemetry-context-zone/src/version.ts @@ -15,4 +15,4 @@ */ // this is autogenerated file, see scripts/version-update.js -export const VERSION = '0.19.0'; +export const VERSION = '0.20.0'; diff --git a/packages/opentelemetry-core/package.json b/packages/opentelemetry-core/package.json index fa168f9ba78..2a79a5861b6 100644 --- a/packages/opentelemetry-core/package.json +++ b/packages/opentelemetry-core/package.json @@ -1,6 +1,6 @@ { "name": "@opentelemetry/core", - "version": "0.19.0", + "version": "0.20.0", "description": "OpenTelemetry Core provides default and no-op implementations of the OpenTelemetry types for trace and metrics", "main": "build/src/index.js", "module": "build/esm/index.js", @@ -83,7 +83,7 @@ "@opentelemetry/api": "^0.20.0" }, "dependencies": { - "semver": "^7.1.3", - "@opentelemetry/semantic-conventions": "0.19.0" + "@opentelemetry/semantic-conventions": "0.20.0", + "semver": "^7.1.3" } } diff --git a/packages/opentelemetry-core/src/version.ts b/packages/opentelemetry-core/src/version.ts index 3fc2009a621..a14ba6ef881 100644 --- a/packages/opentelemetry-core/src/version.ts +++ b/packages/opentelemetry-core/src/version.ts @@ -15,4 +15,4 @@ */ // this is autogenerated file, see scripts/version-update.js -export const VERSION = '0.19.0'; +export const VERSION = '0.20.0'; diff --git a/packages/opentelemetry-exporter-collector-grpc/package.json b/packages/opentelemetry-exporter-collector-grpc/package.json index 6b4be1752cf..fd463f8ea9b 100644 --- a/packages/opentelemetry-exporter-collector-grpc/package.json +++ b/packages/opentelemetry-exporter-collector-grpc/package.json @@ -1,6 +1,6 @@ { "name": "@opentelemetry/exporter-collector-grpc", - "version": "0.19.0", + "version": "0.20.0", "description": "OpenTelemetry Collector Exporter allows user to send collected traces to the OpenTelemetry Collector", "main": "build/src/index.js", "types": "build/src/index.d.ts", @@ -47,7 +47,7 @@ "devDependencies": { "@babel/core": "7.14.0", "@opentelemetry/api": "^0.20.0", - "@opentelemetry/api-metrics": "0.19.0", + "@opentelemetry/api-metrics": "0.20.0", "@types/mocha": "8.2.2", "@types/node": "14.14.43", "@types/sinon": "9.0.11", @@ -68,10 +68,10 @@ "dependencies": { "@grpc/grpc-js": "^1.2.12", "@grpc/proto-loader": "^0.6.0", - "@opentelemetry/core": "0.19.0", - "@opentelemetry/exporter-collector": "0.19.0", - "@opentelemetry/metrics": "0.19.0", - "@opentelemetry/resources": "0.19.0", - "@opentelemetry/tracing": "0.19.0" + "@opentelemetry/core": "0.20.0", + "@opentelemetry/exporter-collector": "0.20.0", + "@opentelemetry/metrics": "0.20.0", + "@opentelemetry/resources": "0.20.0", + "@opentelemetry/tracing": "0.20.0" } } diff --git a/packages/opentelemetry-exporter-collector-grpc/src/version.ts b/packages/opentelemetry-exporter-collector-grpc/src/version.ts index 3fc2009a621..a14ba6ef881 100644 --- a/packages/opentelemetry-exporter-collector-grpc/src/version.ts +++ b/packages/opentelemetry-exporter-collector-grpc/src/version.ts @@ -15,4 +15,4 @@ */ // this is autogenerated file, see scripts/version-update.js -export const VERSION = '0.19.0'; +export const VERSION = '0.20.0'; diff --git a/packages/opentelemetry-exporter-collector-proto/package.json b/packages/opentelemetry-exporter-collector-proto/package.json index 725bad7e55f..820a4b34f65 100644 --- a/packages/opentelemetry-exporter-collector-proto/package.json +++ b/packages/opentelemetry-exporter-collector-proto/package.json @@ -1,6 +1,6 @@ { "name": "@opentelemetry/exporter-collector-proto", - "version": "0.19.0", + "version": "0.20.0", "description": "OpenTelemetry Collector Exporter allows user to send collected traces to the OpenTelemetry Collector", "main": "build/src/index.js", "types": "build/src/index.d.ts", @@ -47,7 +47,7 @@ "devDependencies": { "@babel/core": "7.14.0", "@opentelemetry/api": "^0.20.0", - "@opentelemetry/api-metrics": "0.19.0", + "@opentelemetry/api-metrics": "0.20.0", "@types/mocha": "8.2.2", "@types/node": "14.14.43", "@types/sinon": "9.0.11", @@ -67,11 +67,11 @@ }, "dependencies": { "@grpc/proto-loader": "^0.6.0", - "@opentelemetry/core": "0.19.0", - "@opentelemetry/exporter-collector": "0.19.0", - "@opentelemetry/metrics": "0.19.0", - "@opentelemetry/resources": "0.19.0", - "@opentelemetry/tracing": "0.19.0", + "@opentelemetry/core": "0.20.0", + "@opentelemetry/exporter-collector": "0.20.0", + "@opentelemetry/metrics": "0.20.0", + "@opentelemetry/resources": "0.20.0", + "@opentelemetry/tracing": "0.20.0", "protobufjs": "^6.9.0" } } diff --git a/packages/opentelemetry-exporter-collector-proto/src/version.ts b/packages/opentelemetry-exporter-collector-proto/src/version.ts index 3fc2009a621..a14ba6ef881 100644 --- a/packages/opentelemetry-exporter-collector-proto/src/version.ts +++ b/packages/opentelemetry-exporter-collector-proto/src/version.ts @@ -15,4 +15,4 @@ */ // this is autogenerated file, see scripts/version-update.js -export const VERSION = '0.19.0'; +export const VERSION = '0.20.0'; diff --git a/packages/opentelemetry-exporter-collector/package.json b/packages/opentelemetry-exporter-collector/package.json index 6b259563b4f..4d0e1c6a742 100644 --- a/packages/opentelemetry-exporter-collector/package.json +++ b/packages/opentelemetry-exporter-collector/package.json @@ -1,6 +1,6 @@ { "name": "@opentelemetry/exporter-collector", - "version": "0.19.0", + "version": "0.20.0", "description": "OpenTelemetry Collector Exporter allows user to send collected traces to the OpenTelemetry Collector", "main": "build/src/index.js", "module": "build/esm/index.js", @@ -85,10 +85,10 @@ "@opentelemetry/api": "^0.20.0" }, "dependencies": { - "@opentelemetry/api-metrics": "0.19.0", - "@opentelemetry/core": "0.19.0", - "@opentelemetry/metrics": "0.19.0", - "@opentelemetry/resources": "0.19.0", - "@opentelemetry/tracing": "0.19.0" + "@opentelemetry/api-metrics": "0.20.0", + "@opentelemetry/core": "0.20.0", + "@opentelemetry/metrics": "0.20.0", + "@opentelemetry/resources": "0.20.0", + "@opentelemetry/tracing": "0.20.0" } } diff --git a/packages/opentelemetry-exporter-collector/src/version.ts b/packages/opentelemetry-exporter-collector/src/version.ts index 3fc2009a621..a14ba6ef881 100644 --- a/packages/opentelemetry-exporter-collector/src/version.ts +++ b/packages/opentelemetry-exporter-collector/src/version.ts @@ -15,4 +15,4 @@ */ // this is autogenerated file, see scripts/version-update.js -export const VERSION = '0.19.0'; +export const VERSION = '0.20.0'; diff --git a/packages/opentelemetry-exporter-jaeger/package.json b/packages/opentelemetry-exporter-jaeger/package.json index e9014e70a65..c0f55c19469 100644 --- a/packages/opentelemetry-exporter-jaeger/package.json +++ b/packages/opentelemetry-exporter-jaeger/package.json @@ -1,6 +1,6 @@ { "name": "@opentelemetry/exporter-jaeger", - "version": "0.19.0", + "version": "0.20.0", "description": "OpenTelemetry Exporter Jaeger allows user to send collected traces to Jaeger", "main": "build/src/index.js", "types": "build/src/index.d.ts", @@ -41,7 +41,7 @@ }, "devDependencies": { "@opentelemetry/api": "^0.20.0", - "@opentelemetry/resources": "0.19.0", + "@opentelemetry/resources": "0.20.0", "@types/mocha": "8.2.2", "@types/node": "14.14.43", "@types/sinon": "9.0.11", @@ -59,9 +59,9 @@ "@opentelemetry/api": "^0.20.0" }, "dependencies": { - "@opentelemetry/core": "0.19.0", - "@opentelemetry/semantic-conventions": "0.19.0", - "@opentelemetry/tracing": "0.19.0", + "@opentelemetry/core": "0.20.0", + "@opentelemetry/semantic-conventions": "0.20.0", + "@opentelemetry/tracing": "0.20.0", "jaeger-client": "^3.15.0" } } diff --git a/packages/opentelemetry-exporter-jaeger/src/version.ts b/packages/opentelemetry-exporter-jaeger/src/version.ts index 3fc2009a621..a14ba6ef881 100644 --- a/packages/opentelemetry-exporter-jaeger/src/version.ts +++ b/packages/opentelemetry-exporter-jaeger/src/version.ts @@ -15,4 +15,4 @@ */ // this is autogenerated file, see scripts/version-update.js -export const VERSION = '0.19.0'; +export const VERSION = '0.20.0'; diff --git a/packages/opentelemetry-exporter-jaeger/tsconfig.json b/packages/opentelemetry-exporter-jaeger/tsconfig.json index 77140114c89..a5d1c2f05c7 100644 --- a/packages/opentelemetry-exporter-jaeger/tsconfig.json +++ b/packages/opentelemetry-exporter-jaeger/tsconfig.json @@ -15,6 +15,9 @@ { "path": "../opentelemetry-resources" }, + { + "path": "../opentelemetry-semantic-conventions" + }, { "path": "../opentelemetry-tracing" } diff --git a/packages/opentelemetry-exporter-prometheus/package.json b/packages/opentelemetry-exporter-prometheus/package.json index 7fcc3d0aa31..a2d516f3653 100644 --- a/packages/opentelemetry-exporter-prometheus/package.json +++ b/packages/opentelemetry-exporter-prometheus/package.json @@ -1,6 +1,6 @@ { "name": "@opentelemetry/exporter-prometheus", - "version": "0.19.0", + "version": "0.20.0", "description": "OpenTelemetry Exporter Prometheus provides a metrics endpoint for Prometheus", "main": "build/src/index.js", "types": "build/src/index.d.ts", @@ -56,8 +56,8 @@ "@opentelemetry/api": "^0.20.0" }, "dependencies": { - "@opentelemetry/api-metrics": "0.19.0", - "@opentelemetry/core": "0.19.0", - "@opentelemetry/metrics": "0.19.0" + "@opentelemetry/api-metrics": "0.20.0", + "@opentelemetry/core": "0.20.0", + "@opentelemetry/metrics": "0.20.0" } } diff --git a/packages/opentelemetry-exporter-prometheus/src/version.ts b/packages/opentelemetry-exporter-prometheus/src/version.ts index 3fc2009a621..a14ba6ef881 100644 --- a/packages/opentelemetry-exporter-prometheus/src/version.ts +++ b/packages/opentelemetry-exporter-prometheus/src/version.ts @@ -15,4 +15,4 @@ */ // this is autogenerated file, see scripts/version-update.js -export const VERSION = '0.19.0'; +export const VERSION = '0.20.0'; diff --git a/packages/opentelemetry-exporter-zipkin/package.json b/packages/opentelemetry-exporter-zipkin/package.json index 2b409e9e909..5ee5b4aa07c 100644 --- a/packages/opentelemetry-exporter-zipkin/package.json +++ b/packages/opentelemetry-exporter-zipkin/package.json @@ -1,6 +1,6 @@ { "name": "@opentelemetry/exporter-zipkin", - "version": "0.19.0", + "version": "0.20.0", "description": "OpenTelemetry Zipkin Exporter allows the user to send collected traces to Zipkin.", "main": "build/src/index.js", "module": "build/esm/index.js", @@ -83,9 +83,9 @@ "@opentelemetry/api": "^0.20.0" }, "dependencies": { - "@opentelemetry/core": "0.19.0", - "@opentelemetry/resources": "0.19.0", - "@opentelemetry/semantic-conventions": "0.19.0", - "@opentelemetry/tracing": "0.19.0" + "@opentelemetry/core": "0.20.0", + "@opentelemetry/resources": "0.20.0", + "@opentelemetry/semantic-conventions": "0.20.0", + "@opentelemetry/tracing": "0.20.0" } } diff --git a/packages/opentelemetry-exporter-zipkin/src/version.ts b/packages/opentelemetry-exporter-zipkin/src/version.ts index 3fc2009a621..a14ba6ef881 100644 --- a/packages/opentelemetry-exporter-zipkin/src/version.ts +++ b/packages/opentelemetry-exporter-zipkin/src/version.ts @@ -15,4 +15,4 @@ */ // this is autogenerated file, see scripts/version-update.js -export const VERSION = '0.19.0'; +export const VERSION = '0.20.0'; diff --git a/packages/opentelemetry-instrumentation-fetch/package.json b/packages/opentelemetry-instrumentation-fetch/package.json index 23659ed8a89..66201619a0d 100644 --- a/packages/opentelemetry-instrumentation-fetch/package.json +++ b/packages/opentelemetry-instrumentation-fetch/package.json @@ -1,6 +1,6 @@ { "name": "@opentelemetry/instrumentation-fetch", - "version": "0.19.0", + "version": "0.20.0", "description": "OpenTelemetry fetch automatic instrumentation package.", "main": "build/src/index.js", "module": "build/esm/index.js", @@ -48,9 +48,9 @@ "devDependencies": { "@babel/core": "7.14.0", "@opentelemetry/api": "^0.20.0", - "@opentelemetry/context-zone": "0.19.0", - "@opentelemetry/propagator-b3": "0.19.0", - "@opentelemetry/tracing": "0.19.0", + "@opentelemetry/context-zone": "0.20.0", + "@opentelemetry/propagator-b3": "0.20.0", + "@opentelemetry/tracing": "0.20.0", "@types/mocha": "8.2.2", "@types/node": "14.14.43", "@types/shimmer": "1.0.1", @@ -81,9 +81,9 @@ "@opentelemetry/api": "^0.20.0" }, "dependencies": { - "@opentelemetry/core": "0.19.0", - "@opentelemetry/instrumentation": "0.19.0", - "@opentelemetry/semantic-conventions": "0.19.0", - "@opentelemetry/web": "0.19.0" + "@opentelemetry/core": "0.20.0", + "@opentelemetry/instrumentation": "0.20.0", + "@opentelemetry/semantic-conventions": "0.20.0", + "@opentelemetry/web": "0.20.0" } } diff --git a/packages/opentelemetry-instrumentation-fetch/src/version.ts b/packages/opentelemetry-instrumentation-fetch/src/version.ts index 3fc2009a621..a14ba6ef881 100644 --- a/packages/opentelemetry-instrumentation-fetch/src/version.ts +++ b/packages/opentelemetry-instrumentation-fetch/src/version.ts @@ -15,4 +15,4 @@ */ // this is autogenerated file, see scripts/version-update.js -export const VERSION = '0.19.0'; +export const VERSION = '0.20.0'; diff --git a/packages/opentelemetry-instrumentation-grpc/package.json b/packages/opentelemetry-instrumentation-grpc/package.json index f12cb09f1e3..a5c9b8302f0 100644 --- a/packages/opentelemetry-instrumentation-grpc/package.json +++ b/packages/opentelemetry-instrumentation-grpc/package.json @@ -1,6 +1,6 @@ { "name": "@opentelemetry/instrumentation-grpc", - "version": "0.19.0", + "version": "0.20.0", "description": "OpenTelemetry grpc automatic instrumentation package.", "main": "build/src/index.js", "types": "build/src/index.d.ts", @@ -44,10 +44,10 @@ "@grpc/grpc-js": "1.3.0", "@grpc/proto-loader": "0.6.1", "@opentelemetry/api": "^0.20.0", - "@opentelemetry/context-async-hooks": "0.19.0", - "@opentelemetry/core": "0.19.0", - "@opentelemetry/node": "0.19.0", - "@opentelemetry/tracing": "0.19.0", + "@opentelemetry/context-async-hooks": "0.20.0", + "@opentelemetry/core": "0.20.0", + "@opentelemetry/node": "0.20.0", + "@opentelemetry/tracing": "0.20.0", "@types/mocha": "8.2.2", "@types/node": "14.14.43", "@types/semver": "7.3.5", @@ -69,8 +69,8 @@ "@opentelemetry/api": "^0.20.0" }, "dependencies": { - "@opentelemetry/api-metrics": "0.19.0", - "@opentelemetry/instrumentation": "0.19.0", - "@opentelemetry/semantic-conventions": "0.19.0" + "@opentelemetry/api-metrics": "0.20.0", + "@opentelemetry/instrumentation": "0.20.0", + "@opentelemetry/semantic-conventions": "0.20.0" } } diff --git a/packages/opentelemetry-instrumentation-grpc/src/version.ts b/packages/opentelemetry-instrumentation-grpc/src/version.ts index 3fc2009a621..a14ba6ef881 100644 --- a/packages/opentelemetry-instrumentation-grpc/src/version.ts +++ b/packages/opentelemetry-instrumentation-grpc/src/version.ts @@ -15,4 +15,4 @@ */ // this is autogenerated file, see scripts/version-update.js -export const VERSION = '0.19.0'; +export const VERSION = '0.20.0'; diff --git a/packages/opentelemetry-instrumentation-http/package.json b/packages/opentelemetry-instrumentation-http/package.json index 84b9954f3e0..a4e4d1be846 100644 --- a/packages/opentelemetry-instrumentation-http/package.json +++ b/packages/opentelemetry-instrumentation-http/package.json @@ -1,6 +1,6 @@ { "name": "@opentelemetry/instrumentation-http", - "version": "0.19.0", + "version": "0.20.0", "description": "OpenTelemetry http/https automatic instrumentation package.", "main": "build/src/index.js", "types": "build/src/index.d.ts", @@ -42,9 +42,9 @@ }, "devDependencies": { "@opentelemetry/api": "^0.20.0", - "@opentelemetry/context-async-hooks": "0.19.0", - "@opentelemetry/node": "0.19.0", - "@opentelemetry/tracing": "0.19.0", + "@opentelemetry/context-async-hooks": "0.20.0", + "@opentelemetry/node": "0.20.0", + "@opentelemetry/tracing": "0.20.0", "@types/got": "9.6.11", "@types/mocha": "8.2.2", "@types/node": "14.14.43", @@ -71,9 +71,9 @@ "@opentelemetry/api": "^0.20.0" }, "dependencies": { - "@opentelemetry/core": "0.19.0", - "@opentelemetry/instrumentation": "0.19.0", - "@opentelemetry/semantic-conventions": "0.19.0", + "@opentelemetry/core": "0.20.0", + "@opentelemetry/instrumentation": "0.20.0", + "@opentelemetry/semantic-conventions": "0.20.0", "semver": "^7.1.3" } } diff --git a/packages/opentelemetry-instrumentation-http/src/version.ts b/packages/opentelemetry-instrumentation-http/src/version.ts index 3fc2009a621..a14ba6ef881 100644 --- a/packages/opentelemetry-instrumentation-http/src/version.ts +++ b/packages/opentelemetry-instrumentation-http/src/version.ts @@ -15,4 +15,4 @@ */ // this is autogenerated file, see scripts/version-update.js -export const VERSION = '0.19.0'; +export const VERSION = '0.20.0'; diff --git a/packages/opentelemetry-instrumentation-xml-http-request/package.json b/packages/opentelemetry-instrumentation-xml-http-request/package.json index dc1b140a37b..ed5648d9613 100644 --- a/packages/opentelemetry-instrumentation-xml-http-request/package.json +++ b/packages/opentelemetry-instrumentation-xml-http-request/package.json @@ -1,6 +1,6 @@ { "name": "@opentelemetry/instrumentation-xml-http-request", - "version": "0.19.0", + "version": "0.20.0", "description": "OpenTelemetry XMLHttpRequest automatic instrumentation package.", "main": "build/src/index.js", "module": "build/esm/index.js", @@ -48,9 +48,9 @@ "devDependencies": { "@babel/core": "7.14.0", "@opentelemetry/api": "^0.20.0", - "@opentelemetry/context-zone": "0.19.0", - "@opentelemetry/propagator-b3": "0.19.0", - "@opentelemetry/tracing": "0.19.0", + "@opentelemetry/context-zone": "0.20.0", + "@opentelemetry/propagator-b3": "0.20.0", + "@opentelemetry/tracing": "0.20.0", "@types/mocha": "8.2.2", "@types/node": "14.14.43", "@types/sinon": "9.0.11", @@ -80,9 +80,9 @@ "@opentelemetry/api": "^0.20.0" }, "dependencies": { - "@opentelemetry/core": "0.19.0", - "@opentelemetry/instrumentation": "0.19.0", - "@opentelemetry/semantic-conventions": "0.19.0", - "@opentelemetry/web": "0.19.0" + "@opentelemetry/core": "0.20.0", + "@opentelemetry/instrumentation": "0.20.0", + "@opentelemetry/semantic-conventions": "0.20.0", + "@opentelemetry/web": "0.20.0" } } diff --git a/packages/opentelemetry-instrumentation-xml-http-request/src/version.ts b/packages/opentelemetry-instrumentation-xml-http-request/src/version.ts index 3fc2009a621..a14ba6ef881 100644 --- a/packages/opentelemetry-instrumentation-xml-http-request/src/version.ts +++ b/packages/opentelemetry-instrumentation-xml-http-request/src/version.ts @@ -15,4 +15,4 @@ */ // this is autogenerated file, see scripts/version-update.js -export const VERSION = '0.19.0'; +export const VERSION = '0.20.0'; diff --git a/packages/opentelemetry-instrumentation/package.json b/packages/opentelemetry-instrumentation/package.json index 1c92901c890..7beacbe4950 100644 --- a/packages/opentelemetry-instrumentation/package.json +++ b/packages/opentelemetry-instrumentation/package.json @@ -1,6 +1,6 @@ { "name": "@opentelemetry/instrumentation", - "version": "0.19.0", + "version": "0.20.0", "description": "Base class for node which OpenTelemetry instrumentation modules extend", "author": "OpenTelemetry Authors", "homepage": "https://github.com/open-telemetry/opentelemetry-js#readme", @@ -59,7 +59,7 @@ "url": "https://github.com/open-telemetry/opentelemetry-js/issues" }, "dependencies": { - "@opentelemetry/api-metrics": "0.19.0", + "@opentelemetry/api-metrics": "0.20.0", "require-in-the-middle": "^5.0.3", "semver": "^7.3.2", "shimmer": "^1.2.1" diff --git a/packages/opentelemetry-instrumentation/src/version.ts b/packages/opentelemetry-instrumentation/src/version.ts index 3fc2009a621..a14ba6ef881 100644 --- a/packages/opentelemetry-instrumentation/src/version.ts +++ b/packages/opentelemetry-instrumentation/src/version.ts @@ -15,4 +15,4 @@ */ // this is autogenerated file, see scripts/version-update.js -export const VERSION = '0.19.0'; +export const VERSION = '0.20.0'; diff --git a/packages/opentelemetry-metrics/package.json b/packages/opentelemetry-metrics/package.json index 609b62c7503..84a32c98520 100644 --- a/packages/opentelemetry-metrics/package.json +++ b/packages/opentelemetry-metrics/package.json @@ -1,6 +1,6 @@ { "name": "@opentelemetry/metrics", - "version": "0.19.0", + "version": "0.20.0", "description": "OpenTelemetry metrics SDK", "main": "build/src/index.js", "module": "build/esm/index.js", @@ -62,9 +62,9 @@ "@opentelemetry/api": "^0.20.0" }, "dependencies": { - "@opentelemetry/api-metrics": "0.19.0", - "@opentelemetry/core": "0.19.0", - "@opentelemetry/resources": "0.19.0", + "@opentelemetry/api-metrics": "0.20.0", + "@opentelemetry/core": "0.20.0", + "@opentelemetry/resources": "0.20.0", "lodash.merge": "^4.6.2" } } diff --git a/packages/opentelemetry-metrics/src/version.ts b/packages/opentelemetry-metrics/src/version.ts index 3fc2009a621..a14ba6ef881 100644 --- a/packages/opentelemetry-metrics/src/version.ts +++ b/packages/opentelemetry-metrics/src/version.ts @@ -15,4 +15,4 @@ */ // this is autogenerated file, see scripts/version-update.js -export const VERSION = '0.19.0'; +export const VERSION = '0.20.0'; diff --git a/packages/opentelemetry-node/package.json b/packages/opentelemetry-node/package.json index 187699480f1..6fab0565d82 100644 --- a/packages/opentelemetry-node/package.json +++ b/packages/opentelemetry-node/package.json @@ -1,6 +1,6 @@ { "name": "@opentelemetry/node", - "version": "0.19.0", + "version": "0.20.0", "description": "OpenTelemetry Node SDK provides automatic telemetry (tracing, metrics, etc) for Node.js applications", "main": "build/src/index.js", "types": "build/src/index.d.ts", @@ -42,8 +42,8 @@ }, "devDependencies": { "@opentelemetry/api": "^0.20.0", - "@opentelemetry/resources": "0.19.0", - "@opentelemetry/semantic-conventions": "0.19.0", + "@opentelemetry/resources": "0.20.0", + "@opentelemetry/semantic-conventions": "0.20.0", "@types/mocha": "8.2.2", "@types/node": "14.14.43", "@types/semver": "7.3.5", @@ -63,11 +63,11 @@ "@opentelemetry/api": "^0.20.0" }, "dependencies": { - "@opentelemetry/context-async-hooks": "0.19.0", - "@opentelemetry/core": "0.19.0", - "@opentelemetry/propagator-b3": "0.19.0", - "@opentelemetry/propagator-jaeger": "0.19.0", - "@opentelemetry/tracing": "0.19.0", + "@opentelemetry/context-async-hooks": "0.20.0", + "@opentelemetry/core": "0.20.0", + "@opentelemetry/propagator-b3": "0.20.0", + "@opentelemetry/propagator-jaeger": "0.20.0", + "@opentelemetry/tracing": "0.20.0", "semver": "^7.1.3" } } diff --git a/packages/opentelemetry-node/src/version.ts b/packages/opentelemetry-node/src/version.ts index 3fc2009a621..a14ba6ef881 100644 --- a/packages/opentelemetry-node/src/version.ts +++ b/packages/opentelemetry-node/src/version.ts @@ -15,4 +15,4 @@ */ // this is autogenerated file, see scripts/version-update.js -export const VERSION = '0.19.0'; +export const VERSION = '0.20.0'; diff --git a/packages/opentelemetry-propagator-b3/package.json b/packages/opentelemetry-propagator-b3/package.json index ee37dd9b5ae..aa90724168d 100644 --- a/packages/opentelemetry-propagator-b3/package.json +++ b/packages/opentelemetry-propagator-b3/package.json @@ -1,6 +1,6 @@ { "name": "@opentelemetry/propagator-b3", - "version": "0.19.0", + "version": "0.20.0", "description": "OpenTelemetry B3 propagator provides context propagation for systems that are using the B3 header format", "main": "build/src/index.js", "module": "build/esm/index.js", @@ -43,7 +43,7 @@ "access": "public" }, "dependencies": { - "@opentelemetry/core": "^0.19.0" + "@opentelemetry/core": "0.20.0" }, "peerDependencies": { "@opentelemetry/api": "^0.20.0" diff --git a/packages/opentelemetry-propagator-b3/src/version.ts b/packages/opentelemetry-propagator-b3/src/version.ts index 3fc2009a621..a14ba6ef881 100644 --- a/packages/opentelemetry-propagator-b3/src/version.ts +++ b/packages/opentelemetry-propagator-b3/src/version.ts @@ -15,4 +15,4 @@ */ // this is autogenerated file, see scripts/version-update.js -export const VERSION = '0.19.0'; +export const VERSION = '0.20.0'; diff --git a/packages/opentelemetry-propagator-jaeger/package.json b/packages/opentelemetry-propagator-jaeger/package.json index 4ee8beae3b1..57c1e04c4c3 100644 --- a/packages/opentelemetry-propagator-jaeger/package.json +++ b/packages/opentelemetry-propagator-jaeger/package.json @@ -1,6 +1,6 @@ { "name": "@opentelemetry/propagator-jaeger", - "version": "0.19.0", + "version": "0.20.0", "description": "OpenTelemetry Jaeger propagator provides HTTP header propagation for systems that are using Jaeger HTTP header format.", "main": "build/src/index.js", "module": "build/esm/index.js", @@ -74,6 +74,6 @@ "@opentelemetry/api": "^0.20.0" }, "dependencies": { - "@opentelemetry/core": "0.19.0" + "@opentelemetry/core": "0.20.0" } } diff --git a/packages/opentelemetry-propagator-jaeger/src/version.ts b/packages/opentelemetry-propagator-jaeger/src/version.ts index 3fc2009a621..a14ba6ef881 100644 --- a/packages/opentelemetry-propagator-jaeger/src/version.ts +++ b/packages/opentelemetry-propagator-jaeger/src/version.ts @@ -15,4 +15,4 @@ */ // this is autogenerated file, see scripts/version-update.js -export const VERSION = '0.19.0'; +export const VERSION = '0.20.0'; diff --git a/packages/opentelemetry-resource-detector-aws/package.json b/packages/opentelemetry-resource-detector-aws/package.json index 0072c00cc2c..83cfafb79b0 100644 --- a/packages/opentelemetry-resource-detector-aws/package.json +++ b/packages/opentelemetry-resource-detector-aws/package.json @@ -1,6 +1,6 @@ { "name": "@opentelemetry/resource-detector-aws", - "version": "0.19.0", + "version": "0.20.0", "description": "OpenTelemetry SDK resource detector for AWS", "main": "build/src/index.js", "types": "build/src/index.d.ts", @@ -57,8 +57,8 @@ "@opentelemetry/api": "^0.20.0" }, "dependencies": { - "@opentelemetry/core": "0.19.0", - "@opentelemetry/resources": "0.19.0", - "@opentelemetry/semantic-conventions": "0.19.0" + "@opentelemetry/core": "0.20.0", + "@opentelemetry/resources": "0.20.0", + "@opentelemetry/semantic-conventions": "0.20.0" } } diff --git a/packages/opentelemetry-resource-detector-aws/src/version.ts b/packages/opentelemetry-resource-detector-aws/src/version.ts index 3fc2009a621..a14ba6ef881 100644 --- a/packages/opentelemetry-resource-detector-aws/src/version.ts +++ b/packages/opentelemetry-resource-detector-aws/src/version.ts @@ -15,4 +15,4 @@ */ // this is autogenerated file, see scripts/version-update.js -export const VERSION = '0.19.0'; +export const VERSION = '0.20.0'; diff --git a/packages/opentelemetry-resource-detector-gcp/package.json b/packages/opentelemetry-resource-detector-gcp/package.json index 4bb08dee6c2..b5b6c58f7af 100644 --- a/packages/opentelemetry-resource-detector-gcp/package.json +++ b/packages/opentelemetry-resource-detector-gcp/package.json @@ -1,6 +1,6 @@ { "name": "@opentelemetry/resource-detector-gcp", - "version": "0.19.0", + "version": "0.20.0", "description": "OpenTelemetry SDK resource detector for GCP", "main": "build/src/index.js", "types": "build/src/index.d.ts", @@ -40,7 +40,7 @@ }, "devDependencies": { "@opentelemetry/api": "^0.20.0", - "@opentelemetry/core": "0.19.0", + "@opentelemetry/core": "0.20.0", "@types/mocha": "8.2.2", "@types/node": "14.14.43", "@types/semver": "7.3.5", @@ -57,8 +57,8 @@ "@opentelemetry/api": "^0.20.0" }, "dependencies": { - "@opentelemetry/resources": "0.19.0", - "@opentelemetry/semantic-conventions": "0.19.0", + "@opentelemetry/resources": "0.20.0", + "@opentelemetry/semantic-conventions": "0.20.0", "gcp-metadata": "^4.1.4", "semver": "7.3.5" } diff --git a/packages/opentelemetry-resource-detector-gcp/src/version.ts b/packages/opentelemetry-resource-detector-gcp/src/version.ts index 3fc2009a621..a14ba6ef881 100644 --- a/packages/opentelemetry-resource-detector-gcp/src/version.ts +++ b/packages/opentelemetry-resource-detector-gcp/src/version.ts @@ -15,4 +15,4 @@ */ // this is autogenerated file, see scripts/version-update.js -export const VERSION = '0.19.0'; +export const VERSION = '0.20.0'; diff --git a/packages/opentelemetry-resources/package.json b/packages/opentelemetry-resources/package.json index 54dc765e51e..44c48c99442 100644 --- a/packages/opentelemetry-resources/package.json +++ b/packages/opentelemetry-resources/package.json @@ -1,6 +1,6 @@ { "name": "@opentelemetry/resources", - "version": "0.19.0", + "version": "0.20.0", "description": "OpenTelemetry SDK resources", "main": "build/src/index.js", "module": "build/esm/index.js", @@ -66,7 +66,7 @@ "@opentelemetry/api": "^0.20.0" }, "dependencies": { - "@opentelemetry/core": "0.19.0", - "@opentelemetry/semantic-conventions": "0.19.0" + "@opentelemetry/core": "0.20.0", + "@opentelemetry/semantic-conventions": "0.20.0" } } diff --git a/packages/opentelemetry-resources/src/version.ts b/packages/opentelemetry-resources/src/version.ts index 3fc2009a621..a14ba6ef881 100644 --- a/packages/opentelemetry-resources/src/version.ts +++ b/packages/opentelemetry-resources/src/version.ts @@ -15,4 +15,4 @@ */ // this is autogenerated file, see scripts/version-update.js -export const VERSION = '0.19.0'; +export const VERSION = '0.20.0'; diff --git a/packages/opentelemetry-sdk-node/package.json b/packages/opentelemetry-sdk-node/package.json index 93c0a8e3c0b..363989d6052 100644 --- a/packages/opentelemetry-sdk-node/package.json +++ b/packages/opentelemetry-sdk-node/package.json @@ -1,6 +1,6 @@ { "name": "@opentelemetry/sdk-node", - "version": "0.19.0", + "version": "0.20.0", "description": "OpenTelemetry SDK for Node.js", "main": "build/src/index.js", "types": "build/src/index.d.ts", @@ -40,22 +40,22 @@ "access": "public" }, "dependencies": { - "@opentelemetry/api-metrics": "0.19.0", - "@opentelemetry/core": "0.19.0", - "@opentelemetry/instrumentation": "0.19.0", - "@opentelemetry/metrics": "0.19.0", - "@opentelemetry/node": "0.19.0", - "@opentelemetry/resource-detector-aws": "0.19.0", - "@opentelemetry/resource-detector-gcp": "0.19.0", - "@opentelemetry/resources": "0.19.0", - "@opentelemetry/tracing": "0.19.0" + "@opentelemetry/api-metrics": "0.20.0", + "@opentelemetry/core": "0.20.0", + "@opentelemetry/instrumentation": "0.20.0", + "@opentelemetry/metrics": "0.20.0", + "@opentelemetry/node": "0.20.0", + "@opentelemetry/resource-detector-aws": "0.20.0", + "@opentelemetry/resource-detector-gcp": "0.20.0", + "@opentelemetry/resources": "0.20.0", + "@opentelemetry/tracing": "0.20.0" }, "peerDependencies": { "@opentelemetry/api": "^0.20.0" }, "devDependencies": { "@opentelemetry/api": "^0.20.0", - "@opentelemetry/context-async-hooks": "0.19.0", + "@opentelemetry/context-async-hooks": "0.20.0", "@types/mocha": "8.2.2", "@types/node": "14.14.43", "@types/semver": "7.3.5", diff --git a/packages/opentelemetry-sdk-node/src/version.ts b/packages/opentelemetry-sdk-node/src/version.ts index 3fc2009a621..a14ba6ef881 100644 --- a/packages/opentelemetry-sdk-node/src/version.ts +++ b/packages/opentelemetry-sdk-node/src/version.ts @@ -15,4 +15,4 @@ */ // this is autogenerated file, see scripts/version-update.js -export const VERSION = '0.19.0'; +export const VERSION = '0.20.0'; diff --git a/packages/opentelemetry-semantic-conventions/package.json b/packages/opentelemetry-semantic-conventions/package.json index 6d6fc4892f5..119cdb63e37 100644 --- a/packages/opentelemetry-semantic-conventions/package.json +++ b/packages/opentelemetry-semantic-conventions/package.json @@ -1,6 +1,6 @@ { "name": "@opentelemetry/semantic-conventions", - "version": "0.19.0", + "version": "0.20.0", "description": "OpenTelemetry semantic conventions", "main": "build/src/index.js", "module": "build/esm/index.js", diff --git a/packages/opentelemetry-semantic-conventions/src/version.ts b/packages/opentelemetry-semantic-conventions/src/version.ts index 3fc2009a621..a14ba6ef881 100644 --- a/packages/opentelemetry-semantic-conventions/src/version.ts +++ b/packages/opentelemetry-semantic-conventions/src/version.ts @@ -15,4 +15,4 @@ */ // this is autogenerated file, see scripts/version-update.js -export const VERSION = '0.19.0'; +export const VERSION = '0.20.0'; diff --git a/packages/opentelemetry-shim-opentracing/package.json b/packages/opentelemetry-shim-opentracing/package.json index c39054cefee..2f3c7fb8818 100644 --- a/packages/opentelemetry-shim-opentracing/package.json +++ b/packages/opentelemetry-shim-opentracing/package.json @@ -1,6 +1,6 @@ { "name": "@opentelemetry/shim-opentracing", - "version": "0.19.0", + "version": "0.20.0", "description": "OpenTracing to OpenTelemetry shim", "main": "build/src/index.js", "types": "build/src/index.d.ts", @@ -39,9 +39,9 @@ }, "devDependencies": { "@opentelemetry/api": "^0.20.0", - "@opentelemetry/tracing": "0.19.0", - "@opentelemetry/propagator-b3": "0.19.0", - "@opentelemetry/propagator-jaeger": "0.19.0", + "@opentelemetry/tracing": "0.20.0", + "@opentelemetry/propagator-b3": "0.20.0", + "@opentelemetry/propagator-jaeger": "0.20.0", "@types/mocha": "8.2.2", "@types/node": "14.14.43", "codecov": "3.8.1", @@ -58,7 +58,7 @@ "@opentelemetry/api": "^0.20.0" }, "dependencies": { - "@opentelemetry/core": "0.19.0", + "@opentelemetry/core": "0.20.0", "opentracing": "^0.14.4" } } diff --git a/packages/opentelemetry-shim-opentracing/src/version.ts b/packages/opentelemetry-shim-opentracing/src/version.ts index 3fc2009a621..a14ba6ef881 100644 --- a/packages/opentelemetry-shim-opentracing/src/version.ts +++ b/packages/opentelemetry-shim-opentracing/src/version.ts @@ -15,4 +15,4 @@ */ // this is autogenerated file, see scripts/version-update.js -export const VERSION = '0.19.0'; +export const VERSION = '0.20.0'; diff --git a/packages/opentelemetry-tracing/package.json b/packages/opentelemetry-tracing/package.json index 73dad83f60a..713dd00f552 100644 --- a/packages/opentelemetry-tracing/package.json +++ b/packages/opentelemetry-tracing/package.json @@ -1,6 +1,6 @@ { "name": "@opentelemetry/tracing", - "version": "0.19.0", + "version": "0.20.0", "description": "OpenTelemetry Tracing", "main": "build/src/index.js", "module": "build/esm/index.js", @@ -81,9 +81,9 @@ "@opentelemetry/api": "^0.20.0" }, "dependencies": { - "@opentelemetry/core": "0.19.0", - "@opentelemetry/resources": "0.19.0", - "@opentelemetry/semantic-conventions": "0.19.0", + "@opentelemetry/core": "0.20.0", + "@opentelemetry/resources": "0.20.0", + "@opentelemetry/semantic-conventions": "0.20.0", "lodash.merge": "^4.6.2" } } diff --git a/packages/opentelemetry-tracing/src/version.ts b/packages/opentelemetry-tracing/src/version.ts index 3fc2009a621..a14ba6ef881 100644 --- a/packages/opentelemetry-tracing/src/version.ts +++ b/packages/opentelemetry-tracing/src/version.ts @@ -15,4 +15,4 @@ */ // this is autogenerated file, see scripts/version-update.js -export const VERSION = '0.19.0'; +export const VERSION = '0.20.0'; diff --git a/packages/opentelemetry-web/package.json b/packages/opentelemetry-web/package.json index 50b7f862d84..40a90165401 100644 --- a/packages/opentelemetry-web/package.json +++ b/packages/opentelemetry-web/package.json @@ -1,6 +1,6 @@ { "name": "@opentelemetry/web", - "version": "0.19.0", + "version": "0.20.0", "description": "OpenTelemetry Web Tracer", "main": "build/src/index.js", "module": "build/esm/index.js", @@ -47,9 +47,9 @@ "devDependencies": { "@babel/core": "7.14.0", "@opentelemetry/api": "^0.20.0", - "@opentelemetry/context-zone": "0.19.0", - "@opentelemetry/propagator-b3": "0.19.0", - "@opentelemetry/resources": "0.19.0", + "@opentelemetry/context-zone": "0.20.0", + "@opentelemetry/propagator-b3": "0.20.0", + "@opentelemetry/resources": "0.20.0", "@types/jquery": "3.5.5", "@types/mocha": "8.2.2", "@types/node": "14.14.43", @@ -81,8 +81,8 @@ "@opentelemetry/api": "^0.20.0" }, "dependencies": { - "@opentelemetry/core": "0.19.0", - "@opentelemetry/semantic-conventions": "0.19.0", - "@opentelemetry/tracing": "0.19.0" + "@opentelemetry/core": "0.20.0", + "@opentelemetry/semantic-conventions": "0.20.0", + "@opentelemetry/tracing": "0.20.0" } } diff --git a/packages/opentelemetry-web/src/version.ts b/packages/opentelemetry-web/src/version.ts index 3fc2009a621..a14ba6ef881 100644 --- a/packages/opentelemetry-web/src/version.ts +++ b/packages/opentelemetry-web/src/version.ts @@ -15,4 +15,4 @@ */ // this is autogenerated file, see scripts/version-update.js -export const VERSION = '0.19.0'; +export const VERSION = '0.20.0'; diff --git a/packages/template/package.json b/packages/template/package.json index 4b334dc9073..e73ab7f646c 100644 --- a/packages/template/package.json +++ b/packages/template/package.json @@ -1,6 +1,6 @@ { "name": "@opentelemetry/template", - "version": "0.19.0", + "version": "0.20.0", "private": true, "publishConfig": { "access": "restricted" From 07fb31063969a8e3a8350a240e55b6c9e962dcfb Mon Sep 17 00:00:00 2001 From: Daniel Dyla Date: Fri, 4 Jun 2021 12:54:05 -0400 Subject: [PATCH 09/11] chore: add missing changelog entry (#2253) --- CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9563faa8512..a0f90fe94f1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -45,6 +45,8 @@ All notable changes to this project will be documented in this file. * [#2134](https://github.com/open-telemetry/opentelemetry-js/pull/2134) feat(instrumentation-xhr): add applyCustomAttributesOnSpan hook ([@mhennoch](https://github.com/mhennoch)) * `opentelemetry-exporter-prometheus` * [#2122](https://github.com/open-telemetry/opentelemetry-js/pull/2122) feat: add diag warning when metric name is invalid ([@weyert](https://github.com/weyert)) +* `opentelemetry-api-metrics`, `opentelemetry-exporter-collector-grpc`, `opentelemetry-exporter-collector-proto`, `opentelemetry-exporter-collector`, `opentelemetry-metrics` + * [#2118](https://github.com/open-telemetry/opentelemetry-js/pull/2118) chore(deps): support cumulative, delta, and pass-through exporters ([@sergeylanzman](https://github.com/sergeylanzman)) ### :bug: (Bug Fix) From 4a078506670382e8d33ea575c142746f5a2afcbc Mon Sep 17 00:00:00 2001 From: Daniel Dyla Date: Fri, 4 Jun 2021 13:21:46 -0400 Subject: [PATCH 10/11] chore: update compatibility matrix (#2254) * chore: update compatibility matrix * chore: remove deprecation warning --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index d72df582db8..163c51a32b5 100644 --- a/README.md +++ b/README.md @@ -48,8 +48,8 @@ This is the JavaScript version of [OpenTelemetry](https://opentelemetry.io/), a | API Version | Core version | Contrib Version | | ----------- |--------------|-------------------------| -| 0.20.x | 0.20.x | ------ | -| v1.0.0-rc.0 | 0.19.x | ------ | +| 0.20.x | 0.20.x | 0.20.x | +| v1.0.0-rc.3 | 0.19.x | 0.16.x | | 0.18.x | 0.18.x | 0.14.x | | | 0.17.x | ------ | | | 0.16.x | ------ | From d4df2f7ebaaaf433bd84b568c482e2788103ab71 Mon Sep 17 00:00:00 2001 From: Daniel Dyla Date: Sat, 5 Jun 2021 04:23:21 -0400 Subject: [PATCH 11/11] chore: update API to 0.21.0 (#2255) * chore: update API to 0.21.0 * chore: revert accidentally renamed argument * chore: fix test * chore: make tsdocs more clear --- examples/basic-tracer-node/package.json | 2 +- examples/collector-exporter-node/package.json | 2 +- examples/grpc-js/package.json | 2 +- examples/grpc/package.json | 2 +- examples/http/package.json | 2 +- examples/https/package.json | 2 +- examples/tracer-web/package.json | 2 +- .../package.json | 4 +- .../opentelemetry-api-metrics/package.json | 4 +- .../package.json | 4 +- .../src/AbstractAsyncHooksContextManager.ts | 10 ++++- .../test/AsyncHooksContextManager.test.ts | 41 +++++++++---------- .../package.json | 4 +- .../src/ZoneContextManager.ts | 7 ++-- .../test/ZoneContextManager.test.ts | 20 +++++---- packages/opentelemetry-core/package.json | 4 +- .../package.json | 4 +- .../package.json | 4 +- .../package.json | 4 +- .../package.json | 4 +- .../package.json | 4 +- .../test/PrometheusSerializer.test.ts | 3 +- .../package.json | 4 +- .../package.json | 4 +- .../package.json | 4 +- .../src/grpc-js/clientUtils.ts | 4 +- .../src/grpc-js/serverUtils.ts | 4 +- .../src/grpc/clientUtils.ts | 4 +- .../src/grpc/serverUtils.ts | 4 +- .../package.json | 4 +- .../src/http.ts | 14 +++---- .../package.json | 4 +- .../package.json | 4 +- packages/opentelemetry-metrics/package.json | 4 +- packages/opentelemetry-node/package.json | 4 +- .../test/NodeTracerProvider.test.ts | 2 +- .../opentelemetry-propagator-b3/package.json | 4 +- .../package.json | 4 +- .../package.json | 4 +- .../package.json | 4 +- packages/opentelemetry-resources/package.json | 4 +- packages/opentelemetry-sdk-node/package.json | 4 +- .../package.json | 4 +- packages/opentelemetry-tracing/package.json | 4 +- .../test/BasicTracerProvider.test.ts | 2 +- .../test/export/TestStackContextManager.ts | 2 +- packages/opentelemetry-web/package.json | 4 +- .../src/StackContextManager.ts | 7 ++-- .../test/StackContextManager.test.ts | 14 +++---- 49 files changed, 135 insertions(+), 125 deletions(-) diff --git a/examples/basic-tracer-node/package.json b/examples/basic-tracer-node/package.json index a5f4da03177..312e7cc987a 100644 --- a/examples/basic-tracer-node/package.json +++ b/examples/basic-tracer-node/package.json @@ -24,7 +24,7 @@ "url": "https://github.com/open-telemetry/opentelemetry-js/issues" }, "dependencies": { - "@opentelemetry/api": "^0.20.0", + "@opentelemetry/api": "^0.21.0", "@opentelemetry/exporter-jaeger": "0.20.0", "@opentelemetry/tracing": "0.20.0" }, diff --git a/examples/collector-exporter-node/package.json b/examples/collector-exporter-node/package.json index 9127d7004c5..9ee76ab0a9a 100644 --- a/examples/collector-exporter-node/package.json +++ b/examples/collector-exporter-node/package.json @@ -28,7 +28,7 @@ "url": "https://github.com/open-telemetry/opentelemetry-js/issues" }, "dependencies": { - "@opentelemetry/api": "^0.20.0", + "@opentelemetry/api": "^0.21.0", "@opentelemetry/core": "0.20.0", "@opentelemetry/exporter-collector": "0.20.0", "@opentelemetry/exporter-collector-grpc": "0.20.0", diff --git a/examples/grpc-js/package.json b/examples/grpc-js/package.json index 45b59ee588d..94ff11c104f 100644 --- a/examples/grpc-js/package.json +++ b/examples/grpc-js/package.json @@ -29,7 +29,7 @@ }, "dependencies": { "@grpc/grpc-js": "^1.2.12", - "@opentelemetry/api": "^0.20.0", + "@opentelemetry/api": "^0.21.0", "@opentelemetry/exporter-jaeger": "0.20.0", "@opentelemetry/exporter-zipkin": "0.20.0", "@opentelemetry/instrumentation": "0.20.0", diff --git a/examples/grpc/package.json b/examples/grpc/package.json index 2c9ff53513b..868d56d457e 100644 --- a/examples/grpc/package.json +++ b/examples/grpc/package.json @@ -28,7 +28,7 @@ "url": "https://github.com/open-telemetry/opentelemetry-js/issues" }, "dependencies": { - "@opentelemetry/api": "^0.20.0", + "@opentelemetry/api": "^0.21.0", "@opentelemetry/exporter-jaeger": "0.20.0", "@opentelemetry/exporter-zipkin": "0.20.0", "@opentelemetry/instrumentation": "0.20.0", diff --git a/examples/http/package.json b/examples/http/package.json index 0db1c8f2950..9851b525063 100644 --- a/examples/http/package.json +++ b/examples/http/package.json @@ -28,7 +28,7 @@ "url": "https://github.com/open-telemetry/opentelemetry-js/issues" }, "dependencies": { - "@opentelemetry/api": "^0.20.0", + "@opentelemetry/api": "^0.21.0", "@opentelemetry/exporter-jaeger": "0.20.0", "@opentelemetry/exporter-zipkin": "0.20.0", "@opentelemetry/instrumentation": "0.20.0", diff --git a/examples/https/package.json b/examples/https/package.json index edf216d0955..3099fffcc74 100644 --- a/examples/https/package.json +++ b/examples/https/package.json @@ -29,7 +29,7 @@ "url": "https://github.com/open-telemetry/opentelemetry-js/issues" }, "dependencies": { - "@opentelemetry/api": "^0.20.0", + "@opentelemetry/api": "^0.21.0", "@opentelemetry/exporter-jaeger": "0.20.0", "@opentelemetry/exporter-zipkin": "0.20.0", "@opentelemetry/instrumentation": "0.20.0", diff --git a/examples/tracer-web/package.json b/examples/tracer-web/package.json index d361e02247b..b4f505de403 100644 --- a/examples/tracer-web/package.json +++ b/examples/tracer-web/package.json @@ -34,7 +34,7 @@ "webpack-merge": "^4.2.2" }, "dependencies": { - "@opentelemetry/api": "^0.20.0", + "@opentelemetry/api": "^0.21.0", "@opentelemetry/context-zone": "0.20.0", "@opentelemetry/core": "0.20.0", "@opentelemetry/exporter-collector": "0.20.0", diff --git a/integration-tests/propagation-validation-server/package.json b/integration-tests/propagation-validation-server/package.json index bb4737bbf38..132d9d79c21 100644 --- a/integration-tests/propagation-validation-server/package.json +++ b/integration-tests/propagation-validation-server/package.json @@ -19,10 +19,10 @@ "express": "4.17.1" }, "devDependencies": { - "@opentelemetry/api": "^0.20.0", + "@opentelemetry/api": "^0.21.0", "typescript": "4.3.2" }, "peerDependencies": { - "@opentelemetry/api": "^0.20.0" + "@opentelemetry/api": "^0.21.0" } } diff --git a/packages/opentelemetry-api-metrics/package.json b/packages/opentelemetry-api-metrics/package.json index 19e1e6fa499..8c289df471d 100644 --- a/packages/opentelemetry-api-metrics/package.json +++ b/packages/opentelemetry-api-metrics/package.json @@ -53,10 +53,10 @@ "access": "public" }, "peerDependencies": { - "@opentelemetry/api": "^0.20.0" + "@opentelemetry/api": "^0.21.0" }, "devDependencies": { - "@opentelemetry/api": "^0.20.0", + "@opentelemetry/api": "^0.21.0", "@types/mocha": "8.2.2", "@types/node": "14.14.43", "@types/webpack-env": "1.16.0", diff --git a/packages/opentelemetry-context-async-hooks/package.json b/packages/opentelemetry-context-async-hooks/package.json index f6d52df6a34..3e3b7c8e69b 100644 --- a/packages/opentelemetry-context-async-hooks/package.json +++ b/packages/opentelemetry-context-async-hooks/package.json @@ -40,7 +40,7 @@ "access": "public" }, "devDependencies": { - "@opentelemetry/api": "^0.20.0", + "@opentelemetry/api": "^0.21.0", "@types/mocha": "8.2.2", "@types/node": "14.14.43", "@types/shimmer": "1.0.1", @@ -53,6 +53,6 @@ "typescript": "4.3.2" }, "peerDependencies": { - "@opentelemetry/api": "^0.20.0" + "@opentelemetry/api": "^0.21.0" } } diff --git a/packages/opentelemetry-context-async-hooks/src/AbstractAsyncHooksContextManager.ts b/packages/opentelemetry-context-async-hooks/src/AbstractAsyncHooksContextManager.ts index 0f540b62bb8..0e9600b2c93 100644 --- a/packages/opentelemetry-context-async-hooks/src/AbstractAsyncHooksContextManager.ts +++ b/packages/opentelemetry-context-async-hooks/src/AbstractAsyncHooksContextManager.ts @@ -51,7 +51,13 @@ export abstract class AbstractAsyncHooksContextManager abstract disable(): this; - bind(target: T, context: Context = this.active()): T { + /** + * Binds a the certain context or the active one to the target function and then returns the target + * @param context A context (span) to be bind to target + * @param target a function or event emitter. When target or one of its callbacks is called, + * the provided context will be used as the active context for the duration of the call. + */ + bind(context: Context, target: T): T { if (target instanceof EventEmitter) { return this._bindEventEmitter(target, context); } @@ -180,7 +186,7 @@ export abstract class AbstractAsyncHooksContextManager listeners = new WeakMap(); map[event] = listeners; } - const patchedListener = contextManager.bind(listener, context); + const patchedListener = contextManager.bind(context, listener); // store a weak reference of the user listener to ours listeners.set(listener, patchedListener); return original.call(this, event, patchedListener); diff --git a/packages/opentelemetry-context-async-hooks/test/AsyncHooksContextManager.test.ts b/packages/opentelemetry-context-async-hooks/test/AsyncHooksContextManager.test.ts index ba0a169e915..762096c800c 100644 --- a/packages/opentelemetry-context-async-hooks/test/AsyncHooksContextManager.test.ts +++ b/packages/opentelemetry-context-async-hooks/test/AsyncHooksContextManager.test.ts @@ -299,26 +299,26 @@ for (const contextManagerClass of [ describe('.bind(function)', () => { it('should return the same target (when enabled)', () => { const test = { a: 1 }; - assert.deepStrictEqual(contextManager.bind(test, ROOT_CONTEXT), test); + assert.deepStrictEqual(contextManager.bind(ROOT_CONTEXT, test), test); }); it('should return the same target (when disabled)', () => { contextManager.disable(); const test = { a: 1 }; - assert.deepStrictEqual(contextManager.bind(test, ROOT_CONTEXT), test); + assert.deepStrictEqual(contextManager.bind(ROOT_CONTEXT, test), test); contextManager.enable(); }); it('should return current context (when enabled)', done => { const context = ROOT_CONTEXT.setValue(key1, 1); - const fn = contextManager.bind(() => { + const fn = contextManager.bind(context, () => { assert.strictEqual( contextManager.active(), context, 'should have context' ); return done(); - }, context); + }); fn(); }); @@ -329,20 +329,20 @@ for (const contextManagerClass of [ it('should return current context (when disabled)', done => { contextManager.disable(); const context = ROOT_CONTEXT.setValue(key1, 1); - const fn = contextManager.bind(() => { + const fn = contextManager.bind(context, () => { assert.strictEqual( contextManager.active(), context, 'should have context' ); return done(); - }, context); + }); fn(); }); it('should fail to return current context with async op', done => { const context = ROOT_CONTEXT.setValue(key1, 1); - const fn = contextManager.bind(() => { + const fn = contextManager.bind(context, () => { assert.strictEqual(contextManager.active(), context); setTimeout(() => { assert.strictEqual( @@ -352,7 +352,7 @@ for (const contextManagerClass of [ ); return done(); }, 100); - }, context); + }); fn(); }); @@ -363,12 +363,11 @@ for (const contextManagerClass of [ const context = ROOT_CONTEXT.setValue(key1, 2); const otherContext = ROOT_CONTEXT.setValue(key1, 3); const fn = otherContextManager.bind( - contextManager.bind(() => { + otherContext, + contextManager.bind(context, () => { assert.strictEqual(contextManager.active(), context); assert.strictEqual(otherContextManager.active(), otherContext); - }, context), - otherContext - ); + })); fn(); }); }); @@ -376,19 +375,19 @@ for (const contextManagerClass of [ describe('.bind(event-emitter)', () => { it('should return the same target (when enabled)', () => { const ee = new EventEmitter(); - assert.deepStrictEqual(contextManager.bind(ee, ROOT_CONTEXT), ee); + assert.deepStrictEqual(contextManager.bind(ROOT_CONTEXT, ee), ee); }); it('should return the same target (when disabled)', () => { const ee = new EventEmitter(); contextManager.disable(); - assert.deepStrictEqual(contextManager.bind(ee, ROOT_CONTEXT), ee); + assert.deepStrictEqual(contextManager.bind(ROOT_CONTEXT, ee), ee); }); it('should return current context and removeListener (when enabled)', done => { const ee = new EventEmitter(); const context = ROOT_CONTEXT.setValue(key1, 1); - const patchedEE = contextManager.bind(ee, context); + const patchedEE = contextManager.bind(context, ee); const handler = () => { assert.deepStrictEqual(contextManager.active(), context); patchedEE.removeListener('test', handler); @@ -403,7 +402,7 @@ for (const contextManagerClass of [ it('should return current context and removeAllListener (when enabled)', done => { const ee = new EventEmitter(); const context = ROOT_CONTEXT.setValue(key1, 1); - const patchedEE = contextManager.bind(ee, context); + const patchedEE = contextManager.bind(context, ee); const handler = () => { assert.deepStrictEqual(contextManager.active(), context); patchedEE.removeAllListeners('test'); @@ -418,7 +417,7 @@ for (const contextManagerClass of [ it('should return current context and removeAllListeners (when enabled)', done => { const ee = new EventEmitter(); const context = ROOT_CONTEXT.setValue(key1, 1); - const patchedEE = contextManager.bind(ee, context); + const patchedEE = contextManager.bind(context, ee); const handler = () => { assert.deepStrictEqual(contextManager.active(), context); patchedEE.removeAllListeners(); @@ -441,7 +440,7 @@ for (const contextManagerClass of [ contextManager.disable(); const ee = new EventEmitter(); const context = ROOT_CONTEXT.setValue(key1, 1); - const patchedEE = contextManager.bind(ee, context); + const patchedEE = contextManager.bind(context, ee); const handler = () => { assert.deepStrictEqual(contextManager.active(), context); patchedEE.removeListener('test', handler); @@ -456,7 +455,7 @@ for (const contextManagerClass of [ it('should not return current context with async op', done => { const ee = new EventEmitter(); const context = ROOT_CONTEXT.setValue(key1, 1); - const patchedEE = contextManager.bind(ee, context); + const patchedEE = contextManager.bind(context, ee); const handler = () => { assert.deepStrictEqual(contextManager.active(), context); setImmediate(() => { @@ -479,8 +478,8 @@ for (const contextManagerClass of [ const context = ROOT_CONTEXT.setValue(key1, 2); const otherContext = ROOT_CONTEXT.setValue(key1, 3); const patchedEE = otherContextManager.bind( - contextManager.bind(ee, context), - otherContext + otherContext, + contextManager.bind(context, ee), ); const handler = () => { assert.strictEqual(contextManager.active(), context); diff --git a/packages/opentelemetry-context-zone-peer-dep/package.json b/packages/opentelemetry-context-zone-peer-dep/package.json index 4ea6f0bf2df..3319dcdd575 100644 --- a/packages/opentelemetry-context-zone-peer-dep/package.json +++ b/packages/opentelemetry-context-zone-peer-dep/package.json @@ -46,7 +46,7 @@ }, "devDependencies": { "@babel/core": "7.14.0", - "@opentelemetry/api": "^0.20.0", + "@opentelemetry/api": "^0.21.0", "@types/mocha": "8.2.2", "@types/node": "14.14.43", "@types/sinon": "9.0.11", @@ -74,7 +74,7 @@ "zone.js": "0.11.4" }, "peerDependencies": { - "@opentelemetry/api": "^0.20.0", + "@opentelemetry/api": "^0.21.0", "zone.js": "^0.10.2 || ^0.11.0" }, "sideEffects": false diff --git a/packages/opentelemetry-context-zone-peer-dep/src/ZoneContextManager.ts b/packages/opentelemetry-context-zone-peer-dep/src/ZoneContextManager.ts index edd5a0719e5..4ff0a9b30bf 100644 --- a/packages/opentelemetry-context-zone-peer-dep/src/ZoneContextManager.ts +++ b/packages/opentelemetry-context-zone-peer-dep/src/ZoneContextManager.ts @@ -153,7 +153,7 @@ export class ZoneContextManager implements ContextManager { listeners = new WeakMap(); target.__ot_listeners[event] = listeners; } - const patchedListener = contextManager.bind(listener, context); + const patchedListener = contextManager.bind(context, listener); // store a weak reference of the user listener to ours listeners.set(listener, patchedListener); return original.call(this, event, patchedListener, opts); @@ -202,10 +202,11 @@ export class ZoneContextManager implements ContextManager { /** * Binds a the certain context or the active one to the target function and then returns the target - * @param target * @param context A context (span) to be bind to target + * @param target a function or event emitter. When target or one of its callbacks is called, + * the provided context will be used as the active context for the duration of the call. */ - bind(target: T | TargetWithEvents, context: Context): T { + bind(context: Context, target: T | TargetWithEvents): T { // if no specific context to propagate is given, we use the current one if (context === undefined) { context = this.active(); diff --git a/packages/opentelemetry-context-zone-peer-dep/test/ZoneContextManager.test.ts b/packages/opentelemetry-context-zone-peer-dep/test/ZoneContextManager.test.ts index 43aba94e175..d612d4ca6b4 100644 --- a/packages/opentelemetry-context-zone-peer-dep/test/ZoneContextManager.test.ts +++ b/packages/opentelemetry-context-zone-peer-dep/test/ZoneContextManager.test.ts @@ -251,46 +251,48 @@ describe('ZoneContextManager', () => { const ctx = ROOT_CONTEXT.setValue(key1, obj1); obj1.title = 'a2'; const obj2 = new Obj('b1'); - const wrapper: any = contextManager.bind(obj2.getTitle, ctx); + const wrapper: any = contextManager.bind(ctx, obj2.getTitle); assert.ok(wrapper(), 'a2'); }); it('should return the same target (when enabled)', () => { const test = { a: 1 }; - assert.deepStrictEqual(contextManager.bind(test, ROOT_CONTEXT), test); + assert.deepStrictEqual(contextManager.bind(ROOT_CONTEXT, test), test); }); it('should return the same target (when disabled)', () => { contextManager.disable(); const test = { a: 1 }; - assert.deepStrictEqual(contextManager.bind(test, ROOT_CONTEXT), test); + assert.deepStrictEqual(contextManager.bind(ROOT_CONTEXT, test), test); contextManager.enable(); }); it('should return current context (when enabled)', done => { const context = ROOT_CONTEXT.setValue(key1, { a: 1 }); - const fn: any = contextManager.bind(() => { + const fn: any = contextManager.bind( + context, + () => { assert.strictEqual( contextManager.active(), context, 'should have context' ); return done(); - }, context); + }); fn(); }); it('should return root context (when disabled)', done => { contextManager.disable(); const context = ROOT_CONTEXT.setValue(key1, { a: 1 }); - const fn: any = contextManager.bind(() => { + const fn: any = contextManager.bind(context, () => { assert.strictEqual( contextManager.active(), ROOT_CONTEXT, 'should have context' ); return done(); - }, context); + }); fn(); }); @@ -298,7 +300,7 @@ describe('ZoneContextManager', () => { const ctx1 = ROOT_CONTEXT.setValue(key1, 1); const element = document.createElement('div'); - contextManager.bind(element, ctx1); + contextManager.bind(ctx1, element); element.addEventListener('click', () => { assert.strictEqual(contextManager.active(), ctx1); @@ -322,7 +324,7 @@ describe('ZoneContextManager', () => { const ctx1 = ROOT_CONTEXT.setValue(key1, 1); const element = document.createElement('div'); - contextManager.bind(element, ctx1); + contextManager.bind(ctx1, element); element.addEventListener('click', () => { assert.strictEqual(contextManager.active(), ctx1); diff --git a/packages/opentelemetry-core/package.json b/packages/opentelemetry-core/package.json index 2a79a5861b6..221d6d6816e 100644 --- a/packages/opentelemetry-core/package.json +++ b/packages/opentelemetry-core/package.json @@ -55,7 +55,7 @@ "access": "public" }, "devDependencies": { - "@opentelemetry/api": "^0.20.0", + "@opentelemetry/api": "^0.21.0", "@types/mocha": "8.2.2", "@types/node": "14.14.43", "@types/semver": "7.3.5", @@ -80,7 +80,7 @@ "webpack": "4.46.0" }, "peerDependencies": { - "@opentelemetry/api": "^0.20.0" + "@opentelemetry/api": "^0.21.0" }, "dependencies": { "@opentelemetry/semantic-conventions": "0.20.0", diff --git a/packages/opentelemetry-exporter-collector-grpc/package.json b/packages/opentelemetry-exporter-collector-grpc/package.json index fd463f8ea9b..12cb1186e75 100644 --- a/packages/opentelemetry-exporter-collector-grpc/package.json +++ b/packages/opentelemetry-exporter-collector-grpc/package.json @@ -46,7 +46,7 @@ }, "devDependencies": { "@babel/core": "7.14.0", - "@opentelemetry/api": "^0.20.0", + "@opentelemetry/api": "^0.21.0", "@opentelemetry/api-metrics": "0.20.0", "@types/mocha": "8.2.2", "@types/node": "14.14.43", @@ -63,7 +63,7 @@ "typescript": "4.3.2" }, "peerDependencies": { - "@opentelemetry/api": "^0.20.0" + "@opentelemetry/api": "^0.21.0" }, "dependencies": { "@grpc/grpc-js": "^1.2.12", diff --git a/packages/opentelemetry-exporter-collector-proto/package.json b/packages/opentelemetry-exporter-collector-proto/package.json index 820a4b34f65..306e77cf438 100644 --- a/packages/opentelemetry-exporter-collector-proto/package.json +++ b/packages/opentelemetry-exporter-collector-proto/package.json @@ -46,7 +46,7 @@ }, "devDependencies": { "@babel/core": "7.14.0", - "@opentelemetry/api": "^0.20.0", + "@opentelemetry/api": "^0.21.0", "@opentelemetry/api-metrics": "0.20.0", "@types/mocha": "8.2.2", "@types/node": "14.14.43", @@ -63,7 +63,7 @@ "typescript": "4.3.2" }, "peerDependencies": { - "@opentelemetry/api": "^0.20.0" + "@opentelemetry/api": "^0.21.0" }, "dependencies": { "@grpc/proto-loader": "^0.6.0", diff --git a/packages/opentelemetry-exporter-collector/package.json b/packages/opentelemetry-exporter-collector/package.json index 4d0e1c6a742..cb4f5587ab0 100644 --- a/packages/opentelemetry-exporter-collector/package.json +++ b/packages/opentelemetry-exporter-collector/package.json @@ -54,7 +54,7 @@ }, "devDependencies": { "@babel/core": "7.14.0", - "@opentelemetry/api": "^0.20.0", + "@opentelemetry/api": "^0.21.0", "@types/mocha": "8.2.2", "@types/node": "14.14.43", "@types/sinon": "9.0.11", @@ -82,7 +82,7 @@ "webpack-merge": "5.7.3" }, "peerDependencies": { - "@opentelemetry/api": "^0.20.0" + "@opentelemetry/api": "^0.21.0" }, "dependencies": { "@opentelemetry/api-metrics": "0.20.0", diff --git a/packages/opentelemetry-exporter-jaeger/package.json b/packages/opentelemetry-exporter-jaeger/package.json index c0f55c19469..fa9c243f6e1 100644 --- a/packages/opentelemetry-exporter-jaeger/package.json +++ b/packages/opentelemetry-exporter-jaeger/package.json @@ -40,7 +40,7 @@ "access": "public" }, "devDependencies": { - "@opentelemetry/api": "^0.20.0", + "@opentelemetry/api": "^0.21.0", "@opentelemetry/resources": "0.20.0", "@types/mocha": "8.2.2", "@types/node": "14.14.43", @@ -56,7 +56,7 @@ "typescript": "4.3.2" }, "peerDependencies": { - "@opentelemetry/api": "^0.20.0" + "@opentelemetry/api": "^0.21.0" }, "dependencies": { "@opentelemetry/core": "0.20.0", diff --git a/packages/opentelemetry-exporter-prometheus/package.json b/packages/opentelemetry-exporter-prometheus/package.json index a2d516f3653..e9d43133b49 100644 --- a/packages/opentelemetry-exporter-prometheus/package.json +++ b/packages/opentelemetry-exporter-prometheus/package.json @@ -39,7 +39,7 @@ "access": "public" }, "devDependencies": { - "@opentelemetry/api": "^0.20.0", + "@opentelemetry/api": "^0.21.0", "@types/mocha": "8.2.2", "@types/node": "14.14.43", "@types/sinon": "9.0.11", @@ -53,7 +53,7 @@ "typescript": "4.3.2" }, "peerDependencies": { - "@opentelemetry/api": "^0.20.0" + "@opentelemetry/api": "^0.21.0" }, "dependencies": { "@opentelemetry/api-metrics": "0.20.0", diff --git a/packages/opentelemetry-exporter-prometheus/test/PrometheusSerializer.test.ts b/packages/opentelemetry-exporter-prometheus/test/PrometheusSerializer.test.ts index 07d240ff42d..289631da394 100644 --- a/packages/opentelemetry-exporter-prometheus/test/PrometheusSerializer.test.ts +++ b/packages/opentelemetry-exporter-prometheus/test/PrometheusSerializer.test.ts @@ -403,6 +403,7 @@ describe('PrometheusSerializer', () => { error: () => {}, }; diag.setLogger(dummyLogger, DiagLogLevel.ALL); + calledArgs = []; const serializer = new PrometheusSerializer(); const meter = new MeterProvider({ @@ -416,7 +417,7 @@ describe('PrometheusSerializer', () => { const result = serializer.serializeRecord(record.descriptor.name, record); assert.strictEqual(result, `test_total 1 ${mockedHrTimeMs}\n`); - assert.ok(calledArgs.length === 0); + assert.deepStrictEqual(calledArgs, []); }); }); diff --git a/packages/opentelemetry-exporter-zipkin/package.json b/packages/opentelemetry-exporter-zipkin/package.json index 5ee5b4aa07c..b7e0bb5d390 100644 --- a/packages/opentelemetry-exporter-zipkin/package.json +++ b/packages/opentelemetry-exporter-zipkin/package.json @@ -52,7 +52,7 @@ }, "devDependencies": { "@babel/core": "7.14.0", - "@opentelemetry/api": "^0.20.0", + "@opentelemetry/api": "^0.21.0", "@types/mocha": "8.2.2", "@types/node": "14.14.43", "@types/sinon": "9.0.11", @@ -80,7 +80,7 @@ "webpack-merge": "5.7.3" }, "peerDependencies": { - "@opentelemetry/api": "^0.20.0" + "@opentelemetry/api": "^0.21.0" }, "dependencies": { "@opentelemetry/core": "0.20.0", diff --git a/packages/opentelemetry-instrumentation-fetch/package.json b/packages/opentelemetry-instrumentation-fetch/package.json index 66201619a0d..c3f69fc50e8 100644 --- a/packages/opentelemetry-instrumentation-fetch/package.json +++ b/packages/opentelemetry-instrumentation-fetch/package.json @@ -47,7 +47,7 @@ }, "devDependencies": { "@babel/core": "7.14.0", - "@opentelemetry/api": "^0.20.0", + "@opentelemetry/api": "^0.21.0", "@opentelemetry/context-zone": "0.20.0", "@opentelemetry/propagator-b3": "0.20.0", "@opentelemetry/tracing": "0.20.0", @@ -78,7 +78,7 @@ "webpack-merge": "5.7.3" }, "peerDependencies": { - "@opentelemetry/api": "^0.20.0" + "@opentelemetry/api": "^0.21.0" }, "dependencies": { "@opentelemetry/core": "0.20.0", diff --git a/packages/opentelemetry-instrumentation-grpc/package.json b/packages/opentelemetry-instrumentation-grpc/package.json index a5c9b8302f0..47870ddab07 100644 --- a/packages/opentelemetry-instrumentation-grpc/package.json +++ b/packages/opentelemetry-instrumentation-grpc/package.json @@ -43,7 +43,7 @@ "devDependencies": { "@grpc/grpc-js": "1.3.0", "@grpc/proto-loader": "0.6.1", - "@opentelemetry/api": "^0.20.0", + "@opentelemetry/api": "^0.21.0", "@opentelemetry/context-async-hooks": "0.20.0", "@opentelemetry/core": "0.20.0", "@opentelemetry/node": "0.20.0", @@ -66,7 +66,7 @@ "typescript": "4.3.2" }, "peerDependencies": { - "@opentelemetry/api": "^0.20.0" + "@opentelemetry/api": "^0.21.0" }, "dependencies": { "@opentelemetry/api-metrics": "0.20.0", diff --git a/packages/opentelemetry-instrumentation-grpc/src/grpc-js/clientUtils.ts b/packages/opentelemetry-instrumentation-grpc/src/grpc-js/clientUtils.ts index 26906ad5b99..b2810cd1047 100644 --- a/packages/opentelemetry-instrumentation-grpc/src/grpc-js/clientUtils.ts +++ b/packages/opentelemetry-instrumentation-grpc/src/grpc-js/clientUtils.ts @@ -110,7 +110,7 @@ export function makeGrpcClientRemoteCall( span.end(); callback(err, res); }; - return context.bind(wrappedFn); + return context.bind(context.active(), wrappedFn); } return (span: Span) => { @@ -146,7 +146,7 @@ export function makeGrpcClientRemoteCall( spanEnded = true; } }; - context.bind(call); + context.bind(context.active(), call); call.on('error', (err: grpcJs.ServiceError) => { if (call[CALL_SPAN_ENDED]) { return; diff --git a/packages/opentelemetry-instrumentation-grpc/src/grpc-js/serverUtils.ts b/packages/opentelemetry-instrumentation-grpc/src/grpc-js/serverUtils.ts index 8fad49fd1b8..f30c892a989 100644 --- a/packages/opentelemetry-instrumentation-grpc/src/grpc-js/serverUtils.ts +++ b/packages/opentelemetry-instrumentation-grpc/src/grpc-js/serverUtils.ts @@ -56,7 +56,7 @@ function serverStreamAndBidiHandler( } }; - context.bind(call); + context.bind(context.active(), call); call.on('finish', () => { // @grpc/js does not expose a way to check if this call also emitted an error, // e.g. call.status.code !== 0 @@ -143,7 +143,7 @@ function clientStreamAndUnaryHandler( return callback(err, value); }; - context.bind(call); + context.bind(context.active(), call); return (original as Function).call({}, call, patchedCallback); } diff --git a/packages/opentelemetry-instrumentation-grpc/src/grpc/clientUtils.ts b/packages/opentelemetry-instrumentation-grpc/src/grpc/clientUtils.ts index 938533024c6..331e7443449 100644 --- a/packages/opentelemetry-instrumentation-grpc/src/grpc/clientUtils.ts +++ b/packages/opentelemetry-instrumentation-grpc/src/grpc/clientUtils.ts @@ -76,7 +76,7 @@ export const makeGrpcClientRemoteCall = function ( span.end(); callback(err, res); }; - return context.bind(wrappedFn); + return context.bind(context.active(), wrappedFn); } return (span: Span) => { @@ -118,7 +118,7 @@ export const makeGrpcClientRemoteCall = function ( spanEnded = true; } }; - context.bind(call); + context.bind(context.active(), call); ((call as unknown) as events.EventEmitter).on( 'error', (err: grpcTypes.ServiceError) => { diff --git a/packages/opentelemetry-instrumentation-grpc/src/grpc/serverUtils.ts b/packages/opentelemetry-instrumentation-grpc/src/grpc/serverUtils.ts index 36e26a15309..5d88eeabcc1 100644 --- a/packages/opentelemetry-instrumentation-grpc/src/grpc/serverUtils.ts +++ b/packages/opentelemetry-instrumentation-grpc/src/grpc/serverUtils.ts @@ -71,7 +71,7 @@ export const clientStreamAndUnaryHandler = function ( return callback(err, value, trailer, flags); } - context.bind(call); + context.bind(context.active(), call); return (original as Function).call(self, call, patchedCallback); }; @@ -89,7 +89,7 @@ export const serverStreamAndBidiHandler = function ( } }; - context.bind(call); + context.bind(context.active(), call); call.on('finish', () => { span.setStatus(_grpcStatusCodeToSpanStatus(call.status.code)); span.setAttribute( diff --git a/packages/opentelemetry-instrumentation-http/package.json b/packages/opentelemetry-instrumentation-http/package.json index a4e4d1be846..4badf91970b 100644 --- a/packages/opentelemetry-instrumentation-http/package.json +++ b/packages/opentelemetry-instrumentation-http/package.json @@ -41,7 +41,7 @@ "access": "public" }, "devDependencies": { - "@opentelemetry/api": "^0.20.0", + "@opentelemetry/api": "^0.21.0", "@opentelemetry/context-async-hooks": "0.20.0", "@opentelemetry/node": "0.20.0", "@opentelemetry/tracing": "0.20.0", @@ -68,7 +68,7 @@ "typescript": "4.3.2" }, "peerDependencies": { - "@opentelemetry/api": "^0.20.0" + "@opentelemetry/api": "^0.21.0" }, "dependencies": { "@opentelemetry/core": "0.20.0", diff --git a/packages/opentelemetry-instrumentation-http/src/http.ts b/packages/opentelemetry-instrumentation-http/src/http.ts index b3a2db9931f..cc50df76569 100644 --- a/packages/opentelemetry-instrumentation-http/src/http.ts +++ b/packages/opentelemetry-instrumentation-http/src/http.ts @@ -308,7 +308,7 @@ export class HttpInstrumentation extends InstrumentationBase { this._callResponseHook(span, response); } - context.bind(response); + context.bind(context.active(), response); diag.debug('outgoingRequest on response()'); response.on('end', () => { diag.debug('outgoingRequest on end()'); @@ -389,8 +389,8 @@ export class HttpInstrumentation extends InstrumentationBase { ) ) { return context.with(suppressTracing(context.active()), () => { - context.bind(request); - context.bind(response); + context.bind(context.active(), request); + context.bind(context.active(), response); return original.apply(this, [event, ...args]); }); } @@ -419,8 +419,8 @@ export class HttpInstrumentation extends InstrumentationBase { return context.with( setRPCMetadata(trace.setSpan(ctx, span), rpcMetadata), () => { - context.bind(request); - context.bind(response); + context.bind(context.active(), request); + context.bind(context.active(), response); if (instrumentation._getConfig().requestHook) { instrumentation._callRequestHook(span, request); @@ -556,7 +556,7 @@ export class HttpInstrumentation extends InstrumentationBase { */ const cb = args[args.length - 1]; if (typeof cb === 'function') { - args[args.length - 1] = context.bind(cb, parentContext); + args[args.length - 1] = context.bind(parentContext, cb); } const request: http.ClientRequest = safeExecuteInTheMiddle( @@ -571,7 +571,7 @@ export class HttpInstrumentation extends InstrumentationBase { ); diag.debug('%s instrumentation outgoingRequest', component); - context.bind(request, parentContext); + context.bind(parentContext, request); return instrumentation._traceClientRequest( component, request, diff --git a/packages/opentelemetry-instrumentation-xml-http-request/package.json b/packages/opentelemetry-instrumentation-xml-http-request/package.json index ed5648d9613..e773a8be147 100644 --- a/packages/opentelemetry-instrumentation-xml-http-request/package.json +++ b/packages/opentelemetry-instrumentation-xml-http-request/package.json @@ -47,7 +47,7 @@ }, "devDependencies": { "@babel/core": "7.14.0", - "@opentelemetry/api": "^0.20.0", + "@opentelemetry/api": "^0.21.0", "@opentelemetry/context-zone": "0.20.0", "@opentelemetry/propagator-b3": "0.20.0", "@opentelemetry/tracing": "0.20.0", @@ -77,7 +77,7 @@ "webpack-merge": "5.7.3" }, "peerDependencies": { - "@opentelemetry/api": "^0.20.0" + "@opentelemetry/api": "^0.21.0" }, "dependencies": { "@opentelemetry/core": "0.20.0", diff --git a/packages/opentelemetry-instrumentation/package.json b/packages/opentelemetry-instrumentation/package.json index 7beacbe4950..5a096870916 100644 --- a/packages/opentelemetry-instrumentation/package.json +++ b/packages/opentelemetry-instrumentation/package.json @@ -65,11 +65,11 @@ "shimmer": "^1.2.1" }, "peerDependencies": { - "@opentelemetry/api": "^0.20.0" + "@opentelemetry/api": "^0.21.0" }, "devDependencies": { "@babel/core": "7.14.0", - "@opentelemetry/api": "^0.20.0", + "@opentelemetry/api": "^0.21.0", "@types/mocha": "8.2.2", "@types/node": "14.14.43", "@types/semver": "7.3.5", diff --git a/packages/opentelemetry-metrics/package.json b/packages/opentelemetry-metrics/package.json index 84a32c98520..4d0e331389d 100644 --- a/packages/opentelemetry-metrics/package.json +++ b/packages/opentelemetry-metrics/package.json @@ -44,7 +44,7 @@ "access": "public" }, "devDependencies": { - "@opentelemetry/api": "^0.20.0", + "@opentelemetry/api": "^0.21.0", "@types/lodash.merge": "4.6.6", "@types/mocha": "8.2.2", "@types/node": "14.14.43", @@ -59,7 +59,7 @@ "typescript": "4.3.2" }, "peerDependencies": { - "@opentelemetry/api": "^0.20.0" + "@opentelemetry/api": "^0.21.0" }, "dependencies": { "@opentelemetry/api-metrics": "0.20.0", diff --git a/packages/opentelemetry-node/package.json b/packages/opentelemetry-node/package.json index 6fab0565d82..4b50c931ae7 100644 --- a/packages/opentelemetry-node/package.json +++ b/packages/opentelemetry-node/package.json @@ -41,7 +41,7 @@ "access": "public" }, "devDependencies": { - "@opentelemetry/api": "^0.20.0", + "@opentelemetry/api": "^0.21.0", "@opentelemetry/resources": "0.20.0", "@opentelemetry/semantic-conventions": "0.20.0", "@types/mocha": "8.2.2", @@ -60,7 +60,7 @@ "typescript": "4.3.2" }, "peerDependencies": { - "@opentelemetry/api": "^0.20.0" + "@opentelemetry/api": "^0.21.0" }, "dependencies": { "@opentelemetry/context-async-hooks": "0.20.0", diff --git a/packages/opentelemetry-node/test/NodeTracerProvider.test.ts b/packages/opentelemetry-node/test/NodeTracerProvider.test.ts index 4635fbf5594..7057965ab81 100644 --- a/packages/opentelemetry-node/test/NodeTracerProvider.test.ts +++ b/packages/opentelemetry-node/test/NodeTracerProvider.test.ts @@ -206,7 +206,7 @@ describe('NodeTracerProvider', () => { assert.deepStrictEqual(trace.getSpan(context.active()), span); return done(); }; - const patchedFn = context.bind(fn, trace.setSpan(context.active(), span)); + const patchedFn = context.bind(trace.setSpan(context.active(), span), fn); return patchedFn(); }); }); diff --git a/packages/opentelemetry-propagator-b3/package.json b/packages/opentelemetry-propagator-b3/package.json index aa90724168d..9f42dae43ba 100644 --- a/packages/opentelemetry-propagator-b3/package.json +++ b/packages/opentelemetry-propagator-b3/package.json @@ -46,10 +46,10 @@ "@opentelemetry/core": "0.20.0" }, "peerDependencies": { - "@opentelemetry/api": "^0.20.0" + "@opentelemetry/api": "^0.21.0" }, "devDependencies": { - "@opentelemetry/api": "^0.20.0", + "@opentelemetry/api": "^0.21.0", "@types/mocha": "8.2.2", "@types/node": "14.14.43", "codecov": "3.8.1", diff --git a/packages/opentelemetry-propagator-jaeger/package.json b/packages/opentelemetry-propagator-jaeger/package.json index 57c1e04c4c3..d292990ece4 100644 --- a/packages/opentelemetry-propagator-jaeger/package.json +++ b/packages/opentelemetry-propagator-jaeger/package.json @@ -47,7 +47,7 @@ "access": "public" }, "devDependencies": { - "@opentelemetry/api": "^0.20.0", + "@opentelemetry/api": "^0.21.0", "@types/mocha": "8.2.2", "@types/node": "14.14.43", "@types/sinon": "9.0.11", @@ -71,7 +71,7 @@ "webpack": "4.46.0" }, "peerDependencies": { - "@opentelemetry/api": "^0.20.0" + "@opentelemetry/api": "^0.21.0" }, "dependencies": { "@opentelemetry/core": "0.20.0" diff --git a/packages/opentelemetry-resource-detector-aws/package.json b/packages/opentelemetry-resource-detector-aws/package.json index 83cfafb79b0..7db91b831b1 100644 --- a/packages/opentelemetry-resource-detector-aws/package.json +++ b/packages/opentelemetry-resource-detector-aws/package.json @@ -39,7 +39,7 @@ "access": "public" }, "devDependencies": { - "@opentelemetry/api": "^0.20.0", + "@opentelemetry/api": "^0.21.0", "@types/mocha": "8.2.2", "@types/node": "14.14.43", "@types/sinon": "9.0.11", @@ -54,7 +54,7 @@ "typescript": "4.3.2" }, "peerDependencies": { - "@opentelemetry/api": "^0.20.0" + "@opentelemetry/api": "^0.21.0" }, "dependencies": { "@opentelemetry/core": "0.20.0", diff --git a/packages/opentelemetry-resource-detector-gcp/package.json b/packages/opentelemetry-resource-detector-gcp/package.json index b5b6c58f7af..b82e98560ff 100644 --- a/packages/opentelemetry-resource-detector-gcp/package.json +++ b/packages/opentelemetry-resource-detector-gcp/package.json @@ -39,7 +39,7 @@ "access": "public" }, "devDependencies": { - "@opentelemetry/api": "^0.20.0", + "@opentelemetry/api": "^0.21.0", "@opentelemetry/core": "0.20.0", "@types/mocha": "8.2.2", "@types/node": "14.14.43", @@ -54,7 +54,7 @@ "typescript": "4.3.2" }, "peerDependencies": { - "@opentelemetry/api": "^0.20.0" + "@opentelemetry/api": "^0.21.0" }, "dependencies": { "@opentelemetry/resources": "0.20.0", diff --git a/packages/opentelemetry-resources/package.json b/packages/opentelemetry-resources/package.json index 44c48c99442..3dda0731970 100644 --- a/packages/opentelemetry-resources/package.json +++ b/packages/opentelemetry-resources/package.json @@ -48,7 +48,7 @@ "access": "public" }, "devDependencies": { - "@opentelemetry/api": "^0.20.0", + "@opentelemetry/api": "^0.21.0", "@types/mocha": "8.2.2", "@types/node": "14.14.43", "@types/sinon": "9.0.11", @@ -63,7 +63,7 @@ "typescript": "4.3.2" }, "peerDependencies": { - "@opentelemetry/api": "^0.20.0" + "@opentelemetry/api": "^0.21.0" }, "dependencies": { "@opentelemetry/core": "0.20.0", diff --git a/packages/opentelemetry-sdk-node/package.json b/packages/opentelemetry-sdk-node/package.json index 363989d6052..157f9158c2e 100644 --- a/packages/opentelemetry-sdk-node/package.json +++ b/packages/opentelemetry-sdk-node/package.json @@ -51,10 +51,10 @@ "@opentelemetry/tracing": "0.20.0" }, "peerDependencies": { - "@opentelemetry/api": "^0.20.0" + "@opentelemetry/api": "^0.21.0" }, "devDependencies": { - "@opentelemetry/api": "^0.20.0", + "@opentelemetry/api": "^0.21.0", "@opentelemetry/context-async-hooks": "0.20.0", "@types/mocha": "8.2.2", "@types/node": "14.14.43", diff --git a/packages/opentelemetry-shim-opentracing/package.json b/packages/opentelemetry-shim-opentracing/package.json index 2f3c7fb8818..7680158995b 100644 --- a/packages/opentelemetry-shim-opentracing/package.json +++ b/packages/opentelemetry-shim-opentracing/package.json @@ -38,7 +38,7 @@ "access": "public" }, "devDependencies": { - "@opentelemetry/api": "^0.20.0", + "@opentelemetry/api": "^0.21.0", "@opentelemetry/tracing": "0.20.0", "@opentelemetry/propagator-b3": "0.20.0", "@opentelemetry/propagator-jaeger": "0.20.0", @@ -55,7 +55,7 @@ "typescript": "4.3.2" }, "peerDependencies": { - "@opentelemetry/api": "^0.20.0" + "@opentelemetry/api": "^0.21.0" }, "dependencies": { "@opentelemetry/core": "0.20.0", diff --git a/packages/opentelemetry-tracing/package.json b/packages/opentelemetry-tracing/package.json index 713dd00f552..f0ee2493526 100644 --- a/packages/opentelemetry-tracing/package.json +++ b/packages/opentelemetry-tracing/package.json @@ -53,7 +53,7 @@ "access": "public" }, "devDependencies": { - "@opentelemetry/api": "^0.20.0", + "@opentelemetry/api": "^0.21.0", "@types/lodash.merge": "4.6.6", "@types/mocha": "8.2.2", "@types/node": "14.14.43", @@ -78,7 +78,7 @@ "webpack": "4.46.0" }, "peerDependencies": { - "@opentelemetry/api": "^0.20.0" + "@opentelemetry/api": "^0.21.0" }, "dependencies": { "@opentelemetry/core": "0.20.0", diff --git a/packages/opentelemetry-tracing/test/BasicTracerProvider.test.ts b/packages/opentelemetry-tracing/test/BasicTracerProvider.test.ts index 43432fcb056..261d81b6e94 100644 --- a/packages/opentelemetry-tracing/test/BasicTracerProvider.test.ts +++ b/packages/opentelemetry-tracing/test/BasicTracerProvider.test.ts @@ -505,7 +505,7 @@ describe('BasicTracerProvider', () => { assert.deepStrictEqual(trace.getSpan(context.active()), undefined); return done(); }; - const patchedFn = context.bind(fn, trace.setSpan(context.active(), span)); + const patchedFn = context.bind(trace.setSpan(context.active(), span), fn); return patchedFn(); }); }); diff --git a/packages/opentelemetry-tracing/test/export/TestStackContextManager.ts b/packages/opentelemetry-tracing/test/export/TestStackContextManager.ts index 5196c86d79e..3413a4aa1ed 100644 --- a/packages/opentelemetry-tracing/test/export/TestStackContextManager.ts +++ b/packages/opentelemetry-tracing/test/export/TestStackContextManager.ts @@ -43,7 +43,7 @@ export class TestStackContextManager implements ContextManager { } } - bind(target: T, context?: Context): T { + bind(context: Context, target: T): T { throw new Error('Method not implemented.'); } diff --git a/packages/opentelemetry-web/package.json b/packages/opentelemetry-web/package.json index 40a90165401..b9004380416 100644 --- a/packages/opentelemetry-web/package.json +++ b/packages/opentelemetry-web/package.json @@ -46,7 +46,7 @@ }, "devDependencies": { "@babel/core": "7.14.0", - "@opentelemetry/api": "^0.20.0", + "@opentelemetry/api": "^0.21.0", "@opentelemetry/context-zone": "0.20.0", "@opentelemetry/propagator-b3": "0.20.0", "@opentelemetry/resources": "0.20.0", @@ -78,7 +78,7 @@ "webpack-merge": "5.7.3" }, "peerDependencies": { - "@opentelemetry/api": "^0.20.0" + "@opentelemetry/api": "^0.21.0" }, "dependencies": { "@opentelemetry/core": "0.20.0", diff --git a/packages/opentelemetry-web/src/StackContextManager.ts b/packages/opentelemetry-web/src/StackContextManager.ts index 0c87d6e7c60..c293be88336 100644 --- a/packages/opentelemetry-web/src/StackContextManager.ts +++ b/packages/opentelemetry-web/src/StackContextManager.ts @@ -62,10 +62,11 @@ export class StackContextManager implements ContextManager { /** * Binds a the certain context or the active one to the target function and then returns the target - * @param target - * @param context + * @param context A context (span) to be bind to target + * @param target a function or event emitter. When target or one of its callbacks is called, + * the provided context will be used as the active context for the duration of the call. */ - bind(target: T, context = ROOT_CONTEXT): T { + bind(context: Context, target: T): T { // if no specific context to propagate is given, we use the current one if (context === undefined) { context = this.active(); diff --git a/packages/opentelemetry-web/test/StackContextManager.test.ts b/packages/opentelemetry-web/test/StackContextManager.test.ts index 2753260b866..1509780e7ba 100644 --- a/packages/opentelemetry-web/test/StackContextManager.test.ts +++ b/packages/opentelemetry-web/test/StackContextManager.test.ts @@ -176,46 +176,46 @@ describe('StackContextManager', () => { const ctx = ROOT_CONTEXT.setValue(key1, obj1); obj1.title = 'a2'; const obj2 = new Obj('b1'); - const wrapper: any = contextManager.bind(obj2.getTitle, ctx); + const wrapper: any = contextManager.bind(ctx, obj2.getTitle); assert.ok(wrapper(), 'a2'); }); it('should return the same target (when enabled)', () => { const test = ROOT_CONTEXT.setValue(key1, 1); - assert.deepStrictEqual(contextManager.bind(test), test); + assert.deepStrictEqual(contextManager.bind(contextManager.active(), test), test); }); it('should return the same target (when disabled)', () => { contextManager.disable(); const test = ROOT_CONTEXT.setValue(key1, 1); - assert.deepStrictEqual(contextManager.bind(test), test); + assert.deepStrictEqual(contextManager.bind(contextManager.active(), test), test); contextManager.enable(); }); it('should return current context (when enabled)', done => { const context = ROOT_CONTEXT.setValue(key1, 1); - const fn: any = contextManager.bind(() => { + const fn: any = contextManager.bind(context, () => { assert.strictEqual( contextManager.active(), context, 'should have context' ); return done(); - }, context); + }); fn(); }); it('should return current context (when disabled)', done => { contextManager.disable(); const context = ROOT_CONTEXT.setValue(key1, 1); - const fn: any = contextManager.bind(() => { + const fn: any = contextManager.bind(context, () => { assert.strictEqual( contextManager.active(), context, 'should have context' ); return done(); - }, context); + }); fn(); }); });