|
4 | 4 |
|
5 | 5 | import { TextMapPropagator, diag } from '@opentelemetry/api'; |
6 | 6 | import { getResourceDetectors as getResourceDetectorsFromEnv } from '@opentelemetry/auto-instrumentations-node'; |
7 | | -import { CompositePropagator, ENVIRONMENT, TracesSamplerValues, getEnv, getEnvWithoutDefaults, W3CBaggagePropagator, W3CTraceContextPropagator } from '@opentelemetry/core'; |
| 7 | +import { |
| 8 | + CompositePropagator, |
| 9 | + ENVIRONMENT, |
| 10 | + TracesSamplerValues, |
| 11 | + getEnv, |
| 12 | + getEnvWithoutDefaults, |
| 13 | + W3CBaggagePropagator, |
| 14 | + W3CTraceContextPropagator, |
| 15 | +} from '@opentelemetry/core'; |
8 | 16 | import { OTLPMetricExporter as OTLPGrpcOTLPMetricExporter } from '@opentelemetry/exporter-metrics-otlp-grpc'; |
9 | 17 | import { |
10 | 18 | AggregationTemporalityPreference, |
@@ -199,36 +207,24 @@ export class AwsOpentelemetryConfigurator { |
199 | 207 | } |
200 | 208 |
|
201 | 209 | private getPropagator(): TextMapPropagator { |
202 | | - if ( |
203 | | - process.env.OTEL_PROPAGATORS == null || |
204 | | - process.env.OTEL_PROPAGATORS.trim() === '' |
205 | | - ) { |
| 210 | + if (process.env.OTEL_PROPAGATORS == null || process.env.OTEL_PROPAGATORS.trim() === '') { |
206 | 211 | return new CompositePropagator({ |
207 | | - propagators: [ |
208 | | - new W3CTraceContextPropagator(), |
209 | | - new W3CBaggagePropagator(), |
210 | | - ], |
| 212 | + propagators: [new W3CTraceContextPropagator(), new W3CBaggagePropagator()], |
211 | 213 | }); |
212 | 214 | } |
213 | 215 | const propagatorsFromEnv = Array.from( |
214 | | - new Set( |
215 | | - process.env.OTEL_PROPAGATORS?.split(',').map(value => |
216 | | - value.toLowerCase().trim(), |
217 | | - ), |
218 | | - ), |
| 216 | + new Set(process.env.OTEL_PROPAGATORS?.split(',').map(value => value.toLowerCase().trim())) |
219 | 217 | ); |
220 | 218 | const propagators = propagatorsFromEnv.flatMap(propagatorName => { |
221 | 219 | if (propagatorName === 'none') { |
222 | 220 | diag.info( |
223 | | - 'Not selecting any propagator for value "none" specified in the environment variable OTEL_PROPAGATORS', |
| 221 | + 'Not selecting any propagator for value "none" specified in the environment variable OTEL_PROPAGATORS' |
224 | 222 | ); |
225 | 223 | return []; |
226 | 224 | } |
227 | 225 | const propagatorFactoryFunction = propagatorMap.get(propagatorName); |
228 | 226 | if (propagatorFactoryFunction == null) { |
229 | | - diag.warn( |
230 | | - `Invalid propagator "${propagatorName}" specified in the environment variable OTEL_PROPAGATORS`, |
231 | | - ); |
| 227 | + diag.warn(`Invalid propagator "${propagatorName}" specified in the environment variable OTEL_PROPAGATORS`); |
232 | 228 | return []; |
233 | 229 | } |
234 | 230 | return propagatorFactoryFunction(); |
|
0 commit comments