Skip to content

Commit

Permalink
chore: bump version number to reflect dep updates
Browse files Browse the repository at this point in the history
These changes should improve the code organisation and ensure we're using the most up-to-date package versions.
  • Loading branch information
saidsef committed Nov 10, 2024
1 parent af0699c commit 069e7a0
Show file tree
Hide file tree
Showing 3 changed files with 318 additions and 349 deletions.
30 changes: 15 additions & 15 deletions libs/index.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@
*/

import {CompositePropagator, W3CBaggagePropagator, W3CTraceContextPropagator} from '@opentelemetry/core';
import {registerInstrumentations} from '@opentelemetry/instrumentation';
import {NodeTracerProvider} from '@opentelemetry/sdk-trace-node';
import {BatchSpanProcessor} from '@opentelemetry/sdk-trace-base';
import {registerInstrumentations} from '@opentelemetry/instrumentation';
import {OTLPTraceExporter} from '@opentelemetry/exporter-trace-otlp-grpc';
import {HttpInstrumentation} from '@opentelemetry/instrumentation-http';
import {ExpressInstrumentation} from '@opentelemetry/instrumentation-express';
Expand Down Expand Up @@ -77,6 +77,12 @@ export function setupTracing (options={}) {
}),
});

// Initialize the tracer provider
provider.register({
propagator: new CompositePropagator({
propagators: [new W3CBaggagePropagator(), new W3CTraceContextPropagator(), new B3Propagator({injectEncoding: B3InjectEncoding.MULTI_HEADER})],
})});

// Configure exporter with the Collector endpoint - uses gRPC
const exportOptions = {
concurrencyLimit: concurrencyLimit,
Expand All @@ -97,32 +103,26 @@ export function setupTracing (options={}) {
registerInstrumentations({
tracerProvider: provider,
instrumentations: [
new HttpInstrumentation({
requireParentforOutgoingSpans: false,
requireParentforIncomingSpans: false,
ignoreIncomingRequestHook,
}),
new ExpressInstrumentation({
ignoreIncomingRequestHook,
}),
new AwsInstrumentation({
sqsExtractContextPropagationFromPayload: true
}),
new PinoInstrumentation({
logHook: (span, record) => {
record['resource.service.name'] = provider.resource.attributes['service.name'];
},
}),
new HttpInstrumentation({
requireParentforOutgoingSpans: false,
requireParentforIncomingSpans: false,
ignoreIncomingRequestHook,
}),
new AwsInstrumentation({
sqsExtractContextPropagationFromPayload: true
}),
new DnsInstrumentation(),
],
});

// Initialize the tracer provider
provider.register({
propagator: new CompositePropagator({
propagators: [new W3CBaggagePropagator(), new W3CTraceContextPropagator(), new B3Propagator({injectEncoding: B3InjectEncoding.MULTI_HEADER})],
})});

// Return the tracer for the service
return provider.getTracer(serviceName);
}
Loading

0 comments on commit 069e7a0

Please sign in to comment.