@opentelemetry/sdk-node 0.57.1 → 0.200.0-dev.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.
package/README.md CHANGED
@@ -88,7 +88,7 @@ Detect resources automatically from the environment using the default resource d
88
88
 
89
89
  ### contextManager
90
90
 
91
- Use a custom context manager. Default: [AsyncHooksContextManager](../../../packages/opentelemetry-context-async-hooks/README.md)
91
+ Use a custom context manager. Default: [AsyncLocalStorageContextManager](../../../packages/opentelemetry-context-async-hooks/README.md)
92
92
 
93
93
  ### textMapPropagator
94
94
 
@@ -1,18 +1,18 @@
1
1
  import { LogRecordProcessor } from '@opentelemetry/sdk-logs';
2
- import { MetricReader, View } from '@opentelemetry/sdk-metrics';
2
+ import { IMetricReader, ViewOptions } from '@opentelemetry/sdk-metrics';
3
3
  import { NodeSDKConfiguration } from './types';
4
4
  /** This class represents everything needed to register a fully configured OpenTelemetry Node.js SDK */
5
- export declare type MeterProviderConfig = {
5
+ export type MeterProviderConfig = {
6
6
  /**
7
7
  * Reference to the MetricReader instance by the NodeSDK
8
8
  */
9
- reader?: MetricReader;
9
+ reader?: IMetricReader;
10
10
  /**
11
- * List of {@link View}s that should be passed to the MeterProvider
11
+ * List of {@link ViewOptions}s that should be passed to the MeterProvider
12
12
  */
13
- views?: View[];
13
+ views?: ViewOptions[];
14
14
  };
15
- export declare type LoggerProviderConfig = {
15
+ export type LoggerProviderConfig = {
16
16
  /**
17
17
  * Reference to the LoggerRecordProcessor instance by the NodeSDK
18
18
  */
@@ -25,7 +25,6 @@ export declare class NodeSDK {
25
25
  private _instrumentations;
26
26
  private _resource;
27
27
  private _resourceDetectors;
28
- private _mergeResourceWithDefaults;
29
28
  private _autoDetectResources;
30
29
  private _tracerProvider?;
31
30
  private _loggerProvider?;
package/build/src/sdk.js CHANGED
@@ -45,25 +45,23 @@ function getValueInMillis(envName, defaultValue) {
45
45
  * @returns MetricReader[] if appropriate environment variables are configured
46
46
  */
47
47
  function configureMetricProviderFromEnv() {
48
- var _a;
49
48
  const metricReaders = [];
50
- const metricsExporterList = (_a = process.env.OTEL_METRICS_EXPORTER) === null || _a === void 0 ? void 0 : _a.trim();
49
+ const metricsExporterList = process.env.OTEL_METRICS_EXPORTER?.trim();
51
50
  if (!metricsExporterList) {
52
51
  return metricReaders;
53
52
  }
54
53
  const enabledExporters = (0, utils_1.filterBlanksAndNulls)(metricsExporterList.split(','));
55
54
  if (enabledExporters.length === 0) {
56
- api_1.diag.info('OTEL_METRICS_EXPORTER is empty. Using default otlp exporter.');
55
+ api_1.diag.debug('OTEL_METRICS_EXPORTER is empty. Using default otlp exporter.');
57
56
  }
58
57
  if (enabledExporters.includes('none')) {
59
58
  api_1.diag.info(`OTEL_METRICS_EXPORTER contains "none". Metric provider will not be initialized.`);
60
59
  return metricReaders;
61
60
  }
62
61
  enabledExporters.forEach(exporter => {
63
- var _a, _b;
64
62
  if (exporter === 'otlp') {
65
- const protocol = ((_a = process.env.OTEL_EXPORTER_OTLP_METRICS_PROTOCOL) === null || _a === void 0 ? void 0 : _a.trim()) ||
66
- ((_b = process.env.OTEL_EXPORTER_OTLP_PROTOCOL) === null || _b === void 0 ? void 0 : _b.trim());
63
+ const protocol = process.env.OTEL_EXPORTER_OTLP_METRICS_PROTOCOL?.trim() ||
64
+ process.env.OTEL_EXPORTER_OTLP_PROTOCOL?.trim();
67
65
  const exportIntervalMillis = getValueInMillis('OTEL_METRIC_EXPORT_INTERVAL', 60000);
68
66
  const exportTimeoutMillis = getValueInMillis('OTEL_METRIC_EXPORT_TIMEOUT', 30000);
69
67
  switch (protocol) {
@@ -112,30 +110,37 @@ function configureMetricProviderFromEnv() {
112
110
  return metricReaders;
113
111
  }
114
112
  class NodeSDK {
113
+ _tracerProviderConfig;
114
+ _loggerProviderConfig;
115
+ _meterProviderConfig;
116
+ _instrumentations;
117
+ _resource;
118
+ _resourceDetectors;
119
+ _autoDetectResources;
120
+ _tracerProvider;
121
+ _loggerProvider;
122
+ _meterProvider;
123
+ _serviceName;
124
+ _configuration;
125
+ _disabled;
115
126
  /**
116
127
  * Create a new NodeJS SDK instance
117
128
  */
118
129
  constructor(configuration = {}) {
119
- var _a, _b, _c, _d, _e, _f, _g;
120
- const env = (0, core_1.getEnv)();
121
- const envWithoutDefaults = (0, core_1.getEnvWithoutDefaults)();
122
- if (env.OTEL_SDK_DISABLED) {
130
+ if ((0, core_1.getBooleanFromEnv)('OTEL_SDK_DISABLED')) {
123
131
  this._disabled = true;
124
132
  // Functions with possible side-effects are set
125
133
  // to no-op via the _disabled flag
126
134
  }
127
- // Default is INFO, use environment without defaults to check
128
- // if the user originally set the environment variable.
129
- if (envWithoutDefaults.OTEL_LOG_LEVEL) {
135
+ const logLevel = (0, core_1.getStringFromEnv)('OTEL_LOG_LEVEL');
136
+ if (logLevel != null) {
130
137
  api_1.diag.setLogger(new api_1.DiagConsoleLogger(), {
131
- logLevel: envWithoutDefaults.OTEL_LOG_LEVEL,
138
+ logLevel: (0, core_1.diagLogLevelFromString)(logLevel),
132
139
  });
133
140
  }
134
141
  this._configuration = configuration;
135
- this._resource = (_a = configuration.resource) !== null && _a !== void 0 ? _a : new resources_1.Resource({});
136
- this._mergeResourceWithDefaults =
137
- (_b = configuration.mergeResourceWithDefaults) !== null && _b !== void 0 ? _b : true;
138
- this._autoDetectResources = (_c = configuration.autoDetectResources) !== null && _c !== void 0 ? _c : true;
142
+ this._resource = configuration.resource ?? (0, resources_1.defaultResource)();
143
+ this._autoDetectResources = configuration.autoDetectResources ?? true;
139
144
  if (!this._autoDetectResources) {
140
145
  this._resourceDetectors = [];
141
146
  }
@@ -166,10 +171,10 @@ class NodeSDK {
166
171
  if (configuration.spanProcessor) {
167
172
  api_1.diag.warn("The 'spanProcessor' option is deprecated. Please use 'spanProcessors' instead.");
168
173
  }
169
- const spanProcessor = (_d = configuration.spanProcessor) !== null && _d !== void 0 ? _d :
170
- // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
171
- new sdk_trace_base_1.BatchSpanProcessor(configuration.traceExporter);
172
- const spanProcessors = (_e = configuration.spanProcessors) !== null && _e !== void 0 ? _e : [spanProcessor];
174
+ const spanProcessor = configuration.spanProcessor ??
175
+ // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
176
+ new sdk_trace_base_1.BatchSpanProcessor(configuration.traceExporter);
177
+ const spanProcessors = configuration.spanProcessors ?? [spanProcessor];
173
178
  this._tracerProviderConfig = {
174
179
  tracerConfig: tracerProviderConfig,
175
180
  spanProcessors,
@@ -201,13 +206,12 @@ class NodeSDK {
201
206
  }
202
207
  this._meterProviderConfig = meterProviderConfig;
203
208
  }
204
- this._instrumentations = (_g = (_f = configuration.instrumentations) === null || _f === void 0 ? void 0 : _f.flat()) !== null && _g !== void 0 ? _g : [];
209
+ this._instrumentations = configuration.instrumentations?.flat() ?? [];
205
210
  }
206
211
  /**
207
212
  * Call this method to construct SDK components and register them with the OpenTelemetry API.
208
213
  */
209
214
  start() {
210
- var _a, _b, _c, _d, _e, _f, _g;
211
215
  if (this._disabled) {
212
216
  return;
213
217
  }
@@ -218,32 +222,35 @@ class NodeSDK {
218
222
  const internalConfig = {
219
223
  detectors: this._resourceDetectors,
220
224
  };
221
- this._resource = this._resource.merge((0, resources_1.detectResourcesSync)(internalConfig));
225
+ this._resource = this._resource.merge((0, resources_1.detectResources)(internalConfig));
222
226
  }
223
227
  this._resource =
224
228
  this._serviceName === undefined
225
229
  ? this._resource
226
- : this._resource.merge(new resources_1.Resource({
227
- [semantic_conventions_1.SEMRESATTRS_SERVICE_NAME]: this._serviceName,
230
+ : this._resource.merge((0, resources_1.resourceFromAttributes)({
231
+ [semantic_conventions_1.ATTR_SERVICE_NAME]: this._serviceName,
228
232
  }));
229
233
  const spanProcessors = this._tracerProviderConfig
230
234
  ? this._tracerProviderConfig.spanProcessors
231
235
  : (0, utils_1.getSpanProcessorsFromEnv)();
232
- // If the Provider is configured with Env Exporters, we need to check if the SDK had any manual configurations and set them here
233
- this._tracerProvider = new sdk_trace_node_1.NodeTracerProvider(Object.assign(Object.assign({}, this._configuration), { resource: this._resource, mergeResourceWithDefaults: this._mergeResourceWithDefaults, spanProcessors }));
236
+ this._tracerProvider = new sdk_trace_node_1.NodeTracerProvider({
237
+ ...this._configuration,
238
+ resource: this._resource,
239
+ spanProcessors,
240
+ });
234
241
  // Only register if there is a span processor
235
242
  if (spanProcessors.length > 0) {
236
243
  this._tracerProvider.register({
237
- contextManager: (_b = (_a = this._tracerProviderConfig) === null || _a === void 0 ? void 0 : _a.contextManager) !== null && _b !== void 0 ? _b :
238
- // _tracerProviderConfig may be undefined if trace-specific settings are not provided - fall back to raw config
239
- (_c = this._configuration) === null || _c === void 0 ? void 0 : _c.contextManager,
240
- propagator: (_d = this._tracerProviderConfig) === null || _d === void 0 ? void 0 : _d.textMapPropagator,
244
+ contextManager: this._tracerProviderConfig?.contextManager ??
245
+ // _tracerProviderConfig may be undefined if trace-specific settings are not provided - fall back to raw config
246
+ this._configuration?.contextManager,
247
+ propagator: this._tracerProviderConfig?.textMapPropagator ??
248
+ (0, utils_1.getPropagatorFromEnv)(),
241
249
  });
242
250
  }
243
251
  if (this._loggerProviderConfig) {
244
252
  const loggerProvider = new sdk_logs_1.LoggerProvider({
245
253
  resource: this._resource,
246
- mergeResourceWithDefaults: this._mergeResourceWithDefaults,
247
254
  });
248
255
  for (const logRecordProcessor of this._loggerProviderConfig
249
256
  .logRecordProcessors) {
@@ -255,7 +262,7 @@ class NodeSDK {
255
262
  const metricReadersFromEnv = configureMetricProviderFromEnv();
256
263
  if (this._meterProviderConfig || metricReadersFromEnv.length > 0) {
257
264
  const readers = [];
258
- if ((_e = this._meterProviderConfig) === null || _e === void 0 ? void 0 : _e.reader) {
265
+ if (this._meterProviderConfig?.reader) {
259
266
  readers.push(this._meterProviderConfig.reader);
260
267
  }
261
268
  if (readers.length === 0) {
@@ -263,9 +270,8 @@ class NodeSDK {
263
270
  }
264
271
  const meterProvider = new sdk_metrics_1.MeterProvider({
265
272
  resource: this._resource,
266
- views: (_g = (_f = this._meterProviderConfig) === null || _f === void 0 ? void 0 : _f.views) !== null && _g !== void 0 ? _g : [],
273
+ views: this._meterProviderConfig?.views ?? [],
267
274
  readers: readers,
268
- mergeResourceWithDefaults: this._mergeResourceWithDefaults,
269
275
  });
270
276
  this._meterProvider = meterProvider;
271
277
  api_1.metrics.setGlobalMeterProvider(meterProvider);
@@ -293,11 +299,10 @@ class NodeSDK {
293
299
  .then(() => { }));
294
300
  }
295
301
  configureLoggerProviderFromEnv() {
296
- var _a;
297
- const logExportersList = (_a = process.env.OTEL_LOGS_EXPORTER) !== null && _a !== void 0 ? _a : '';
302
+ const logExportersList = process.env.OTEL_LOGS_EXPORTER ?? '';
298
303
  const enabledExporters = (0, utils_1.filterBlanksAndNulls)(logExportersList.split(','));
299
304
  if (enabledExporters.length === 0) {
300
- api_1.diag.info('OTEL_LOGS_EXPORTER is empty. Using default otlp exporter.');
305
+ api_1.diag.debug('OTEL_LOGS_EXPORTER is empty. Using default otlp exporter.');
301
306
  enabledExporters.push('otlp');
302
307
  }
303
308
  if (enabledExporters.includes('none')) {
@@ -306,9 +311,9 @@ class NodeSDK {
306
311
  }
307
312
  const exporters = [];
308
313
  enabledExporters.forEach(exporter => {
309
- var _a, _b;
310
314
  if (exporter === 'otlp') {
311
- const protocol = (_b = ((_a = process.env.OTEL_EXPORTER_OTLP_LOGS_PROTOCOL) !== null && _a !== void 0 ? _a : process.env.OTEL_EXPORTER_OTLP_PROTOCOL)) === null || _b === void 0 ? void 0 : _b.trim();
315
+ const protocol = (process.env.OTEL_EXPORTER_OTLP_LOGS_PROTOCOL ??
316
+ process.env.OTEL_EXPORTER_OTLP_PROTOCOL)?.trim();
312
317
  switch (protocol) {
313
318
  case 'grpc':
314
319
  exporters.push(new exporter_logs_otlp_grpc_1.OTLPLogExporter());
@@ -1 +1 @@
1
- {"version":3,"file":"sdk.js","sourceRoot":"","sources":["../../src/sdk.ts"],"names":[],"mappings":";AAAA;;;;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AE,CAAC,CAAC;wBAC1C,MAAM;oBACR,KAAK,WAAW;wBACd,SAAS,CAAC,IAAI,CAAC,IAAI,yCAAmB,EAAE,CAAC,CAAC;wBAC1C,MAAM;oBACR,KAAK,eAAe;wBAClB,SAAS,CAAC,IAAI,CAAC,IAAI,0CAAoB,EAAE,CAAC,CAAC;wBAC3C,MAAM;oBACR,KAAK,SAAS,CAAC;oBACf,KAAK,EAAE;wBACL,SAAS,CAAC,IAAI,CAAC,IAAI,0CAAoB,EAAE,CAAC,CAAC;wBAC3C,MAAM;oBACR;wBACE,UAAI,CAAC,IAAI,CACP,oCAAoC,QAAQ,yBAAyB,CACtE,CAAC;wBACF,SAAS,CAAC,IAAI,CAAC,IAAI,0CAAoB,EAAE,CAAC,CAAC;iBAC9C;aACF;iBAAM,IAAI,QAAQ,KAAK,SAAS,EAAE;gBACjC,SAAS,CAAC,IAAI,CAAC,IAAI,mCAAwB,EAAE,CAAC,CAAC;aAChD;iBAAM;gBACL,UAAI,CAAC,IAAI,CACP,0CAA0C,QAAQ,+CAA+C,CAClG,CAAC;aACH;QACH,CAAC,CAAC,CAAC;QAEH,IAAI,SAAS,CAAC,MAAM,GAAG,CAAC,EAAE;YACxB,IAAI,CAAC,qBAAqB,GAAG;gBAC3B,mBAAmB,EAAE,SAAS,CAAC,GAAG,CAAC,QAAQ,CAAC,EAAE;oBAC5C,IAAI,QAAQ,YAAY,mCAAwB,EAAE;wBAChD,OAAO,IAAI,mCAAwB,CAAC,QAAQ,CAAC,CAAC;qBAC/C;yBAAM;wBACL,OAAO,IAAI,kCAAuB,CAAC,QAAQ,CAAC,CAAC;qBAC9C;gBACH,CAAC,CAAC;aACH,CAAC;SACH;IACH,CAAC;CACF;AAhUD,0BAgUC","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 {\n ContextManager,\n TextMapPropagator,\n metrics,\n diag,\n DiagConsoleLogger,\n} from '@opentelemetry/api';\nimport { logs } from '@opentelemetry/api-logs';\nimport {\n Instrumentation,\n registerInstrumentations,\n} from '@opentelemetry/instrumentation';\nimport {\n Detector,\n DetectorSync,\n detectResourcesSync,\n envDetector,\n hostDetector,\n IResource,\n processDetector,\n Resource,\n ResourceDetectionConfig,\n} from '@opentelemetry/resources';\nimport {\n LogRecordProcessor,\n LoggerProvider,\n BatchLogRecordProcessor,\n ConsoleLogRecordExporter,\n LogRecordExporter,\n SimpleLogRecordProcessor,\n} from '@opentelemetry/sdk-logs';\nimport { OTLPLogExporter as OTLPHttpLogExporter } from '@opentelemetry/exporter-logs-otlp-http';\nimport { OTLPLogExporter as OTLPGrpcLogExporter } from '@opentelemetry/exporter-logs-otlp-grpc';\nimport { OTLPLogExporter as OTLPProtoLogExporter } from '@opentelemetry/exporter-logs-otlp-proto';\nimport { OTLPMetricExporter as OTLPGrpcMetricExporter } from '@opentelemetry/exporter-metrics-otlp-grpc';\nimport { OTLPMetricExporter as OTLPProtoMetricExporter } from '@opentelemetry/exporter-metrics-otlp-proto';\nimport { OTLPMetricExporter as OTLPHttpMetricExporter } from '@opentelemetry/exporter-metrics-otlp-http';\nimport { PrometheusExporter as PrometheusMetricExporter } from '@opentelemetry/exporter-prometheus';\nimport {\n MeterProvider,\n MetricReader,\n View,\n ConsoleMetricExporter,\n PeriodicExportingMetricReader,\n} from '@opentelemetry/sdk-metrics';\nimport {\n BatchSpanProcessor,\n SpanProcessor,\n} from '@opentelemetry/sdk-trace-base';\nimport {\n NodeTracerConfig,\n NodeTracerProvider,\n} from '@opentelemetry/sdk-trace-node';\nimport { SEMRESATTRS_SERVICE_NAME } from '@opentelemetry/semantic-conventions';\nimport { NodeSDKConfiguration } from './types';\nimport { getEnv, getEnvWithoutDefaults } from '@opentelemetry/core';\nimport {\n getResourceDetectorsFromEnv,\n getSpanProcessorsFromEnv,\n filterBlanksAndNulls,\n} from './utils';\n\n/** This class represents everything needed to register a fully configured OpenTelemetry Node.js SDK */\n\nexport type MeterProviderConfig = {\n /**\n * Reference to the MetricReader instance by the NodeSDK\n */\n reader?: MetricReader;\n /**\n * List of {@link View}s that should be passed to the MeterProvider\n */\n views?: View[];\n};\n\nexport type LoggerProviderConfig = {\n /**\n * Reference to the LoggerRecordProcessor instance by the NodeSDK\n */\n logRecordProcessors: LogRecordProcessor[];\n};\n\n/**\n * @Returns param value, if set else returns the default value\n */\nfunction getValueInMillis(envName: string, defaultValue: number): number {\n return parseInt(process.env[envName] || '') || defaultValue;\n}\n\n/**\n *\n * @returns MetricReader[] if appropriate environment variables are configured\n */\nfunction configureMetricProviderFromEnv(): MetricReader[] {\n const metricReaders: MetricReader[] = [];\n const metricsExporterList = process.env.OTEL_METRICS_EXPORTER?.trim();\n if (!metricsExporterList) {\n return metricReaders;\n }\n const enabledExporters = filterBlanksAndNulls(metricsExporterList.split(','));\n\n if (enabledExporters.length === 0) {\n diag.info('OTEL_METRICS_EXPORTER is empty. Using default otlp exporter.');\n }\n\n if (enabledExporters.includes('none')) {\n diag.info(\n `OTEL_METRICS_EXPORTER contains \"none\". Metric provider will not be initialized.`\n );\n return metricReaders;\n }\n enabledExporters.forEach(exporter => {\n if (exporter === 'otlp') {\n const protocol =\n process.env.OTEL_EXPORTER_OTLP_METRICS_PROTOCOL?.trim() ||\n process.env.OTEL_EXPORTER_OTLP_PROTOCOL?.trim();\n\n const exportIntervalMillis = getValueInMillis(\n 'OTEL_METRIC_EXPORT_INTERVAL',\n 60000\n );\n const exportTimeoutMillis = getValueInMillis(\n 'OTEL_METRIC_EXPORT_TIMEOUT',\n 30000\n );\n\n switch (protocol) {\n case 'grpc':\n metricReaders.push(\n new PeriodicExportingMetricReader({\n exporter: new OTLPGrpcMetricExporter(),\n exportIntervalMillis: exportIntervalMillis,\n exportTimeoutMillis: exportTimeoutMillis,\n })\n );\n break;\n case 'http/json':\n metricReaders.push(\n new PeriodicExportingMetricReader({\n exporter: new OTLPHttpMetricExporter(),\n exportIntervalMillis: exportIntervalMillis,\n exportTimeoutMillis: exportTimeoutMillis,\n })\n );\n break;\n case 'http/protobuf':\n metricReaders.push(\n new PeriodicExportingMetricReader({\n exporter: new OTLPProtoMetricExporter(),\n exportIntervalMillis: exportIntervalMillis,\n exportTimeoutMillis: exportTimeoutMillis,\n })\n );\n break;\n default:\n diag.warn(\n `Unsupported OTLP metrics protocol: \"${protocol}\". Using http/protobuf.`\n );\n metricReaders.push(\n new PeriodicExportingMetricReader({\n exporter: new OTLPProtoMetricExporter(),\n exportIntervalMillis: exportIntervalMillis,\n exportTimeoutMillis: exportTimeoutMillis,\n })\n );\n }\n } else if (exporter === 'console') {\n metricReaders.push(\n new PeriodicExportingMetricReader({\n exporter: new ConsoleMetricExporter(),\n })\n );\n } else if (exporter === 'prometheus') {\n metricReaders.push(new PrometheusMetricExporter());\n } else {\n diag.warn(\n `Unsupported OTEL_METRICS_EXPORTER value: \"${exporter}\". Supported values are: otlp, console, prometheus, none.`\n );\n }\n });\n\n return metricReaders;\n}\nexport class NodeSDK {\n private _tracerProviderConfig?: {\n tracerConfig: NodeTracerConfig;\n spanProcessors: SpanProcessor[];\n contextManager?: ContextManager;\n textMapPropagator?: TextMapPropagator;\n };\n private _loggerProviderConfig?: LoggerProviderConfig;\n private _meterProviderConfig?: MeterProviderConfig;\n private _instrumentations: Instrumentation[];\n\n private _resource: IResource;\n private _resourceDetectors: Array<Detector | DetectorSync>;\n private _mergeResourceWithDefaults: boolean;\n\n private _autoDetectResources: boolean;\n\n private _tracerProvider?: NodeTracerProvider;\n private _loggerProvider?: LoggerProvider;\n private _meterProvider?: MeterProvider;\n private _serviceName?: string;\n private _configuration?: Partial<NodeSDKConfiguration>;\n\n private _disabled?: boolean;\n\n /**\n * Create a new NodeJS SDK instance\n */\n public constructor(configuration: Partial<NodeSDKConfiguration> = {}) {\n const env = getEnv();\n const envWithoutDefaults = getEnvWithoutDefaults();\n\n if (env.OTEL_SDK_DISABLED) {\n this._disabled = true;\n // Functions with possible side-effects are set\n // to no-op via the _disabled flag\n }\n\n // Default is INFO, use environment without defaults to check\n // if the user originally set the environment variable.\n if (envWithoutDefaults.OTEL_LOG_LEVEL) {\n diag.setLogger(new DiagConsoleLogger(), {\n logLevel: envWithoutDefaults.OTEL_LOG_LEVEL,\n });\n }\n\n this._configuration = configuration;\n\n this._resource = configuration.resource ?? new Resource({});\n this._mergeResourceWithDefaults =\n configuration.mergeResourceWithDefaults ?? true;\n this._autoDetectResources = configuration.autoDetectResources ?? true;\n if (!this._autoDetectResources) {\n this._resourceDetectors = [];\n } else if (configuration.resourceDetectors != null) {\n this._resourceDetectors = configuration.resourceDetectors;\n } else if (process.env.OTEL_NODE_RESOURCE_DETECTORS != null) {\n this._resourceDetectors = getResourceDetectorsFromEnv();\n } else {\n this._resourceDetectors = [envDetector, processDetector, hostDetector];\n }\n\n this._serviceName = configuration.serviceName;\n\n // If a tracer provider can be created from manual configuration, create it\n if (\n configuration.traceExporter ||\n configuration.spanProcessor ||\n configuration.spanProcessors\n ) {\n const tracerProviderConfig: NodeTracerConfig = {};\n\n if (configuration.sampler) {\n tracerProviderConfig.sampler = configuration.sampler;\n }\n if (configuration.spanLimits) {\n tracerProviderConfig.spanLimits = configuration.spanLimits;\n }\n if (configuration.idGenerator) {\n tracerProviderConfig.idGenerator = configuration.idGenerator;\n }\n\n if (configuration.spanProcessor) {\n diag.warn(\n \"The 'spanProcessor' option is deprecated. Please use 'spanProcessors' instead.\"\n );\n }\n\n const spanProcessor =\n configuration.spanProcessor ??\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n new BatchSpanProcessor(configuration.traceExporter!);\n\n const spanProcessors = configuration.spanProcessors ?? [spanProcessor];\n\n this._tracerProviderConfig = {\n tracerConfig: tracerProviderConfig,\n spanProcessors,\n contextManager: configuration.contextManager,\n textMapPropagator: configuration.textMapPropagator,\n };\n }\n\n if (configuration.logRecordProcessors) {\n this._loggerProviderConfig = {\n logRecordProcessors: configuration.logRecordProcessors,\n };\n } else if (configuration.logRecordProcessor) {\n this._loggerProviderConfig = {\n logRecordProcessors: [configuration.logRecordProcessor],\n };\n diag.warn(\n \"The 'logRecordProcessor' option is deprecated. Please use 'logRecordProcessors' instead.\"\n );\n } else {\n this.configureLoggerProviderFromEnv();\n }\n\n if (configuration.metricReader || configuration.views) {\n const meterProviderConfig: MeterProviderConfig = {};\n if (configuration.metricReader) {\n meterProviderConfig.reader = configuration.metricReader;\n }\n\n if (configuration.views) {\n meterProviderConfig.views = configuration.views;\n }\n\n this._meterProviderConfig = meterProviderConfig;\n }\n\n this._instrumentations = configuration.instrumentations?.flat() ?? [];\n }\n\n /**\n * Call this method to construct SDK components and register them with the OpenTelemetry API.\n */\n public start(): void {\n if (this._disabled) {\n return;\n }\n\n registerInstrumentations({\n instrumentations: this._instrumentations,\n });\n\n if (this._autoDetectResources) {\n const internalConfig: ResourceDetectionConfig = {\n detectors: this._resourceDetectors,\n };\n\n this._resource = this._resource.merge(\n detectResourcesSync(internalConfig)\n );\n }\n\n this._resource =\n this._serviceName === undefined\n ? this._resource\n : this._resource.merge(\n new Resource({\n [SEMRESATTRS_SERVICE_NAME]: this._serviceName,\n })\n );\n\n const spanProcessors = this._tracerProviderConfig\n ? this._tracerProviderConfig.spanProcessors\n : getSpanProcessorsFromEnv();\n\n // If the Provider is configured with Env Exporters, we need to check if the SDK had any manual configurations and set them here\n this._tracerProvider = new NodeTracerProvider({\n ...this._configuration,\n resource: this._resource,\n mergeResourceWithDefaults: this._mergeResourceWithDefaults,\n spanProcessors,\n });\n\n // Only register if there is a span processor\n if (spanProcessors.length > 0) {\n this._tracerProvider.register({\n contextManager:\n this._tracerProviderConfig?.contextManager ??\n // _tracerProviderConfig may be undefined if trace-specific settings are not provided - fall back to raw config\n this._configuration?.contextManager,\n propagator: this._tracerProviderConfig?.textMapPropagator,\n });\n }\n\n if (this._loggerProviderConfig) {\n const loggerProvider = new LoggerProvider({\n resource: this._resource,\n mergeResourceWithDefaults: this._mergeResourceWithDefaults,\n });\n\n for (const logRecordProcessor of this._loggerProviderConfig\n .logRecordProcessors) {\n loggerProvider.addLogRecordProcessor(logRecordProcessor);\n }\n\n this._loggerProvider = loggerProvider;\n\n logs.setGlobalLoggerProvider(loggerProvider);\n }\n\n const metricReadersFromEnv: MetricReader[] =\n configureMetricProviderFromEnv();\n if (this._meterProviderConfig || metricReadersFromEnv.length > 0) {\n const readers: MetricReader[] = [];\n if (this._meterProviderConfig?.reader) {\n readers.push(this._meterProviderConfig.reader);\n }\n\n if (readers.length === 0) {\n metricReadersFromEnv.forEach((r: MetricReader) => readers.push(r));\n }\n\n const meterProvider = new MeterProvider({\n resource: this._resource,\n views: this._meterProviderConfig?.views ?? [],\n readers: readers,\n mergeResourceWithDefaults: this._mergeResourceWithDefaults,\n });\n\n this._meterProvider = meterProvider;\n metrics.setGlobalMeterProvider(meterProvider);\n\n // TODO: This is a workaround to fix https://github.com/open-telemetry/opentelemetry-js/issues/3609\n // If the MeterProvider is not yet registered when instrumentations are registered, all metrics are dropped.\n // This code is obsolete once https://github.com/open-telemetry/opentelemetry-js/issues/3622 is implemented.\n for (const instrumentation of this._instrumentations) {\n instrumentation.setMeterProvider(metrics.getMeterProvider());\n }\n }\n }\n\n public shutdown(): Promise<void> {\n const promises: Promise<unknown>[] = [];\n if (this._tracerProvider) {\n promises.push(this._tracerProvider.shutdown());\n }\n if (this._loggerProvider) {\n promises.push(this._loggerProvider.shutdown());\n }\n if (this._meterProvider) {\n promises.push(this._meterProvider.shutdown());\n }\n\n return (\n Promise.all(promises)\n // return void instead of the array from Promise.all\n .then(() => {})\n );\n }\n\n private configureLoggerProviderFromEnv(): void {\n const logExportersList = process.env.OTEL_LOGS_EXPORTER ?? '';\n const enabledExporters = filterBlanksAndNulls(logExportersList.split(','));\n\n if (enabledExporters.length === 0) {\n diag.info('OTEL_LOGS_EXPORTER is empty. Using default otlp exporter.');\n enabledExporters.push('otlp');\n }\n\n if (enabledExporters.includes('none')) {\n diag.info(\n `OTEL_LOGS_EXPORTER contains \"none\". Logger provider will not be initialized.`\n );\n return;\n }\n\n const exporters: LogRecordExporter[] = [];\n\n enabledExporters.forEach(exporter => {\n if (exporter === 'otlp') {\n const protocol = (\n process.env.OTEL_EXPORTER_OTLP_LOGS_PROTOCOL ??\n process.env.OTEL_EXPORTER_OTLP_PROTOCOL\n )?.trim();\n\n switch (protocol) {\n case 'grpc':\n exporters.push(new OTLPGrpcLogExporter());\n break;\n case 'http/json':\n exporters.push(new OTLPHttpLogExporter());\n break;\n case 'http/protobuf':\n exporters.push(new OTLPProtoLogExporter());\n break;\n case undefined:\n case '':\n exporters.push(new OTLPProtoLogExporter());\n break;\n default:\n diag.warn(\n `Unsupported OTLP logs protocol: \"${protocol}\". Using http/protobuf.`\n );\n exporters.push(new OTLPProtoLogExporter());\n }\n } else if (exporter === 'console') {\n exporters.push(new ConsoleLogRecordExporter());\n } else {\n diag.warn(\n `Unsupported OTEL_LOGS_EXPORTER value: \"${exporter}\". Supported values are: otlp, console, none.`\n );\n }\n });\n\n if (exporters.length > 0) {\n this._loggerProviderConfig = {\n logRecordProcessors: exporters.map(exporter => {\n if (exporter instanceof ConsoleLogRecordExporter) {\n return new SimpleLogRecordProcessor(exporter);\n } else {\n return new BatchLogRecordProcessor(exporter);\n }\n }),\n };\n }\n }\n}\n"]}
1
+ {"version":3,"file":"sdk.js","sourceRoot":"","sources":["../../src/sdk.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;;;AAEH,4CAM4B;AAC5B,sDAA+C;AAC/C,oEAGwC;AACxC,wDAUkC;AAClC,sDAOiC;AACjC,oFAAgG;AAChG,oFAAgG;AAChG,sFAAkG;AAClG,0FAAyG;AACzG,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S,CAAC,IAAI,CAAC,IAAI,0CAAoB,EAAE,CAAC,CAAC;wBAC3C,MAAM;oBACR;wBACE,UAAI,CAAC,IAAI,CACP,oCAAoC,QAAQ,yBAAyB,CACtE,CAAC;wBACF,SAAS,CAAC,IAAI,CAAC,IAAI,0CAAoB,EAAE,CAAC,CAAC;iBAC9C;aACF;iBAAM,IAAI,QAAQ,KAAK,SAAS,EAAE;gBACjC,SAAS,CAAC,IAAI,CAAC,IAAI,mCAAwB,EAAE,CAAC,CAAC;aAChD;iBAAM;gBACL,UAAI,CAAC,IAAI,CACP,0CAA0C,QAAQ,+CAA+C,CAClG,CAAC;aACH;QACH,CAAC,CAAC,CAAC;QAEH,IAAI,SAAS,CAAC,MAAM,GAAG,CAAC,EAAE;YACxB,IAAI,CAAC,qBAAqB,GAAG;gBAC3B,mBAAmB,EAAE,SAAS,CAAC,GAAG,CAAC,QAAQ,CAAC,EAAE;oBAC5C,IAAI,QAAQ,YAAY,mCAAwB,EAAE;wBAChD,OAAO,IAAI,mCAAwB,CAAC,QAAQ,CAAC,CAAC;qBAC/C;yBAAM;wBACL,OAAO,IAAI,kCAAuB,CAAC,QAAQ,CAAC,CAAC;qBAC9C;gBACH,CAAC,CAAC;aACH,CAAC;SACH;IACH,CAAC;CACF;AArTD,0BAqTC","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 {\n ContextManager,\n TextMapPropagator,\n metrics,\n diag,\n DiagConsoleLogger,\n} from '@opentelemetry/api';\nimport { logs } from '@opentelemetry/api-logs';\nimport {\n Instrumentation,\n registerInstrumentations,\n} from '@opentelemetry/instrumentation';\nimport {\n defaultResource,\n detectResources,\n envDetector,\n hostDetector,\n Resource,\n processDetector,\n ResourceDetectionConfig,\n ResourceDetector,\n resourceFromAttributes,\n} from '@opentelemetry/resources';\nimport {\n LogRecordProcessor,\n LoggerProvider,\n BatchLogRecordProcessor,\n ConsoleLogRecordExporter,\n LogRecordExporter,\n SimpleLogRecordProcessor,\n} from '@opentelemetry/sdk-logs';\nimport { OTLPLogExporter as OTLPHttpLogExporter } from '@opentelemetry/exporter-logs-otlp-http';\nimport { OTLPLogExporter as OTLPGrpcLogExporter } from '@opentelemetry/exporter-logs-otlp-grpc';\nimport { OTLPLogExporter as OTLPProtoLogExporter } from '@opentelemetry/exporter-logs-otlp-proto';\nimport { OTLPMetricExporter as OTLPGrpcMetricExporter } from '@opentelemetry/exporter-metrics-otlp-grpc';\nimport { OTLPMetricExporter as OTLPProtoMetricExporter } from '@opentelemetry/exporter-metrics-otlp-proto';\nimport { OTLPMetricExporter as OTLPHttpMetricExporter } from '@opentelemetry/exporter-metrics-otlp-http';\nimport { PrometheusExporter as PrometheusMetricExporter } from '@opentelemetry/exporter-prometheus';\nimport {\n MeterProvider,\n IMetricReader,\n ViewOptions,\n ConsoleMetricExporter,\n PeriodicExportingMetricReader,\n} from '@opentelemetry/sdk-metrics';\nimport {\n BatchSpanProcessor,\n SpanProcessor,\n} from '@opentelemetry/sdk-trace-base';\nimport {\n NodeTracerConfig,\n NodeTracerProvider,\n} from '@opentelemetry/sdk-trace-node';\nimport { ATTR_SERVICE_NAME } from '@opentelemetry/semantic-conventions';\nimport { NodeSDKConfiguration } from './types';\nimport {\n getBooleanFromEnv,\n getStringFromEnv,\n diagLogLevelFromString,\n} from '@opentelemetry/core';\nimport {\n getResourceDetectorsFromEnv,\n getSpanProcessorsFromEnv,\n filterBlanksAndNulls,\n getPropagatorFromEnv,\n} from './utils';\n\n/** This class represents everything needed to register a fully configured OpenTelemetry Node.js SDK */\n\nexport type MeterProviderConfig = {\n /**\n * Reference to the MetricReader instance by the NodeSDK\n */\n reader?: IMetricReader;\n /**\n * List of {@link ViewOptions}s that should be passed to the MeterProvider\n */\n views?: ViewOptions[];\n};\n\nexport type LoggerProviderConfig = {\n /**\n * Reference to the LoggerRecordProcessor instance by the NodeSDK\n */\n logRecordProcessors: LogRecordProcessor[];\n};\n\n/**\n * @Returns param value, if set else returns the default value\n */\nfunction getValueInMillis(envName: string, defaultValue: number): number {\n return parseInt(process.env[envName] || '') || defaultValue;\n}\n\n/**\n *\n * @returns MetricReader[] if appropriate environment variables are configured\n */\nfunction configureMetricProviderFromEnv(): IMetricReader[] {\n const metricReaders: IMetricReader[] = [];\n const metricsExporterList = process.env.OTEL_METRICS_EXPORTER?.trim();\n if (!metricsExporterList) {\n return metricReaders;\n }\n const enabledExporters = filterBlanksAndNulls(metricsExporterList.split(','));\n\n if (enabledExporters.length === 0) {\n diag.debug('OTEL_METRICS_EXPORTER is empty. Using default otlp exporter.');\n }\n\n if (enabledExporters.includes('none')) {\n diag.info(\n `OTEL_METRICS_EXPORTER contains \"none\". Metric provider will not be initialized.`\n );\n return metricReaders;\n }\n enabledExporters.forEach(exporter => {\n if (exporter === 'otlp') {\n const protocol =\n process.env.OTEL_EXPORTER_OTLP_METRICS_PROTOCOL?.trim() ||\n process.env.OTEL_EXPORTER_OTLP_PROTOCOL?.trim();\n\n const exportIntervalMillis = getValueInMillis(\n 'OTEL_METRIC_EXPORT_INTERVAL',\n 60000\n );\n const exportTimeoutMillis = getValueInMillis(\n 'OTEL_METRIC_EXPORT_TIMEOUT',\n 30000\n );\n\n switch (protocol) {\n case 'grpc':\n metricReaders.push(\n new PeriodicExportingMetricReader({\n exporter: new OTLPGrpcMetricExporter(),\n exportIntervalMillis: exportIntervalMillis,\n exportTimeoutMillis: exportTimeoutMillis,\n })\n );\n break;\n case 'http/json':\n metricReaders.push(\n new PeriodicExportingMetricReader({\n exporter: new OTLPHttpMetricExporter(),\n exportIntervalMillis: exportIntervalMillis,\n exportTimeoutMillis: exportTimeoutMillis,\n })\n );\n break;\n case 'http/protobuf':\n metricReaders.push(\n new PeriodicExportingMetricReader({\n exporter: new OTLPProtoMetricExporter(),\n exportIntervalMillis: exportIntervalMillis,\n exportTimeoutMillis: exportTimeoutMillis,\n })\n );\n break;\n default:\n diag.warn(\n `Unsupported OTLP metrics protocol: \"${protocol}\". Using http/protobuf.`\n );\n metricReaders.push(\n new PeriodicExportingMetricReader({\n exporter: new OTLPProtoMetricExporter(),\n exportIntervalMillis: exportIntervalMillis,\n exportTimeoutMillis: exportTimeoutMillis,\n })\n );\n }\n } else if (exporter === 'console') {\n metricReaders.push(\n new PeriodicExportingMetricReader({\n exporter: new ConsoleMetricExporter(),\n })\n );\n } else if (exporter === 'prometheus') {\n metricReaders.push(new PrometheusMetricExporter());\n } else {\n diag.warn(\n `Unsupported OTEL_METRICS_EXPORTER value: \"${exporter}\". Supported values are: otlp, console, prometheus, none.`\n );\n }\n });\n\n return metricReaders;\n}\nexport class NodeSDK {\n private _tracerProviderConfig?: {\n tracerConfig: NodeTracerConfig;\n spanProcessors: SpanProcessor[];\n contextManager?: ContextManager;\n textMapPropagator?: TextMapPropagator;\n };\n private _loggerProviderConfig?: LoggerProviderConfig;\n private _meterProviderConfig?: MeterProviderConfig;\n private _instrumentations: Instrumentation[];\n\n private _resource: Resource;\n private _resourceDetectors: Array<ResourceDetector>;\n\n private _autoDetectResources: boolean;\n\n private _tracerProvider?: NodeTracerProvider;\n private _loggerProvider?: LoggerProvider;\n private _meterProvider?: MeterProvider;\n private _serviceName?: string;\n private _configuration?: Partial<NodeSDKConfiguration>;\n\n private _disabled?: boolean;\n\n /**\n * Create a new NodeJS SDK instance\n */\n public constructor(configuration: Partial<NodeSDKConfiguration> = {}) {\n if (getBooleanFromEnv('OTEL_SDK_DISABLED')) {\n this._disabled = true;\n // Functions with possible side-effects are set\n // to no-op via the _disabled flag\n }\n\n const logLevel = getStringFromEnv('OTEL_LOG_LEVEL');\n if (logLevel != null) {\n diag.setLogger(new DiagConsoleLogger(), {\n logLevel: diagLogLevelFromString(logLevel),\n });\n }\n\n this._configuration = configuration;\n\n this._resource = configuration.resource ?? defaultResource();\n this._autoDetectResources = configuration.autoDetectResources ?? true;\n if (!this._autoDetectResources) {\n this._resourceDetectors = [];\n } else if (configuration.resourceDetectors != null) {\n this._resourceDetectors = configuration.resourceDetectors;\n } else if (process.env.OTEL_NODE_RESOURCE_DETECTORS != null) {\n this._resourceDetectors = getResourceDetectorsFromEnv();\n } else {\n this._resourceDetectors = [envDetector, processDetector, hostDetector];\n }\n\n this._serviceName = configuration.serviceName;\n\n // If a tracer provider can be created from manual configuration, create it\n if (\n configuration.traceExporter ||\n configuration.spanProcessor ||\n configuration.spanProcessors\n ) {\n const tracerProviderConfig: NodeTracerConfig = {};\n\n if (configuration.sampler) {\n tracerProviderConfig.sampler = configuration.sampler;\n }\n if (configuration.spanLimits) {\n tracerProviderConfig.spanLimits = configuration.spanLimits;\n }\n if (configuration.idGenerator) {\n tracerProviderConfig.idGenerator = configuration.idGenerator;\n }\n\n if (configuration.spanProcessor) {\n diag.warn(\n \"The 'spanProcessor' option is deprecated. Please use 'spanProcessors' instead.\"\n );\n }\n\n const spanProcessor =\n configuration.spanProcessor ??\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n new BatchSpanProcessor(configuration.traceExporter!);\n\n const spanProcessors = configuration.spanProcessors ?? [spanProcessor];\n\n this._tracerProviderConfig = {\n tracerConfig: tracerProviderConfig,\n spanProcessors,\n contextManager: configuration.contextManager,\n textMapPropagator: configuration.textMapPropagator,\n };\n }\n\n if (configuration.logRecordProcessors) {\n this._loggerProviderConfig = {\n logRecordProcessors: configuration.logRecordProcessors,\n };\n } else if (configuration.logRecordProcessor) {\n this._loggerProviderConfig = {\n logRecordProcessors: [configuration.logRecordProcessor],\n };\n diag.warn(\n \"The 'logRecordProcessor' option is deprecated. Please use 'logRecordProcessors' instead.\"\n );\n } else {\n this.configureLoggerProviderFromEnv();\n }\n\n if (configuration.metricReader || configuration.views) {\n const meterProviderConfig: MeterProviderConfig = {};\n if (configuration.metricReader) {\n meterProviderConfig.reader = configuration.metricReader;\n }\n\n if (configuration.views) {\n meterProviderConfig.views = configuration.views;\n }\n\n this._meterProviderConfig = meterProviderConfig;\n }\n\n this._instrumentations = configuration.instrumentations?.flat() ?? [];\n }\n\n /**\n * Call this method to construct SDK components and register them with the OpenTelemetry API.\n */\n public start(): void {\n if (this._disabled) {\n return;\n }\n\n registerInstrumentations({\n instrumentations: this._instrumentations,\n });\n\n if (this._autoDetectResources) {\n const internalConfig: ResourceDetectionConfig = {\n detectors: this._resourceDetectors,\n };\n\n this._resource = this._resource.merge(detectResources(internalConfig));\n }\n\n this._resource =\n this._serviceName === undefined\n ? this._resource\n : this._resource.merge(\n resourceFromAttributes({\n [ATTR_SERVICE_NAME]: this._serviceName,\n })\n );\n\n const spanProcessors = this._tracerProviderConfig\n ? this._tracerProviderConfig.spanProcessors\n : getSpanProcessorsFromEnv();\n\n this._tracerProvider = new NodeTracerProvider({\n ...this._configuration,\n resource: this._resource,\n spanProcessors,\n });\n\n // Only register if there is a span processor\n if (spanProcessors.length > 0) {\n this._tracerProvider.register({\n contextManager:\n this._tracerProviderConfig?.contextManager ??\n // _tracerProviderConfig may be undefined if trace-specific settings are not provided - fall back to raw config\n this._configuration?.contextManager,\n propagator:\n this._tracerProviderConfig?.textMapPropagator ??\n getPropagatorFromEnv(),\n });\n }\n\n if (this._loggerProviderConfig) {\n const loggerProvider = new LoggerProvider({\n resource: this._resource,\n });\n\n for (const logRecordProcessor of this._loggerProviderConfig\n .logRecordProcessors) {\n loggerProvider.addLogRecordProcessor(logRecordProcessor);\n }\n\n this._loggerProvider = loggerProvider;\n\n logs.setGlobalLoggerProvider(loggerProvider);\n }\n\n const metricReadersFromEnv: IMetricReader[] =\n configureMetricProviderFromEnv();\n if (this._meterProviderConfig || metricReadersFromEnv.length > 0) {\n const readers: IMetricReader[] = [];\n if (this._meterProviderConfig?.reader) {\n readers.push(this._meterProviderConfig.reader);\n }\n\n if (readers.length === 0) {\n metricReadersFromEnv.forEach((r: IMetricReader) => readers.push(r));\n }\n\n const meterProvider = new MeterProvider({\n resource: this._resource,\n views: this._meterProviderConfig?.views ?? [],\n readers: readers,\n });\n\n this._meterProvider = meterProvider;\n metrics.setGlobalMeterProvider(meterProvider);\n\n // TODO: This is a workaround to fix https://github.com/open-telemetry/opentelemetry-js/issues/3609\n // If the MeterProvider is not yet registered when instrumentations are registered, all metrics are dropped.\n // This code is obsolete once https://github.com/open-telemetry/opentelemetry-js/issues/3622 is implemented.\n for (const instrumentation of this._instrumentations) {\n instrumentation.setMeterProvider(metrics.getMeterProvider());\n }\n }\n }\n\n public shutdown(): Promise<void> {\n const promises: Promise<unknown>[] = [];\n if (this._tracerProvider) {\n promises.push(this._tracerProvider.shutdown());\n }\n if (this._loggerProvider) {\n promises.push(this._loggerProvider.shutdown());\n }\n if (this._meterProvider) {\n promises.push(this._meterProvider.shutdown());\n }\n\n return (\n Promise.all(promises)\n // return void instead of the array from Promise.all\n .then(() => {})\n );\n }\n\n private configureLoggerProviderFromEnv(): void {\n const logExportersList = process.env.OTEL_LOGS_EXPORTER ?? '';\n const enabledExporters = filterBlanksAndNulls(logExportersList.split(','));\n\n if (enabledExporters.length === 0) {\n diag.debug('OTEL_LOGS_EXPORTER is empty. Using default otlp exporter.');\n enabledExporters.push('otlp');\n }\n\n if (enabledExporters.includes('none')) {\n diag.info(\n `OTEL_LOGS_EXPORTER contains \"none\". Logger provider will not be initialized.`\n );\n return;\n }\n\n const exporters: LogRecordExporter[] = [];\n\n enabledExporters.forEach(exporter => {\n if (exporter === 'otlp') {\n const protocol = (\n process.env.OTEL_EXPORTER_OTLP_LOGS_PROTOCOL ??\n process.env.OTEL_EXPORTER_OTLP_PROTOCOL\n )?.trim();\n\n switch (protocol) {\n case 'grpc':\n exporters.push(new OTLPGrpcLogExporter());\n break;\n case 'http/json':\n exporters.push(new OTLPHttpLogExporter());\n break;\n case 'http/protobuf':\n exporters.push(new OTLPProtoLogExporter());\n break;\n case undefined:\n case '':\n exporters.push(new OTLPProtoLogExporter());\n break;\n default:\n diag.warn(\n `Unsupported OTLP logs protocol: \"${protocol}\". Using http/protobuf.`\n );\n exporters.push(new OTLPProtoLogExporter());\n }\n } else if (exporter === 'console') {\n exporters.push(new ConsoleLogRecordExporter());\n } else {\n diag.warn(\n `Unsupported OTEL_LOGS_EXPORTER value: \"${exporter}\". Supported values are: otlp, console, none.`\n );\n }\n });\n\n if (exporters.length > 0) {\n this._loggerProviderConfig = {\n logRecordProcessors: exporters.map(exporter => {\n if (exporter instanceof ConsoleLogRecordExporter) {\n return new SimpleLogRecordProcessor(exporter);\n } else {\n return new BatchLogRecordProcessor(exporter);\n }\n }),\n };\n }\n }\n}\n"]}
@@ -1,9 +1,9 @@
1
1
  import type { ContextManager } from '@opentelemetry/api';
2
2
  import { TextMapPropagator } from '@opentelemetry/api';
3
3
  import { Instrumentation } from '@opentelemetry/instrumentation';
4
- import { Detector, DetectorSync, IResource } from '@opentelemetry/resources';
4
+ import { Resource, ResourceDetector } from '@opentelemetry/resources';
5
5
  import { LogRecordProcessor } from '@opentelemetry/sdk-logs';
6
- import { MetricReader, View } from '@opentelemetry/sdk-metrics';
6
+ import { IMetricReader, ViewOptions } from '@opentelemetry/sdk-metrics';
7
7
  import { Sampler, SpanExporter, SpanLimits, SpanProcessor, IdGenerator } from '@opentelemetry/sdk-trace-base';
8
8
  export interface NodeSDKConfiguration {
9
9
  autoDetectResources: boolean;
@@ -12,12 +12,11 @@ export interface NodeSDKConfiguration {
12
12
  /** @deprecated use logRecordProcessors instead*/
13
13
  logRecordProcessor: LogRecordProcessor;
14
14
  logRecordProcessors?: LogRecordProcessor[];
15
- metricReader: MetricReader;
16
- views: View[];
15
+ metricReader: IMetricReader;
16
+ views: ViewOptions[];
17
17
  instrumentations: (Instrumentation | Instrumentation[])[];
18
- resource: IResource;
19
- resourceDetectors: Array<Detector | DetectorSync>;
20
- mergeResourceWithDefaults?: boolean;
18
+ resource: Resource;
19
+ resourceDetectors: Array<ResourceDetector>;
21
20
  sampler: Sampler;
22
21
  serviceName?: string;
23
22
  /** @deprecated use spanProcessors instead*/
@@ -1 +1 @@
1
- {"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG","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 type { ContextManager } from '@opentelemetry/api';\nimport { TextMapPropagator } from '@opentelemetry/api';\nimport { Instrumentation } from '@opentelemetry/instrumentation';\nimport { Detector, DetectorSync, IResource } from '@opentelemetry/resources';\nimport { LogRecordProcessor } from '@opentelemetry/sdk-logs';\nimport { MetricReader, View } from '@opentelemetry/sdk-metrics';\nimport {\n Sampler,\n SpanExporter,\n SpanLimits,\n SpanProcessor,\n IdGenerator,\n} from '@opentelemetry/sdk-trace-base';\n\nexport interface NodeSDKConfiguration {\n autoDetectResources: boolean;\n contextManager: ContextManager;\n textMapPropagator: TextMapPropagator;\n /** @deprecated use logRecordProcessors instead*/\n logRecordProcessor: LogRecordProcessor;\n logRecordProcessors?: LogRecordProcessor[];\n metricReader: MetricReader;\n views: View[];\n instrumentations: (Instrumentation | Instrumentation[])[];\n resource: IResource;\n resourceDetectors: Array<Detector | DetectorSync>;\n mergeResourceWithDefaults?: boolean;\n sampler: Sampler;\n serviceName?: string;\n /** @deprecated use spanProcessors instead*/\n spanProcessor?: SpanProcessor;\n spanProcessors?: SpanProcessor[];\n traceExporter: SpanExporter;\n spanLimits: SpanLimits;\n idGenerator: IdGenerator;\n}\n"]}
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG","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 type { ContextManager } from '@opentelemetry/api';\nimport { TextMapPropagator } from '@opentelemetry/api';\nimport { Instrumentation } from '@opentelemetry/instrumentation';\nimport { Resource, ResourceDetector } from '@opentelemetry/resources';\nimport { LogRecordProcessor } from '@opentelemetry/sdk-logs';\nimport { IMetricReader, ViewOptions } from '@opentelemetry/sdk-metrics';\nimport {\n Sampler,\n SpanExporter,\n SpanLimits,\n SpanProcessor,\n IdGenerator,\n} from '@opentelemetry/sdk-trace-base';\n\nexport interface NodeSDKConfiguration {\n autoDetectResources: boolean;\n contextManager: ContextManager;\n textMapPropagator: TextMapPropagator;\n /** @deprecated use logRecordProcessors instead*/\n logRecordProcessor: LogRecordProcessor;\n logRecordProcessors?: LogRecordProcessor[];\n metricReader: IMetricReader;\n views: ViewOptions[];\n instrumentations: (Instrumentation | Instrumentation[])[];\n resource: Resource;\n resourceDetectors: Array<ResourceDetector>;\n sampler: Sampler;\n serviceName?: string;\n /** @deprecated use spanProcessors instead*/\n spanProcessor?: SpanProcessor;\n spanProcessors?: SpanProcessor[];\n traceExporter: SpanExporter;\n spanLimits: SpanLimits;\n idGenerator: IdGenerator;\n}\n"]}
@@ -1,7 +1,12 @@
1
- import { DetectorSync } from '@opentelemetry/resources';
1
+ import { TextMapPropagator } from '@opentelemetry/api';
2
+ import { ResourceDetector } from '@opentelemetry/resources';
2
3
  import { SpanProcessor } from '@opentelemetry/sdk-trace-base';
3
- export declare function getResourceDetectorsFromEnv(): Array<DetectorSync>;
4
+ export declare function getResourceDetectorsFromEnv(): Array<ResourceDetector>;
4
5
  export declare function filterBlanksAndNulls(list: string[]): string[];
5
6
  export declare function getOtlpProtocolFromEnv(): string;
6
7
  export declare function getSpanProcessorsFromEnv(): SpanProcessor[];
8
+ /**
9
+ * Get a propagator as defined by environment variables
10
+ */
11
+ export declare function getPropagatorFromEnv(): TextMapPropagator | null | undefined;
7
12
  //# sourceMappingURL=utils.d.ts.map
@@ -15,7 +15,7 @@
15
15
  * limitations under the License.
16
16
  */
17
17
  Object.defineProperty(exports, "__esModule", { value: true });
18
- exports.getSpanProcessorsFromEnv = exports.getOtlpProtocolFromEnv = exports.filterBlanksAndNulls = exports.getResourceDetectorsFromEnv = void 0;
18
+ exports.getPropagatorFromEnv = exports.getSpanProcessorsFromEnv = exports.getOtlpProtocolFromEnv = exports.filterBlanksAndNulls = exports.getResourceDetectorsFromEnv = void 0;
19
19
  const api_1 = require("@opentelemetry/api");
20
20
  const core_1 = require("@opentelemetry/core");
21
21
  const exporter_trace_otlp_proto_1 = require("@opentelemetry/exporter-trace-otlp-proto");
@@ -24,22 +24,23 @@ const exporter_trace_otlp_grpc_1 = require("@opentelemetry/exporter-trace-otlp-g
24
24
  const exporter_zipkin_1 = require("@opentelemetry/exporter-zipkin");
25
25
  const resources_1 = require("@opentelemetry/resources");
26
26
  const sdk_trace_base_1 = require("@opentelemetry/sdk-trace-base");
27
+ const propagator_b3_1 = require("@opentelemetry/propagator-b3");
28
+ const propagator_jaeger_1 = require("@opentelemetry/propagator-jaeger");
27
29
  const RESOURCE_DETECTOR_ENVIRONMENT = 'env';
28
30
  const RESOURCE_DETECTOR_HOST = 'host';
29
31
  const RESOURCE_DETECTOR_OS = 'os';
30
32
  const RESOURCE_DETECTOR_PROCESS = 'process';
31
33
  const RESOURCE_DETECTOR_SERVICE_INSTANCE_ID = 'serviceinstance';
32
34
  function getResourceDetectorsFromEnv() {
33
- var _a, _b;
34
35
  // When updating this list, make sure to also update the section `resourceDetectors` on README.
35
36
  const resourceDetectors = new Map([
36
- [RESOURCE_DETECTOR_ENVIRONMENT, resources_1.envDetectorSync],
37
- [RESOURCE_DETECTOR_HOST, resources_1.hostDetectorSync],
38
- [RESOURCE_DETECTOR_OS, resources_1.osDetectorSync],
39
- [RESOURCE_DETECTOR_SERVICE_INSTANCE_ID, resources_1.serviceInstanceIdDetectorSync],
40
- [RESOURCE_DETECTOR_PROCESS, resources_1.processDetectorSync],
37
+ [RESOURCE_DETECTOR_ENVIRONMENT, resources_1.envDetector],
38
+ [RESOURCE_DETECTOR_HOST, resources_1.hostDetector],
39
+ [RESOURCE_DETECTOR_OS, resources_1.osDetector],
40
+ [RESOURCE_DETECTOR_SERVICE_INSTANCE_ID, resources_1.serviceInstanceIdDetector],
41
+ [RESOURCE_DETECTOR_PROCESS, resources_1.processDetector],
41
42
  ]);
42
- const resourceDetectorsFromEnv = (_b = (_a = process.env.OTEL_NODE_RESOURCE_DETECTORS) === null || _a === void 0 ? void 0 : _a.split(',')) !== null && _b !== void 0 ? _b : ['all'];
43
+ const resourceDetectorsFromEnv = process.env.OTEL_NODE_RESOURCE_DETECTORS?.split(',') ?? ['all'];
43
44
  if (resourceDetectorsFromEnv.includes('all')) {
44
45
  return [...resourceDetectors.values()].flat();
45
46
  }
@@ -60,9 +61,9 @@ function filterBlanksAndNulls(list) {
60
61
  }
61
62
  exports.filterBlanksAndNulls = filterBlanksAndNulls;
62
63
  function getOtlpProtocolFromEnv() {
63
- var _a, _b, _c;
64
- const parsedEnvValues = (0, core_1.getEnvWithoutDefaults)();
65
- return ((_c = (_b = (_a = parsedEnvValues.OTEL_EXPORTER_OTLP_TRACES_PROTOCOL) !== null && _a !== void 0 ? _a : parsedEnvValues.OTEL_EXPORTER_OTLP_PROTOCOL) !== null && _b !== void 0 ? _b : (0, core_1.getEnv)().OTEL_EXPORTER_OTLP_TRACES_PROTOCOL) !== null && _c !== void 0 ? _c : (0, core_1.getEnv)().OTEL_EXPORTER_OTLP_PROTOCOL);
64
+ return ((0, core_1.getStringFromEnv)('OTEL_EXPORTER_OTLP_TRACES_PROTOCOL') ??
65
+ (0, core_1.getStringFromEnv)('OTEL_EXPORTER_OTLP_PROTOCOL') ??
66
+ 'http/protobuf');
66
67
  }
67
68
  exports.getOtlpProtocolFromEnv = getOtlpProtocolFromEnv;
68
69
  function getOtlpExporterFromEnv() {
@@ -93,7 +94,6 @@ function getJaegerExporter() {
93
94
  }
94
95
  }
95
96
  function getSpanProcessorsFromEnv() {
96
- var _a;
97
97
  const exportersMap = new Map([
98
98
  ['otlp', () => getOtlpExporterFromEnv()],
99
99
  ['zipkin', () => new exporter_zipkin_1.ZipkinExporter()],
@@ -102,13 +102,13 @@ function getSpanProcessorsFromEnv() {
102
102
  ]);
103
103
  const exporters = [];
104
104
  const processors = [];
105
- let traceExportersList = filterBlanksAndNulls(Array.from(new Set((0, core_1.getEnv)().OTEL_TRACES_EXPORTER.split(','))));
105
+ let traceExportersList = filterBlanksAndNulls(Array.from(new Set((0, core_1.getStringListFromEnv)('OTEL_TRACES_EXPORTER'))));
106
106
  if (traceExportersList[0] === 'none') {
107
107
  api_1.diag.warn('OTEL_TRACES_EXPORTER contains "none". SDK will not be initialized.');
108
108
  return [];
109
109
  }
110
110
  if (traceExportersList.length === 0) {
111
- api_1.diag.warn('OTEL_TRACES_EXPORTER is empty. Using default otlp exporter.');
111
+ api_1.diag.debug('OTEL_TRACES_EXPORTER is empty. Using default otlp exporter.');
112
112
  traceExportersList = ['otlp'];
113
113
  }
114
114
  else if (traceExportersList.length > 1 &&
@@ -117,7 +117,7 @@ function getSpanProcessorsFromEnv() {
117
117
  traceExportersList = ['otlp'];
118
118
  }
119
119
  for (const name of traceExportersList) {
120
- const exporter = (_a = exportersMap.get(name)) === null || _a === void 0 ? void 0 : _a();
120
+ const exporter = exportersMap.get(name)?.();
121
121
  if (exporter) {
122
122
  exporters.push(exporter);
123
123
  }
@@ -139,4 +139,56 @@ function getSpanProcessorsFromEnv() {
139
139
  return processors;
140
140
  }
141
141
  exports.getSpanProcessorsFromEnv = getSpanProcessorsFromEnv;
142
+ /**
143
+ * Get a propagator as defined by environment variables
144
+ */
145
+ function getPropagatorFromEnv() {
146
+ // Empty and undefined MUST be treated equal.
147
+ const propagatorsEnvVarValue = (0, core_1.getStringListFromEnv)('OTEL_PROPAGATORS');
148
+ if (propagatorsEnvVarValue == null) {
149
+ // return undefined to fall back to default
150
+ return undefined;
151
+ }
152
+ // Implementation note: this only contains specification required propagators that are actually hosted in this repo.
153
+ // Any other propagators (like aws, aws-lambda, should go into `@opentelemetry/auto-configuration-propagators` instead).
154
+ const propagatorsFactory = new Map([
155
+ ['tracecontext', () => new core_1.W3CTraceContextPropagator()],
156
+ ['baggage', () => new core_1.W3CTraceContextPropagator()],
157
+ ['b3', () => new propagator_b3_1.B3Propagator()],
158
+ [
159
+ 'b3multi',
160
+ () => new propagator_b3_1.B3Propagator({ injectEncoding: propagator_b3_1.B3InjectEncoding.MULTI_HEADER }),
161
+ ],
162
+ ['jaeger', () => new propagator_jaeger_1.JaegerPropagator()],
163
+ ]);
164
+ // Values MUST be deduplicated in order to register a Propagator only once.
165
+ const uniquePropagatorNames = Array.from(new Set(propagatorsEnvVarValue));
166
+ const propagators = uniquePropagatorNames.map(name => {
167
+ const propagator = propagatorsFactory.get(name)?.();
168
+ if (!propagator) {
169
+ api_1.diag.warn(`Propagator "${name}" requested through environment variable is unavailable.`);
170
+ return undefined;
171
+ }
172
+ return propagator;
173
+ });
174
+ const validPropagators = propagators.reduce((list, item) => {
175
+ if (item) {
176
+ list.push(item);
177
+ }
178
+ return list;
179
+ }, []);
180
+ if (validPropagators.length === 0) {
181
+ // null to signal that the default should **not** be used in its place.
182
+ return null;
183
+ }
184
+ else if (uniquePropagatorNames.length === 1) {
185
+ return validPropagators[0];
186
+ }
187
+ else {
188
+ return new core_1.CompositePropagator({
189
+ propagators: validPropagators,
190
+ });
191
+ }
192
+ }
193
+ exports.getPropagatorFromEnv = getPropagatorFromEnv;
142
194
  //# sourceMappingURL=utils.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"utils.js","sourceRoot":"","sources":["../../src/utils.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;;;AAEH,4CAA0C;AAC1C,8CAAoE;AACpE,wFAAuG;AACvG,sFAAqG;AACrG,sFAAqG;AACrG,oEAAgE;AAChE,wDAOkC;AAClC,kEAMuC;AAEvC,MAAM,6BAA6B,GAAG,KAAK,CAAC;AAC5C,MAAM,sBAAsB,GAAG,MAAM,CAAC;AACtC,MAAM,oBAAoB,GAAG,IAAI,CAAC;AAClC,MAAM,yBAAyB,GAAG,SAAS,CAAC;AAC5C,MAAM,qCAAqC,GAAG,iBAAiB,CAAC;AAEhE,SAAgB,2BAA2B;;IACzC,+FAA+F;IAC/F,MAAM,iBAAiB,GAAG,IAAI,GAAG,CAAuB;QACtD,CAAC,6BAA6B,EAAE,2BAAe,CAAC;QAChD,CAAC,sBAAsB,EAAE,4BAAgB,CAAC;QAC1C,CAAC,oBAAoB,EAAE,0BAAc,CAAC;QACtC,CAAC,qCAAqC,EAAE,yCAA6B,CAAC;QACtE,CAAC,yBAAyB,EAAE,+BAAmB,CAAC;KACjD,CAAC,CAAC;IAEH,MAAM,wBAAwB,GAC5B,MAAA,MAAA,OAAO,CAAC,GAAG,CAAC,4BAA4B,0CAAE,KAAK,CAAC,GAAG,CAAC,mCAAI,CAAC,KAAK,CAAC,CAAC;IAElE,IAAI,wBAAwB,CAAC,QAAQ,CAAC,KAAK,CAAC,EAAE;QAC5C,OAAO,CAAC,GAAG,iBAAiB,CAAC,MAAM,EAAE,CAAC,CAAC,IAAI,EAAE,CAAC;KAC/C;IAED,IAAI,wBAAwB,CAAC,QAAQ,CAAC,MAAM,CAAC,EAAE;QAC7C,OAAO,EAAE,CAAC;K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B,CAAC,QAAQ,CAAC,MAAM,CAAC,EACnC;QACA,UAAI,CAAC,IAAI,CACP,+FAA+F,CAChG,CAAC;QACF,kBAAkB,GAAG,CAAC,MAAM,CAAC,CAAC;KAC/B;IAED,KAAK,MAAM,IAAI,IAAI,kBAAkB,EAAE;QACrC,MAAM,QAAQ,GAAG,MAAA,YAAY,CAAC,GAAG,CAAC,IAAI,CAAC,2CAAI,CAAC;QAC5C,IAAI,QAAQ,EAAE;YACZ,SAAS,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;SAC1B;aAAM;YACL,UAAI,CAAC,IAAI,CAAC,4CAA4C,IAAI,GAAG,CAAC,CAAC;SAChE;KACF;IAED,KAAK,MAAM,GAAG,IAAI,SAAS,EAAE;QAC3B,IAAI,GAAG,YAAY,oCAAmB,EAAE;YACtC,UAAU,CAAC,IAAI,CAAC,IAAI,oCAAmB,CAAC,GAAG,CAAC,CAAC,CAAC;SAC/C;aAAM;YACL,UAAU,CAAC,IAAI,CAAC,IAAI,mCAAkB,CAAC,GAAG,CAAC,CAAC,CAAC;SAC9C;KACF;IAED,IAAI,SAAS,CAAC,MAAM,KAAK,CAAC,EAAE;QAC1B,UAAI,CAAC,IAAI,CACP,oFAAoF,CACrF,CAAC;KACH;IAED,OAAO,UAAU,CAAC;AACpB,CAAC;AAzDD,4DAyDC","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 { 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 {\n DetectorSync,\n envDetectorSync,\n hostDetectorSync,\n osDetectorSync,\n processDetectorSync,\n serviceInstanceIdDetectorSync,\n} from '@opentelemetry/resources';\nimport {\n BatchSpanProcessor,\n ConsoleSpanExporter,\n SimpleSpanProcessor,\n SpanExporter,\n SpanProcessor,\n} from '@opentelemetry/sdk-trace-base';\n\nconst RESOURCE_DETECTOR_ENVIRONMENT = 'env';\nconst RESOURCE_DETECTOR_HOST = 'host';\nconst RESOURCE_DETECTOR_OS = 'os';\nconst RESOURCE_DETECTOR_PROCESS = 'process';\nconst RESOURCE_DETECTOR_SERVICE_INSTANCE_ID = 'serviceinstance';\n\nexport function getResourceDetectorsFromEnv(): Array<DetectorSync> {\n // When updating this list, make sure to also update the section `resourceDetectors` on README.\n const resourceDetectors = new Map<string, DetectorSync>([\n [RESOURCE_DETECTOR_ENVIRONMENT, envDetectorSync],\n [RESOURCE_DETECTOR_HOST, hostDetectorSync],\n [RESOURCE_DETECTOR_OS, osDetectorSync],\n [RESOURCE_DETECTOR_SERVICE_INSTANCE_ID, serviceInstanceIdDetectorSync],\n [RESOURCE_DETECTOR_PROCESS, processDetectorSync],\n ]);\n\n const resourceDetectorsFromEnv =\n process.env.OTEL_NODE_RESOURCE_DETECTORS?.split(',') ?? ['all'];\n\n if (resourceDetectorsFromEnv.includes('all')) {\n return [...resourceDetectors.values()].flat();\n }\n\n if (resourceDetectorsFromEnv.includes('none')) {\n return [];\n }\n\n return resourceDetectorsFromEnv.flatMap(detector => {\n const resourceDetector = resourceDetectors.get(detector);\n if (!resourceDetector) {\n diag.warn(\n `Invalid resource detector \"${detector}\" specified in the environment variable OTEL_NODE_RESOURCE_DETECTORS`\n );\n }\n return resourceDetector || [];\n });\n}\n\nexport function filterBlanksAndNulls(list: string[]): string[] {\n return list.map(item => item.trim()).filter(s => s !== 'null' && s !== '');\n}\n\nexport function getOtlpProtocolFromEnv(): 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\nfunction getOtlpExporterFromEnv(): SpanExporter {\n const protocol = getOtlpProtocolFromEnv();\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\nfunction getJaegerExporter() {\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\nexport function getSpanProcessorsFromEnv(): SpanProcessor[] {\n const exportersMap = new Map<string, () => SpanExporter>([\n ['otlp', () => getOtlpExporterFromEnv()],\n ['zipkin', () => new ZipkinExporter()],\n ['console', () => new ConsoleSpanExporter()],\n ['jaeger', () => getJaegerExporter()],\n ]);\n const exporters: SpanExporter[] = [];\n const processors: SpanProcessor[] = [];\n let traceExportersList = 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 return [];\n }\n\n if (traceExportersList.length === 0) {\n diag.warn('OTEL_TRACES_EXPORTER is empty. Using default otlp exporter.');\n traceExportersList = ['otlp'];\n } else 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 for (const name of traceExportersList) {\n const exporter = exportersMap.get(name)?.();\n if (exporter) {\n exporters.push(exporter);\n } else {\n diag.warn(`Unrecognized OTEL_TRACES_EXPORTER value: ${name}.`);\n }\n }\n\n for (const exp of exporters) {\n if (exp instanceof ConsoleSpanExporter) {\n processors.push(new SimpleSpanProcessor(exp));\n } else {\n processors.push(new BatchSpanProcessor(exp));\n }\n }\n\n if (exporters.length === 0) {\n diag.warn(\n 'Unable to set up trace exporter(s) due to invalid exporter and/or protocol values.'\n );\n }\n\n return processors;\n}\n"]}
1
+ {"version":3,"file":"utils.js","sourceRoot":"","sources":["../../src/utils.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;;;AAEH,4CAA6D;AAC7D,8CAK6B;AAC7B,wFAAuG;AACvG,sFAAqG;AACrG,sFAAqG;AACrG,oEAAgE;AAChE,wDAOkC;AAClC,kEAMuC;AACvC,gEAA8E;AAC9E,wEAAoE;AAEpE,MAAM,6BAA6B,GAAG,KAAK,CAAC;AAC5C,MAAM,sBAAsB,GAAG,MAAM,CAAC;AACtC,MAAM,oBAAoB,GAAG,IAAI,CAAC;AAClC,MAAM,yBAAyB,GAAG,SAAS,CAAC;AAC5C,MAAM,qCAAqC,GAAG,iBAAiB,CAAC;AAEhE,SAAgB,2BAA2B;IACzC,+FAA+F;IAC/F,MAAM,iBAAiB,GAAG,IAAI,GAAG,CAA2B;QAC1D,CAAC,6BAA6B,EAAE,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AAC,IAAI,CAAC,IAAI,CAAC,CAAC;SACjB;QACD,OAAO,IAAI,CAAC;IACd,CAAC,EACD,EAAE,CACH,CAAC;IAEF,IAAI,gBAAgB,CAAC,MAAM,KAAK,CAAC,EAAE;QACjC,uEAAuE;QACvE,OAAO,IAAI,CAAC;KACb;SAAM,IAAI,qBAAqB,CAAC,MAAM,KAAK,CAAC,EAAE;QAC7C,OAAO,gBAAgB,CAAC,CAAC,CAAC,CAAC;KAC5B;SAAM;QACL,OAAO,IAAI,0BAAmB,CAAC;YAC7B,WAAW,EAAE,gBAAgB;SAC9B,CAAC,CAAC;KACJ;AACH,CAAC;AAxDD,oDAwDC","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, TextMapPropagator } from '@opentelemetry/api';\nimport {\n CompositePropagator,\n getStringFromEnv,\n getStringListFromEnv,\n W3CTraceContextPropagator,\n} from '@opentelemetry/core';\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 {\n envDetector,\n hostDetector,\n osDetector,\n processDetector,\n ResourceDetector,\n serviceInstanceIdDetector,\n} from '@opentelemetry/resources';\nimport {\n BatchSpanProcessor,\n ConsoleSpanExporter,\n SimpleSpanProcessor,\n SpanExporter,\n SpanProcessor,\n} from '@opentelemetry/sdk-trace-base';\nimport { B3InjectEncoding, B3Propagator } from '@opentelemetry/propagator-b3';\nimport { JaegerPropagator } from '@opentelemetry/propagator-jaeger';\n\nconst RESOURCE_DETECTOR_ENVIRONMENT = 'env';\nconst RESOURCE_DETECTOR_HOST = 'host';\nconst RESOURCE_DETECTOR_OS = 'os';\nconst RESOURCE_DETECTOR_PROCESS = 'process';\nconst RESOURCE_DETECTOR_SERVICE_INSTANCE_ID = 'serviceinstance';\n\nexport function getResourceDetectorsFromEnv(): Array<ResourceDetector> {\n // When updating this list, make sure to also update the section `resourceDetectors` on README.\n const resourceDetectors = new Map<string, ResourceDetector>([\n [RESOURCE_DETECTOR_ENVIRONMENT, envDetector],\n [RESOURCE_DETECTOR_HOST, hostDetector],\n [RESOURCE_DETECTOR_OS, osDetector],\n [RESOURCE_DETECTOR_SERVICE_INSTANCE_ID, serviceInstanceIdDetector],\n [RESOURCE_DETECTOR_PROCESS, processDetector],\n ]);\n\n const resourceDetectorsFromEnv =\n process.env.OTEL_NODE_RESOURCE_DETECTORS?.split(',') ?? ['all'];\n\n if (resourceDetectorsFromEnv.includes('all')) {\n return [...resourceDetectors.values()].flat();\n }\n\n if (resourceDetectorsFromEnv.includes('none')) {\n return [];\n }\n\n return resourceDetectorsFromEnv.flatMap(detector => {\n const resourceDetector = resourceDetectors.get(detector);\n if (!resourceDetector) {\n diag.warn(\n `Invalid resource detector \"${detector}\" specified in the environment variable OTEL_NODE_RESOURCE_DETECTORS`\n );\n }\n return resourceDetector || [];\n });\n}\n\nexport function filterBlanksAndNulls(list: string[]): string[] {\n return list.map(item => item.trim()).filter(s => s !== 'null' && s !== '');\n}\n\nexport function getOtlpProtocolFromEnv(): string {\n return (\n getStringFromEnv('OTEL_EXPORTER_OTLP_TRACES_PROTOCOL') ??\n getStringFromEnv('OTEL_EXPORTER_OTLP_PROTOCOL') ??\n 'http/protobuf'\n );\n}\n\nfunction getOtlpExporterFromEnv(): SpanExporter {\n const protocol = getOtlpProtocolFromEnv();\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\nfunction getJaegerExporter() {\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\nexport function getSpanProcessorsFromEnv(): SpanProcessor[] {\n const exportersMap = new Map<string, () => SpanExporter>([\n ['otlp', () => getOtlpExporterFromEnv()],\n ['zipkin', () => new ZipkinExporter()],\n ['console', () => new ConsoleSpanExporter()],\n ['jaeger', () => getJaegerExporter()],\n ]);\n const exporters: SpanExporter[] = [];\n const processors: SpanProcessor[] = [];\n let traceExportersList = filterBlanksAndNulls(\n Array.from(new Set(getStringListFromEnv('OTEL_TRACES_EXPORTER')))\n );\n\n if (traceExportersList[0] === 'none') {\n diag.warn(\n 'OTEL_TRACES_EXPORTER contains \"none\". SDK will not be initialized.'\n );\n return [];\n }\n\n if (traceExportersList.length === 0) {\n diag.debug('OTEL_TRACES_EXPORTER is empty. Using default otlp exporter.');\n traceExportersList = ['otlp'];\n } else 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 for (const name of traceExportersList) {\n const exporter = exportersMap.get(name)?.();\n if (exporter) {\n exporters.push(exporter);\n } else {\n diag.warn(`Unrecognized OTEL_TRACES_EXPORTER value: ${name}.`);\n }\n }\n\n for (const exp of exporters) {\n if (exp instanceof ConsoleSpanExporter) {\n processors.push(new SimpleSpanProcessor(exp));\n } else {\n processors.push(new BatchSpanProcessor(exp));\n }\n }\n\n if (exporters.length === 0) {\n diag.warn(\n 'Unable to set up trace exporter(s) due to invalid exporter and/or protocol values.'\n );\n }\n\n return processors;\n}\n\n/**\n * Get a propagator as defined by environment variables\n */\nexport function getPropagatorFromEnv(): TextMapPropagator | null | undefined {\n // Empty and undefined MUST be treated equal.\n const propagatorsEnvVarValue = getStringListFromEnv('OTEL_PROPAGATORS');\n if (propagatorsEnvVarValue == null) {\n // return undefined to fall back to default\n return undefined;\n }\n\n // Implementation note: this only contains specification required propagators that are actually hosted in this repo.\n // Any other propagators (like aws, aws-lambda, should go into `@opentelemetry/auto-configuration-propagators` instead).\n const propagatorsFactory = new Map<string, () => TextMapPropagator>([\n ['tracecontext', () => new W3CTraceContextPropagator()],\n ['baggage', () => new W3CTraceContextPropagator()],\n ['b3', () => new B3Propagator()],\n [\n 'b3multi',\n () => new B3Propagator({ injectEncoding: B3InjectEncoding.MULTI_HEADER }),\n ],\n ['jaeger', () => new JaegerPropagator()],\n ]);\n\n // Values MUST be deduplicated in order to register a Propagator only once.\n const uniquePropagatorNames = Array.from(new Set(propagatorsEnvVarValue));\n\n const propagators = uniquePropagatorNames.map(name => {\n const propagator = propagatorsFactory.get(name)?.();\n if (!propagator) {\n diag.warn(\n `Propagator \"${name}\" requested through environment variable is unavailable.`\n );\n return undefined;\n }\n\n return propagator;\n });\n\n const validPropagators = propagators.reduce<TextMapPropagator[]>(\n (list, item) => {\n if (item) {\n list.push(item);\n }\n return list;\n },\n []\n );\n\n if (validPropagators.length === 0) {\n // null to signal that the default should **not** be used in its place.\n return null;\n } else if (uniquePropagatorNames.length === 1) {\n return validPropagators[0];\n } else {\n return new CompositePropagator({\n propagators: validPropagators,\n });\n }\n}\n"]}
@@ -1,2 +1,2 @@
1
- export declare const VERSION = "0.57.1";
1
+ export declare const VERSION = "0.200.0-dev.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.57.1';
20
+ exports.VERSION = '0.200.0-dev.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.57.1';\n"]}
1
+ {"version":3,"file":"version.js","sourceRoot":"","sources":["../../src/version.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;;;AAEH,4DAA4D;AAC/C,QAAA,OAAO,GAAG,eAAe,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.200.0-dev.0';\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@opentelemetry/sdk-node",
3
- "version": "0.57.1",
3
+ "version": "0.200.0-dev.0",
4
4
  "description": "OpenTelemetry SDK for Node.js",
5
5
  "main": "build/src/index.js",
6
6
  "types": "build/src/index.d.ts",
@@ -31,7 +31,7 @@
31
31
  "author": "OpenTelemetry Authors",
32
32
  "license": "Apache-2.0",
33
33
  "engines": {
34
- "node": ">=14"
34
+ "node": "^18.19.0 || >=20.6.0"
35
35
  },
36
36
  "files": [
37
37
  "build/src/**/*.js",
@@ -44,48 +44,48 @@
44
44
  "access": "public"
45
45
  },
46
46
  "dependencies": {
47
- "@opentelemetry/api-logs": "0.57.1",
48
- "@opentelemetry/core": "1.30.1",
49
- "@opentelemetry/exporter-logs-otlp-grpc": "0.57.1",
50
- "@opentelemetry/exporter-logs-otlp-http": "0.57.1",
51
- "@opentelemetry/exporter-logs-otlp-proto": "0.57.1",
52
- "@opentelemetry/exporter-metrics-otlp-grpc": "0.57.1",
53
- "@opentelemetry/exporter-metrics-otlp-http": "0.57.1",
54
- "@opentelemetry/exporter-metrics-otlp-proto": "0.57.1",
55
- "@opentelemetry/exporter-prometheus": "0.57.1",
56
- "@opentelemetry/exporter-trace-otlp-grpc": "0.57.1",
57
- "@opentelemetry/exporter-trace-otlp-http": "0.57.1",
58
- "@opentelemetry/exporter-trace-otlp-proto": "0.57.1",
59
- "@opentelemetry/exporter-zipkin": "1.30.1",
60
- "@opentelemetry/instrumentation": "0.57.1",
61
- "@opentelemetry/resources": "1.30.1",
62
- "@opentelemetry/sdk-logs": "0.57.1",
63
- "@opentelemetry/sdk-metrics": "1.30.1",
64
- "@opentelemetry/sdk-trace-base": "1.30.1",
65
- "@opentelemetry/sdk-trace-node": "1.30.1",
66
- "@opentelemetry/semantic-conventions": "1.28.0"
47
+ "@opentelemetry/api-logs": "0.200.0-dev.0",
48
+ "@opentelemetry/core": "2.0.0-dev.0",
49
+ "@opentelemetry/exporter-logs-otlp-grpc": "0.200.0-dev.0",
50
+ "@opentelemetry/exporter-logs-otlp-http": "0.200.0-dev.0",
51
+ "@opentelemetry/exporter-logs-otlp-proto": "0.200.0-dev.0",
52
+ "@opentelemetry/exporter-metrics-otlp-grpc": "0.200.0-dev.0",
53
+ "@opentelemetry/exporter-metrics-otlp-http": "0.200.0-dev.0",
54
+ "@opentelemetry/exporter-metrics-otlp-proto": "0.200.0-dev.0",
55
+ "@opentelemetry/exporter-prometheus": "0.200.0-dev.0",
56
+ "@opentelemetry/exporter-trace-otlp-grpc": "0.200.0-dev.0",
57
+ "@opentelemetry/exporter-trace-otlp-http": "0.200.0-dev.0",
58
+ "@opentelemetry/exporter-trace-otlp-proto": "0.200.0-dev.0",
59
+ "@opentelemetry/exporter-zipkin": "2.0.0-dev.0",
60
+ "@opentelemetry/instrumentation": "0.200.0-dev.0",
61
+ "@opentelemetry/propagator-b3": "2.0.0-dev.0",
62
+ "@opentelemetry/propagator-jaeger": "2.0.0-dev.0",
63
+ "@opentelemetry/resources": "2.0.0-dev.0",
64
+ "@opentelemetry/sdk-logs": "0.200.0-dev.0",
65
+ "@opentelemetry/sdk-metrics": "2.0.0-dev.0",
66
+ "@opentelemetry/sdk-trace-base": "2.0.0-dev.0",
67
+ "@opentelemetry/sdk-trace-node": "2.0.0-dev.0",
68
+ "@opentelemetry/semantic-conventions": "^1.29.0"
67
69
  },
68
70
  "peerDependencies": {
69
71
  "@opentelemetry/api": ">=1.3.0 <1.10.0"
70
72
  },
71
73
  "devDependencies": {
72
74
  "@opentelemetry/api": "1.9.0",
73
- "@opentelemetry/context-async-hooks": "1.30.1",
74
- "@opentelemetry/exporter-jaeger": "1.30.1",
75
+ "@opentelemetry/context-async-hooks": "2.0.0-dev.0",
76
+ "@opentelemetry/exporter-jaeger": "2.0.0-dev.0",
75
77
  "@types/mocha": "10.0.10",
76
78
  "@types/node": "18.6.5",
77
- "@types/semver": "7.5.8",
78
- "@types/sinon": "17.0.3",
79
+ "@types/sinon": "17.0.4",
79
80
  "cross-var": "1.1.0",
80
81
  "lerna": "6.6.2",
81
- "mocha": "10.8.2",
82
- "nyc": "15.1.0",
83
- "semver": "7.6.3",
82
+ "mocha": "11.1.0",
83
+ "nyc": "17.1.0",
84
84
  "sinon": "15.1.2",
85
- "ts-loader": "9.5.1",
86
- "typescript": "4.4.4"
85
+ "ts-loader": "9.5.2",
86
+ "typescript": "5.0.4"
87
87
  },
88
88
  "homepage": "https://github.com/open-telemetry/opentelemetry-js/tree/main/experimental/packages/opentelemetry-sdk-node",
89
89
  "sideEffects": false,
90
- "gitHead": "cbc912d67bda462ca00449d7ce7b80052c20a4fc"
90
+ "gitHead": "544c40984797dd2e2cccb92cce0e88b30f235b02"
91
91
  }