@saidsef/tracing-node 3.12.0 → 3.12.1
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 +25 -37
- package/package.json +1 -1
package/libs/index.mjs
CHANGED
|
@@ -309,46 +309,22 @@ export function setupTracing(options = {}) {
|
|
|
309
309
|
}),
|
|
310
310
|
new IORedisInstrumentation({
|
|
311
311
|
requireParentSpan: false,
|
|
312
|
-
|
|
313
|
-
// Set peer.service for service graph visualization
|
|
312
|
+
requestHook: (span) => {
|
|
313
|
+
// Set peer.service for service graph visualization - CRITICAL for Tempo
|
|
314
|
+
// This must be set in requestHook to ensure it's available for service graph
|
|
314
315
|
span.setAttribute('peer.service', 'redis');
|
|
315
316
|
span.setAttribute('db.system', 'redis');
|
|
316
|
-
|
|
317
|
-
//
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
if (response !== undefined && response !== null) {
|
|
324
|
-
const responseType = typeof response;
|
|
325
|
-
span.setAttribute('db.response.type', responseType);
|
|
326
|
-
|
|
327
|
-
if (Array.isArray(response)) {
|
|
328
|
-
span.setAttribute('db.response.count', response.length);
|
|
329
|
-
}
|
|
330
|
-
}
|
|
317
|
+
|
|
318
|
+
// Ensure span kind is CLIENT for proper service graph visualization
|
|
319
|
+
span.setAttribute('span.kind', 'CLIENT');
|
|
320
|
+
|
|
321
|
+
// Add additional attributes for better service graph visualization
|
|
322
|
+
span.setAttribute('db.connection_string', 'redis');
|
|
323
|
+
span.setAttribute('net.peer.name', 'redis');
|
|
331
324
|
},
|
|
332
|
-
|
|
333
|
-
//
|
|
325
|
+
responseHook: (span) => {
|
|
326
|
+
// Ensure peer.service persists through response
|
|
334
327
|
span.setAttribute('peer.service', 'redis');
|
|
335
|
-
span.setAttribute('db.system', 'redis');
|
|
336
|
-
|
|
337
|
-
// Add command details
|
|
338
|
-
if (cmdName) {
|
|
339
|
-
span.setAttribute('db.operation', cmdName.toUpperCase());
|
|
340
|
-
span.updateName(`redis.${cmdName.toUpperCase()}`);
|
|
341
|
-
}
|
|
342
|
-
|
|
343
|
-
// Add key information (first argument is usually the key)
|
|
344
|
-
if (cmdArgs && cmdArgs.length > 0) {
|
|
345
|
-
span.setAttribute('db.redis.key', String(cmdArgs[0]));
|
|
346
|
-
|
|
347
|
-
// For operations with multiple keys or complex args
|
|
348
|
-
if (cmdArgs.length > 1) {
|
|
349
|
-
span.setAttribute('db.redis.args_count', cmdArgs.length);
|
|
350
|
-
}
|
|
351
|
-
}
|
|
352
328
|
},
|
|
353
329
|
dbStatementSerializer: (cmdName, cmdArgs) => {
|
|
354
330
|
// Serialize command for better observability (limit arg length to avoid huge spans)
|
|
@@ -359,7 +335,19 @@ export function setupTracing(options = {}) {
|
|
|
359
335
|
return `${cmdName} ${args.join(' ')}`;
|
|
360
336
|
},
|
|
361
337
|
}),
|
|
362
|
-
new ElasticsearchInstrumentation(
|
|
338
|
+
new ElasticsearchInstrumentation({
|
|
339
|
+
suppressInternalInstrumentation: true,
|
|
340
|
+
requestHook: (span) => {
|
|
341
|
+
// Set peer.service for service graph visualization - CRITICAL for Tempo
|
|
342
|
+
span.setAttribute('peer.service', 'elasticsearch');
|
|
343
|
+
span.setAttribute('db.system', 'elasticsearch');
|
|
344
|
+
},
|
|
345
|
+
responseHook: (span) => {
|
|
346
|
+
// Ensure peer.service persists through response
|
|
347
|
+
span.setAttribute('peer.service', 'elasticsearch');
|
|
348
|
+
span.setAttribute('db.system', 'elasticsearch');
|
|
349
|
+
},
|
|
350
|
+
}),
|
|
363
351
|
];
|
|
364
352
|
|
|
365
353
|
if (enableFsInstrumentation) {
|