@opentelemetry/sdk-node 0.38.0 → 0.39.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -6,6 +6,7 @@ export declare class TracerProviderWithEnvExporters extends NodeTracerProvider {
6
6
  private _hasSpanProcessors;
7
7
  static configureOtlp(): SpanExporter;
8
8
  static getOtlpProtocol(): string;
9
+ private static configureJaeger;
9
10
  protected static _registeredExporters: Map<string, () => SpanExporter>;
10
11
  constructor(config?: NodeTracerConfig);
11
12
  addSpanProcessor(spanProcessor: SpanProcessor): void;
@@ -25,7 +25,6 @@ const exporter_trace_otlp_proto_1 = require("@opentelemetry/exporter-trace-otlp-
25
25
  const exporter_trace_otlp_http_1 = require("@opentelemetry/exporter-trace-otlp-http");
26
26
  const exporter_trace_otlp_grpc_1 = require("@opentelemetry/exporter-trace-otlp-grpc");
27
27
  const exporter_zipkin_1 = require("@opentelemetry/exporter-zipkin");
28
- const exporter_jaeger_1 = require("@opentelemetry/exporter-jaeger");
29
28
  class TracerProviderWithEnvExporters extends sdk_trace_node_1.NodeTracerProvider {
30
29
  constructor(config = {}) {
31
30
  super(config);
@@ -81,6 +80,19 @@ class TracerProviderWithEnvExporters extends sdk_trace_node_1.NodeTracerProvider
81
80
  const parsedEnvValues = (0, core_1.getEnvWithoutDefaults)();
82
81
  return ((_d = (_c = (_b = parsedEnvValues.OTEL_EXPORTER_OTLP_TRACES_PROTOCOL) !== null && _b !== void 0 ? _b : parsedEnvValues.OTEL_EXPORTER_OTLP_PROTOCOL) !== null && _c !== void 0 ? _c : (0, core_1.getEnv)().OTEL_EXPORTER_OTLP_TRACES_PROTOCOL) !== null && _d !== void 0 ? _d : (0, core_1.getEnv)().OTEL_EXPORTER_OTLP_PROTOCOL);
83
82
  }
83
+ static configureJaeger() {
84
+ // The JaegerExporter does not support being required in bundled
85
+ // environments. By delaying the require statement to here, we only crash when
86
+ // the exporter is actually used in such an environment.
87
+ try {
88
+ // eslint-disable-next-line @typescript-eslint/no-var-requires
89
+ const { JaegerExporter } = require('@opentelemetry/exporter-jaeger');
90
+ return new JaegerExporter();
91
+ }
92
+ catch (e) {
93
+ throw new Error(`Could not instantiate JaegerExporter. This could be due to the JaegerExporter's lack of support for bundling. If possible, use @opentelemetry/exporter-trace-otlp-proto instead. Original Error: ${e}`);
94
+ }
95
+ }
84
96
  addSpanProcessor(spanProcessor) {
85
97
  super.addSpanProcessor(spanProcessor);
86
98
  this._hasSpanProcessors = true;
@@ -120,7 +132,7 @@ _a = TracerProviderWithEnvExporters;
120
132
  TracerProviderWithEnvExporters._registeredExporters = new Map([
121
133
  ['otlp', () => _a.configureOtlp()],
122
134
  ['zipkin', () => new exporter_zipkin_1.ZipkinExporter()],
123
- ['jaeger', () => new exporter_jaeger_1.JaegerExporter()],
135
+ ['jaeger', () => _a.configureJaeger()],
124
136
  ['console', () => new sdk_trace_base_1.ConsoleSpanExporter()],
125
137
  ]);
126
138
  //# sourceMappingURL=TracerProviderWithEnvExporter.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"TracerProviderWithEnvExporter.js","sourceRoot":"","sources":["../../src/TracerProviderWithEnvExporter.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;;;;AAEH,4CAA0C;AAC1C,8CAAoE;AACpE,kEAOuC;AACvC,kEAGuC;AACvC,wFAAuG;AACvG,sFAAqG;AACrG,sFAAqG;AACrG,oEAAgE;AAChE,oEAAgE;AAEhE,MAAa,8BAA+B,SAAQ,mCAAkB;IA4CpE,YAAmB,SAA2B,EAAE;QAC9C,KAAK,CAAC,MAAM,CAAC,CAAC;QA5CR,yBAAoB,GAAmB,EAAE,CAAC;QAE1C,uBAAkB,GAAY,KAAK,CAAC;QA2C1C,IAAI,kBAAkB,GAAG,IAAI,CAAC,oBAAoB,CAChD,KAAK,CAAC,IAAI,CAAC,IAAI,GAAG,CAAC,IAAA,aAAM,GAAE,CAAC,oBAAoB,CAAC,KAAK,CAAC,GAAG,CAAC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H,CAAC,CAAC,CAAC;IACL,CAAC;IAEO,uBAAuB,CAC7B,SAAyB;QAEzB,OAAO,SAAS,CAAC,GAAG,CAAC,QAAQ,CAAC,EAAE;YAC9B,IAAI,QAAQ,YAAY,oCAAmB,EAAE;gBAC3C,OAAO,IAAI,oCAAmB,CAAC,QAAQ,CAAC,CAAC;aAC1C;iBAAM;gBACL,OAAO,IAAI,mCAAkB,CAAC,QAAQ,CAAC,CAAC;aACzC;QACH,CAAC,CAAC,CAAC;IACL,CAAC;IAEO,oBAAoB,CAAC,IAAc;QACzC,OAAO,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,KAAK,MAAM,IAAI,CAAC,KAAK,EAAE,CAAC,CAAC;IAC7E,CAAC;;AAlIH,wEAmIC;;AAjG2B,mDAAoB,GAAG,IAAI,GAAG,CAGtD;IACA,CAAC,MAAM,EAAE,GAAG,EAAE,CAAC,EAAI,CAAC,aAAa,EAAE,CAAC;IACpC,CAAC,QAAQ,EAAE,GAAG,EAAE,CAAC,IAAI,gCAAc,EAAE,CAAC;IACtC,CAAC,QAAQ,EAAE,GAAG,EAAE,CAAC,IAAI,gCAAc,EAAE,CAAC;IACtC,CAAC,SAAS,EAAE,GAAG,EAAE,CAAC,IAAI,oCAAmB,EAAE,CAAC;CAC7C,CAAE,CAAA","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { diag } from '@opentelemetry/api';\nimport { getEnv, getEnvWithoutDefaults } from '@opentelemetry/core';\nimport {\n ConsoleSpanExporter,\n SpanExporter,\n BatchSpanProcessor,\n SimpleSpanProcessor,\n SDKRegistrationConfig,\n SpanProcessor,\n} from '@opentelemetry/sdk-trace-base';\nimport {\n NodeTracerConfig,\n NodeTracerProvider,\n} from '@opentelemetry/sdk-trace-node';\nimport { OTLPTraceExporter as OTLPProtoTraceExporter } from '@opentelemetry/exporter-trace-otlp-proto';\nimport { OTLPTraceExporter as OTLPHttpTraceExporter } from '@opentelemetry/exporter-trace-otlp-http';\nimport { OTLPTraceExporter as OTLPGrpcTraceExporter } from '@opentelemetry/exporter-trace-otlp-grpc';\nimport { ZipkinExporter } from '@opentelemetry/exporter-zipkin';\nimport { JaegerExporter } from '@opentelemetry/exporter-jaeger';\n\nexport class TracerProviderWithEnvExporters extends NodeTracerProvider {\n private _configuredExporters: SpanExporter[] = [];\n private _spanProcessors: SpanProcessor[] | undefined;\n private _hasSpanProcessors: boolean = false;\n\n static configureOtlp(): SpanExporter {\n const protocol = this.getOtlpProtocol();\n\n switch (protocol) {\n case 'grpc':\n return new OTLPGrpcTraceExporter();\n case 'http/json':\n return new OTLPHttpTraceExporter();\n case 'http/protobuf':\n return new OTLPProtoTraceExporter();\n default:\n diag.warn(\n `Unsupported OTLP traces protocol: ${protocol}. Using http/protobuf.`\n );\n return new OTLPProtoTraceExporter();\n }\n }\n\n static getOtlpProtocol(): string {\n const parsedEnvValues = getEnvWithoutDefaults();\n\n return (\n parsedEnvValues.OTEL_EXPORTER_OTLP_TRACES_PROTOCOL ??\n parsedEnvValues.OTEL_EXPORTER_OTLP_PROTOCOL ??\n getEnv().OTEL_EXPORTER_OTLP_TRACES_PROTOCOL ??\n getEnv().OTEL_EXPORTER_OTLP_PROTOCOL\n );\n }\n\n protected static override _registeredExporters = new Map<\n string,\n () => SpanExporter\n >([\n ['otlp', () => this.configureOtlp()],\n ['zipkin', () => new ZipkinExporter()],\n ['jaeger', () => new JaegerExporter()],\n ['console', () => new ConsoleSpanExporter()],\n ]);\n\n public constructor(config: NodeTracerConfig = {}) {\n super(config);\n let traceExportersList = this.filterBlanksAndNulls(\n Array.from(new Set(getEnv().OTEL_TRACES_EXPORTER.split(',')))\n );\n\n if (traceExportersList[0] === 'none') {\n diag.warn(\n 'OTEL_TRACES_EXPORTER contains \"none\". SDK will not be initialized.'\n );\n } else if (traceExportersList.length === 0) {\n diag.warn('OTEL_TRACES_EXPORTER is empty. Using default otlp exporter.');\n\n traceExportersList = ['otlp'];\n this.createExportersFromList(traceExportersList);\n\n this._spanProcessors = this.configureSpanProcessors(\n this._configuredExporters\n );\n this._spanProcessors.forEach(processor => {\n this.addSpanProcessor(processor);\n });\n } else {\n if (\n traceExportersList.length > 1 &&\n traceExportersList.includes('none')\n ) {\n diag.warn(\n 'OTEL_TRACES_EXPORTER contains \"none\" along with other exporters. Using default otlp exporter.'\n );\n traceExportersList = ['otlp'];\n }\n\n this.createExportersFromList(traceExportersList);\n\n if (this._configuredExporters.length > 0) {\n this._spanProcessors = this.configureSpanProcessors(\n this._configuredExporters\n );\n this._spanProcessors.forEach(processor => {\n this.addSpanProcessor(processor);\n });\n } else {\n diag.warn(\n 'Unable to set up trace exporter(s) due to invalid exporter and/or protocol values.'\n );\n }\n }\n }\n\n override addSpanProcessor(spanProcessor: SpanProcessor) {\n super.addSpanProcessor(spanProcessor);\n this._hasSpanProcessors = true;\n }\n\n override register(config?: SDKRegistrationConfig) {\n if (this._hasSpanProcessors) {\n super.register(config);\n }\n }\n\n private createExportersFromList(exporterList: string[]) {\n exporterList.forEach(exporterName => {\n const exporter = this._getSpanExporter(exporterName);\n if (exporter) {\n this._configuredExporters.push(exporter);\n } else {\n diag.warn(`Unrecognized OTEL_TRACES_EXPORTER value: ${exporterName}.`);\n }\n });\n }\n\n private configureSpanProcessors(\n exporters: SpanExporter[]\n ): (BatchSpanProcessor | SimpleSpanProcessor)[] {\n return exporters.map(exporter => {\n if (exporter instanceof ConsoleSpanExporter) {\n return new SimpleSpanProcessor(exporter);\n } else {\n return new BatchSpanProcessor(exporter);\n }\n });\n }\n\n private filterBlanksAndNulls(list: string[]): string[] {\n return list.map(item => item.trim()).filter(s => s !== 'null' && s !== '');\n }\n}\n"]}
1
+ {"version":3,"file":"TracerProviderWithEnvExporter.js","sourceRoot":"","sources":["../../src/TracerProviderWithEnvExporter.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;;;;AAEH,4CAA0C;AAC1C,8CAAoE;AACpE,kEAOuC;AACvC,kEAGuC;AACvC,wFAAuG;AACvG,sFAAqG;AACrG,sFAAqG;AACrG,oEAAgE;AAEhE,MAAa,8BAA+B,SAAQ,mCAAkB;IA2DpE,YAAmB,SAA2B,EAAE;QAC9C,KAAK,CAAC,MAAM,CAAC,CAAC;QA3DR,yBAAoB,GAAmB,EAAE,CAAC;QAE1C,uBAAkB,GAAY,KAAK,CAAC;QA0D1C,IAAI,kBAAkB,GAAG,IAAI,CAAC,oBAAoB,CAChD,KAAK,CAAC,IAAI,CAAC,IAAI,GAAG,CAAC,IAAA,aAAM,GAAE,CAAC,oBAAoB,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAC9D,CAAC;QAEF,IAAI,kBAAkB,CAAC,CAAC,CAAC,KAAK,MAAM,EAAE;YACpC,UAAI,CAAC,IAAI,CACP,oEAAoE,CACrE,CAAC;SACH;aAAM,IAAI,kBAAkB,CAAC,MAAM,KAAK,CAAC,EAAE;YAC1C,UAAI,CAAC,IAAI,CAAC,6DAA6D,CAAC,CAAC;YAEzE,kBAAkB,GAAG,CAAC,MAAM,CAAC,CAAC;YAC9B,IAAI,CAAC,uBAAuB,CAAC,kBAAkB,CAAC,CAAC;YAEjD,IAAI,CAAC,eAAe,GAAG,IAAI,CAAC,uBAAuB,CACjD,IAAI,CAAC,oBAAoB,CAC1B,CAAC;YACF,IAAI,CAAC,eAAe,CAAC,OAAO,CAAC,SAAS,CAAC,EAAE;gBACvC,IAAI,CAAC,gBAA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CAAC;aAC1C;iBAAM;gBACL,OAAO,IAAI,mCAAkB,CAAC,QAAQ,CAAC,CAAC;aACzC;QACH,CAAC,CAAC,CAAC;IACL,CAAC;IAEO,oBAAoB,CAAC,IAAc;QACzC,OAAO,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,KAAK,MAAM,IAAI,CAAC,KAAK,EAAE,CAAC,CAAC;IAC7E,CAAC;;AAjJH,wEAkJC;;AAjG2B,mDAAoB,GAAG,IAAI,GAAG,CAGtD;IACA,CAAC,MAAM,EAAE,GAAG,EAAE,CAAC,EAAI,CAAC,aAAa,EAAE,CAAC;IACpC,CAAC,QAAQ,EAAE,GAAG,EAAE,CAAC,IAAI,gCAAc,EAAE,CAAC;IACtC,CAAC,QAAQ,EAAE,GAAG,EAAE,CAAC,EAAI,CAAC,eAAe,EAAE,CAAC;IACxC,CAAC,SAAS,EAAE,GAAG,EAAE,CAAC,IAAI,oCAAmB,EAAE,CAAC;CAC7C,CAAE,CAAA","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { diag } from '@opentelemetry/api';\nimport { getEnv, getEnvWithoutDefaults } from '@opentelemetry/core';\nimport {\n ConsoleSpanExporter,\n SpanExporter,\n BatchSpanProcessor,\n SimpleSpanProcessor,\n SDKRegistrationConfig,\n SpanProcessor,\n} from '@opentelemetry/sdk-trace-base';\nimport {\n NodeTracerConfig,\n NodeTracerProvider,\n} from '@opentelemetry/sdk-trace-node';\nimport { OTLPTraceExporter as OTLPProtoTraceExporter } from '@opentelemetry/exporter-trace-otlp-proto';\nimport { OTLPTraceExporter as OTLPHttpTraceExporter } from '@opentelemetry/exporter-trace-otlp-http';\nimport { OTLPTraceExporter as OTLPGrpcTraceExporter } from '@opentelemetry/exporter-trace-otlp-grpc';\nimport { ZipkinExporter } from '@opentelemetry/exporter-zipkin';\n\nexport class TracerProviderWithEnvExporters extends NodeTracerProvider {\n private _configuredExporters: SpanExporter[] = [];\n private _spanProcessors: SpanProcessor[] | undefined;\n private _hasSpanProcessors: boolean = false;\n\n static configureOtlp(): SpanExporter {\n const protocol = this.getOtlpProtocol();\n\n switch (protocol) {\n case 'grpc':\n return new OTLPGrpcTraceExporter();\n case 'http/json':\n return new OTLPHttpTraceExporter();\n case 'http/protobuf':\n return new OTLPProtoTraceExporter();\n default:\n diag.warn(\n `Unsupported OTLP traces protocol: ${protocol}. Using http/protobuf.`\n );\n return new OTLPProtoTraceExporter();\n }\n }\n\n static getOtlpProtocol(): string {\n const parsedEnvValues = getEnvWithoutDefaults();\n\n return (\n parsedEnvValues.OTEL_EXPORTER_OTLP_TRACES_PROTOCOL ??\n parsedEnvValues.OTEL_EXPORTER_OTLP_PROTOCOL ??\n getEnv().OTEL_EXPORTER_OTLP_TRACES_PROTOCOL ??\n getEnv().OTEL_EXPORTER_OTLP_PROTOCOL\n );\n }\n\n private static configureJaeger() {\n // The JaegerExporter does not support being required in bundled\n // environments. By delaying the require statement to here, we only crash when\n // the exporter is actually used in such an environment.\n try {\n // eslint-disable-next-line @typescript-eslint/no-var-requires\n const { JaegerExporter } = require('@opentelemetry/exporter-jaeger');\n return new JaegerExporter();\n } catch (e) {\n throw new Error(\n `Could not instantiate JaegerExporter. This could be due to the JaegerExporter's lack of support for bundling. If possible, use @opentelemetry/exporter-trace-otlp-proto instead. Original Error: ${e}`\n );\n }\n }\n\n protected static override _registeredExporters = new Map<\n string,\n () => SpanExporter\n >([\n ['otlp', () => this.configureOtlp()],\n ['zipkin', () => new ZipkinExporter()],\n ['jaeger', () => this.configureJaeger()],\n ['console', () => new ConsoleSpanExporter()],\n ]);\n\n public constructor(config: NodeTracerConfig = {}) {\n super(config);\n let traceExportersList = this.filterBlanksAndNulls(\n Array.from(new Set(getEnv().OTEL_TRACES_EXPORTER.split(',')))\n );\n\n if (traceExportersList[0] === 'none') {\n diag.warn(\n 'OTEL_TRACES_EXPORTER contains \"none\". SDK will not be initialized.'\n );\n } else if (traceExportersList.length === 0) {\n diag.warn('OTEL_TRACES_EXPORTER is empty. Using default otlp exporter.');\n\n traceExportersList = ['otlp'];\n this.createExportersFromList(traceExportersList);\n\n this._spanProcessors = this.configureSpanProcessors(\n this._configuredExporters\n );\n this._spanProcessors.forEach(processor => {\n this.addSpanProcessor(processor);\n });\n } else {\n if (\n traceExportersList.length > 1 &&\n traceExportersList.includes('none')\n ) {\n diag.warn(\n 'OTEL_TRACES_EXPORTER contains \"none\" along with other exporters. Using default otlp exporter.'\n );\n traceExportersList = ['otlp'];\n }\n\n this.createExportersFromList(traceExportersList);\n\n if (this._configuredExporters.length > 0) {\n this._spanProcessors = this.configureSpanProcessors(\n this._configuredExporters\n );\n this._spanProcessors.forEach(processor => {\n this.addSpanProcessor(processor);\n });\n } else {\n diag.warn(\n 'Unable to set up trace exporter(s) due to invalid exporter and/or protocol values.'\n );\n }\n }\n }\n\n override addSpanProcessor(spanProcessor: SpanProcessor) {\n super.addSpanProcessor(spanProcessor);\n this._hasSpanProcessors = true;\n }\n\n override register(config?: SDKRegistrationConfig) {\n if (this._hasSpanProcessors) {\n super.register(config);\n }\n }\n\n private createExportersFromList(exporterList: string[]) {\n exporterList.forEach(exporterName => {\n const exporter = this._getSpanExporter(exporterName);\n if (exporter) {\n this._configuredExporters.push(exporter);\n } else {\n diag.warn(`Unrecognized OTEL_TRACES_EXPORTER value: ${exporterName}.`);\n }\n });\n }\n\n private configureSpanProcessors(\n exporters: SpanExporter[]\n ): (BatchSpanProcessor | SimpleSpanProcessor)[] {\n return exporters.map(exporter => {\n if (exporter instanceof ConsoleSpanExporter) {\n return new SimpleSpanProcessor(exporter);\n } else {\n return new BatchSpanProcessor(exporter);\n }\n });\n }\n\n private filterBlanksAndNulls(list: string[]): string[] {\n return list.map(item => item.trim()).filter(s => s !== 'null' && s !== '');\n }\n}\n"]}
@@ -1,2 +1,2 @@
1
- export declare const VERSION = "0.38.0";
1
+ export declare const VERSION = "0.39.0";
2
2
  //# sourceMappingURL=version.d.ts.map
@@ -17,5 +17,5 @@
17
17
  Object.defineProperty(exports, "__esModule", { value: true });
18
18
  exports.VERSION = void 0;
19
19
  // this is autogenerated file, see scripts/version-update.js
20
- exports.VERSION = '0.38.0';
20
+ exports.VERSION = '0.39.0';
21
21
  //# sourceMappingURL=version.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"version.js","sourceRoot":"","sources":["../../src/version.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;;;AAEH,4DAA4D;AAC/C,QAAA,OAAO,GAAG,QAAQ,CAAC","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n// this is autogenerated file, see scripts/version-update.js\nexport const VERSION = '0.38.0';\n"]}
1
+ {"version":3,"file":"version.js","sourceRoot":"","sources":["../../src/version.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;;;AAEH,4DAA4D;AAC/C,QAAA,OAAO,GAAG,QAAQ,CAAC","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n// this is autogenerated file, see scripts/version-update.js\nexport const VERSION = '0.39.0';\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@opentelemetry/sdk-node",
3
- "version": "0.38.0",
3
+ "version": "0.39.0",
4
4
  "description": "OpenTelemetry SDK for Node.js",
5
5
  "main": "build/src/index.js",
6
6
  "types": "build/src/index.d.ts",
@@ -44,25 +44,25 @@
44
44
  "access": "public"
45
45
  },
46
46
  "dependencies": {
47
- "@opentelemetry/core": "1.12.0",
48
- "@opentelemetry/exporter-jaeger": "1.12.0",
49
- "@opentelemetry/exporter-trace-otlp-grpc": "0.38.0",
50
- "@opentelemetry/exporter-trace-otlp-http": "0.38.0",
51
- "@opentelemetry/exporter-trace-otlp-proto": "0.38.0",
52
- "@opentelemetry/exporter-zipkin": "1.12.0",
53
- "@opentelemetry/instrumentation": "0.38.0",
54
- "@opentelemetry/resources": "1.12.0",
55
- "@opentelemetry/sdk-metrics": "1.12.0",
56
- "@opentelemetry/sdk-trace-base": "1.12.0",
57
- "@opentelemetry/sdk-trace-node": "1.12.0",
58
- "@opentelemetry/semantic-conventions": "1.12.0"
47
+ "@opentelemetry/core": "1.13.0",
48
+ "@opentelemetry/exporter-jaeger": "1.13.0",
49
+ "@opentelemetry/exporter-trace-otlp-grpc": "0.39.0",
50
+ "@opentelemetry/exporter-trace-otlp-http": "0.39.0",
51
+ "@opentelemetry/exporter-trace-otlp-proto": "0.39.0",
52
+ "@opentelemetry/exporter-zipkin": "1.13.0",
53
+ "@opentelemetry/instrumentation": "0.39.0",
54
+ "@opentelemetry/resources": "1.13.0",
55
+ "@opentelemetry/sdk-metrics": "1.13.0",
56
+ "@opentelemetry/sdk-trace-base": "1.13.0",
57
+ "@opentelemetry/sdk-trace-node": "1.13.0",
58
+ "@opentelemetry/semantic-conventions": "1.13.0"
59
59
  },
60
60
  "peerDependencies": {
61
61
  "@opentelemetry/api": ">=1.3.0 <1.5.0"
62
62
  },
63
63
  "devDependencies": {
64
64
  "@opentelemetry/api": "1.4.1",
65
- "@opentelemetry/context-async-hooks": "1.12.0",
65
+ "@opentelemetry/context-async-hooks": "1.13.0",
66
66
  "@types/mocha": "10.0.0",
67
67
  "@types/node": "18.6.5",
68
68
  "@types/semver": "7.3.9",
@@ -79,5 +79,5 @@
79
79
  },
80
80
  "homepage": "https://github.com/open-telemetry/opentelemetry-js/tree/main/experimental/packages/opentelemetry-sdk-node",
81
81
  "sideEffects": false,
82
- "gitHead": "a04090010ee18e17487b449984807cc2b7b6e3e6"
82
+ "gitHead": "8fc76896595aac912bf9e15d4f19c167317844c8"
83
83
  }