@saidsef/tracing-node 3.2.1 → 3.2.2

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.
Files changed (2) hide show
  1. package/libs/index.mjs +14 -14
  2. package/package.json +1 -1
package/libs/index.mjs CHANGED
@@ -68,7 +68,12 @@ export function setupTracing(options = {}) {
68
68
  concurrencyLimit = 10,
69
69
  } = options;
70
70
 
71
+ // Register the span processor with the tracer provider
72
+ const exporter = new OTLPTraceExporter(exportOptions);
73
+ const spanProcessor = new BatchSpanProcessor(exporter);
74
+
71
75
  tracerProvider = new NodeTracerProvider({
76
+ spanProcessors: [spanProcessor],
72
77
  resource: new Resource({
73
78
  [SemanticResourceAttributes.CONTAINER_NAME]: containerName || serviceName,
74
79
  [SemanticResourceAttributes.DEPLOYMENT_ENVIRONMENT]: deploymentEnvironment,
@@ -84,13 +89,13 @@ export function setupTracing(options = {}) {
84
89
  // Initialize the tracer provider with propagators
85
90
  tracerProvider.register({
86
91
  propagator: new CompositePropagator({
87
- propagators: [
88
- new W3CBaggagePropagator(),
89
- new W3CTraceContextPropagator(),
90
- new B3Propagator({ injectEncoding: B3InjectEncoding.MULTI_HEADER }),
91
- ],
92
- }),
93
- });
92
+ propagators: [
93
+ new W3CBaggagePropagator(),
94
+ new W3CTraceContextPropagator(),
95
+ new B3Propagator({ injectEncoding: B3InjectEncoding.MULTI_HEADER }),
96
+ ],
97
+ }),
98
+ });
94
99
 
95
100
  // Configure exporter with the Collector endpoint - uses gRPC
96
101
  const exportOptions = {
@@ -99,11 +104,6 @@ export function setupTracing(options = {}) {
99
104
  timeoutMillis: 1000,
100
105
  };
101
106
 
102
- // Register the span processor with the tracer provider
103
- const exporter = new OTLPTraceExporter(exportOptions);
104
- const spanProcessor = new BatchSpanProcessor(exporter);
105
- tracerProvider.activeSpanProcessor(spanProcessor);
106
-
107
107
  // Ignore spans from static assets.
108
108
  const ignoreIncomingRequestHook = (req) => {
109
109
  const isStaticAsset = !!req.url.match(/^\/metrics|\/healthz.*$/);
@@ -121,8 +121,8 @@ export function setupTracing(options = {}) {
121
121
  new AwsInstrumentation({ sqsExtractContextPropagationFromPayload: true, }),
122
122
  new DnsInstrumentation(),
123
123
  new RedisInstrumentation(),
124
- ],
125
- });
124
+ ],
125
+ });
126
126
 
127
127
  // Return the tracer for the service
128
128
  return tracerProvider.getTracer(serviceName);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@saidsef/tracing-node",
3
- "version": "3.2.1",
3
+ "version": "3.2.2",
4
4
  "description": "tracing NodeJS - This is a wrapper for OpenTelemetry instrumentation packages",
5
5
  "main": "libs/index.mjs",
6
6
  "scripts": {