@saidsef/tracing-node 3.2.1 → 3.2.3
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/libs/index.mjs +21 -21
- package/package.json +1 -1
package/libs/index.mjs
CHANGED
|
@@ -68,7 +68,19 @@ export function setupTracing(options = {}) {
|
|
|
68
68
|
concurrencyLimit = 10,
|
|
69
69
|
} = options;
|
|
70
70
|
|
|
71
|
+
// Configure exporter with the Collector endpoint - uses gRPC
|
|
72
|
+
const exportOptions = {
|
|
73
|
+
concurrencyLimit: concurrencyLimit,
|
|
74
|
+
url: url,
|
|
75
|
+
timeoutMillis: 1000,
|
|
76
|
+
};
|
|
77
|
+
|
|
78
|
+
// Register the span processor with the tracer provider
|
|
79
|
+
const exporter = new OTLPTraceExporter(exportOptions);
|
|
80
|
+
const spanProcessor = new BatchSpanProcessor(exporter);
|
|
81
|
+
|
|
71
82
|
tracerProvider = new NodeTracerProvider({
|
|
83
|
+
spanProcessors: [spanProcessor],
|
|
72
84
|
resource: new Resource({
|
|
73
85
|
[SemanticResourceAttributes.CONTAINER_NAME]: containerName || serviceName,
|
|
74
86
|
[SemanticResourceAttributes.DEPLOYMENT_ENVIRONMENT]: deploymentEnvironment,
|
|
@@ -84,25 +96,13 @@ export function setupTracing(options = {}) {
|
|
|
84
96
|
// Initialize the tracer provider with propagators
|
|
85
97
|
tracerProvider.register({
|
|
86
98
|
propagator: new CompositePropagator({
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
}),
|
|
93
|
-
});
|
|
94
|
-
|
|
95
|
-
// Configure exporter with the Collector endpoint - uses gRPC
|
|
96
|
-
const exportOptions = {
|
|
97
|
-
concurrencyLimit: concurrencyLimit,
|
|
98
|
-
url: url,
|
|
99
|
-
timeoutMillis: 1000,
|
|
100
|
-
};
|
|
101
|
-
|
|
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);
|
|
99
|
+
propagators: [
|
|
100
|
+
new W3CBaggagePropagator(),
|
|
101
|
+
new W3CTraceContextPropagator(),
|
|
102
|
+
new B3Propagator({ injectEncoding: B3InjectEncoding.MULTI_HEADER }),
|
|
103
|
+
],
|
|
104
|
+
}),
|
|
105
|
+
});
|
|
106
106
|
|
|
107
107
|
// Ignore spans from static assets.
|
|
108
108
|
const ignoreIncomingRequestHook = (req) => {
|
|
@@ -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);
|