@saidsef/tracing-node 3.5.3 → 3.6.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.
Files changed (2) hide show
  1. package/libs/index.mjs +8 -11
  2. package/package.json +1 -2
package/libs/index.mjs CHANGED
@@ -17,7 +17,6 @@
17
17
  */
18
18
 
19
19
  import {AwsInstrumentation} from '@opentelemetry/instrumentation-aws-sdk';
20
- import {B3Propagator, B3InjectEncoding} from '@opentelemetry/propagator-b3';
21
20
  import {BatchSpanProcessor} from '@opentelemetry/sdk-trace-base';
22
21
  import {CompositePropagator, W3CBaggagePropagator, W3CTraceContextPropagator} from '@opentelemetry/core';
23
22
  import {ConnectInstrumentation} from '@opentelemetry/instrumentation-connect';
@@ -68,7 +67,7 @@ export function setupTracing(options = {}) {
68
67
 
69
68
  // Configure exporter with the Collector endpoint - uses gRPC
70
69
  const exportOptions = {
71
- concurrencyLimit: concurrencyLimit,
70
+ concurrencyLimit: parseInt(concurrencyLimit, 10),
72
71
  url: url,
73
72
  timeoutMillis: 1000,
74
73
  };
@@ -94,27 +93,25 @@ export function setupTracing(options = {}) {
94
93
  tracerProvider.register({
95
94
  propagator: new CompositePropagator({
96
95
  propagators: [
97
- new W3CBaggagePropagator(),
98
96
  new W3CTraceContextPropagator(),
99
- new B3Propagator({ injectEncoding: B3InjectEncoding.MULTI_HEADER }),
97
+ new W3CBaggagePropagator(),
100
98
  ],
101
99
  }),
102
100
  });
103
101
 
104
102
  // Ignore spans from static assets.
105
103
  const ignoreIncomingRequestHook = (req) => {
106
- const isStaticAsset = !!req.url.match(/^\/metrics|\/healthz.*$/);
107
- return isStaticAsset;
104
+ return req.url.startsWith('/metrics') || req.url.startsWith('/healthz');
108
105
  };
109
106
 
110
107
  // Register instrumentations
111
108
  const instrumentations = [
112
- new HttpInstrumentation({ serverName: serviceName, requireParentforOutgoingSpans: false, requireParentforIncomingSpans: false, ignoreIncomingRequestHook, }),
109
+ new HttpInstrumentation({serverName: serviceName, requireParentforOutgoingSpans: true, requireParentforIncomingSpans: true, ignoreIncomingRequestHook,}),
113
110
  new ExpressInstrumentation({ ignoreIncomingRequestHook, }),
114
- new PinoInstrumentation(),
111
+ new PinoInstrumentation({logHook: (span, record) => {record['trace_id'] = span.spanContext().traceId;record['span_id'] = span.spanContext().spanId;},}),
115
112
  new ConnectInstrumentation(),
116
113
  new AwsInstrumentation({ sqsExtractContextPropagationFromPayload: true, }),
117
- new IORedisInstrumentation({ requireParentSpan: false, }),
114
+ new IORedisInstrumentation({ requireParentSpan: true, }),
118
115
  ];
119
116
 
120
117
  if (enableFsInstrumentation) {
@@ -131,8 +128,8 @@ export function setupTracing(options = {}) {
131
128
 
132
129
  // Register instrumentations
133
130
  registerInstrumentations({
134
- tracerProvider: tracerProvider,
135
- instrumentations: instrumentations,
131
+ tracerProvider: tracerProvider,
132
+ instrumentations: instrumentations,
136
133
  });
137
134
 
138
135
  // Return the tracer for the service
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@saidsef/tracing-node",
3
- "version": "3.5.3",
3
+ "version": "3.6.0",
4
4
  "description": "tracing NodeJS - Wrapper for OpenTelemetry instrumentation packages",
5
5
  "main": "libs/index.mjs",
6
6
  "scripts": {
@@ -41,7 +41,6 @@
41
41
  "@opentelemetry/instrumentation-http": "^0.203.0",
42
42
  "@opentelemetry/instrumentation-ioredis": "^0.51.0",
43
43
  "@opentelemetry/instrumentation-pino": "^0.50.0",
44
- "@opentelemetry/propagator-b3": "^2.0.0",
45
44
  "@opentelemetry/resources": "^2.0.1",
46
45
  "@opentelemetry/sdk-trace-base": "^2.0.0",
47
46
  "@opentelemetry/sdk-trace-node": "^2.0.0",