@saidsef/tracing-node 3.4.5 → 3.4.6
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/README.md +2 -0
- package/deployment/base/job.yml +1 -1
- package/libs/index.mjs +23 -6
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -54,6 +54,8 @@ setupTracing({hostname: 'hostname', serviceName: 'service_name', url: 'endpoint'
|
|
|
54
54
|
| hostname | string | container / pod hostname |
|
|
55
55
|
| serviceName | string | service / application name |
|
|
56
56
|
| url | string | tracing endpoint i.e. `<schema>://<host>:<port>` |
|
|
57
|
+
| enableFsInstrumentation | boolean | enable FS instrumentation, default `false` |
|
|
58
|
+
| enableDnsInstrumentation | boolean | enable DNS instrumentation, default `false` |
|
|
57
59
|
|
|
58
60
|
## Source
|
|
59
61
|
|
package/deployment/base/job.yml
CHANGED
package/libs/index.mjs
CHANGED
|
@@ -49,6 +49,8 @@ diag.setLogger(new DiagConsoleLogger(), DiagLogLevel.INFO);
|
|
|
49
49
|
* @param {string} [options.serviceName=process.env.SERVICE_NAME] - The name of the service.
|
|
50
50
|
* @param {string} [options.url=process.env.ENDPOINT] - The endpoint URL for the tracing collector.
|
|
51
51
|
* @param {number} [options.concurrencyLimit=10] - The concurrency limit for the exporter.
|
|
52
|
+
* @param {boolean} [options.enableFsInstrumentation=false] - Enable file system instrumentation.
|
|
53
|
+
* @param {boolean} [options.enableDnsInstrumentation=false] - Enable DNS instrumentation.
|
|
52
54
|
*
|
|
53
55
|
* @returns {Tracer} - The tracer for the service.
|
|
54
56
|
*/
|
|
@@ -60,6 +62,8 @@ export function setupTracing(options = {}) {
|
|
|
60
62
|
serviceName = process.env.SERVICE_NAME,
|
|
61
63
|
url = process.env.ENDPOINT,
|
|
62
64
|
concurrencyLimit = 10,
|
|
65
|
+
enableFsInstrumentation = false,
|
|
66
|
+
enableDnsInstrumentation = false,
|
|
63
67
|
} = options;
|
|
64
68
|
|
|
65
69
|
// Configure exporter with the Collector endpoint - uses gRPC
|
|
@@ -103,18 +107,31 @@ export function setupTracing(options = {}) {
|
|
|
103
107
|
};
|
|
104
108
|
|
|
105
109
|
// Register instrumentations
|
|
106
|
-
|
|
107
|
-
tracerProvider: tracerProvider,
|
|
108
|
-
instrumentations: [
|
|
110
|
+
const instrumentations = [
|
|
109
111
|
new PinoInstrumentation(),
|
|
110
112
|
new HttpInstrumentation({ requireParentforOutgoingSpans: false, requireParentforIncomingSpans: false, ignoreIncomingRequestHook, }),
|
|
111
113
|
new ExpressInstrumentation({ ignoreIncomingRequestHook, }),
|
|
112
114
|
new ConnectInstrumentation(),
|
|
113
115
|
new AwsInstrumentation({ sqsExtractContextPropagationFromPayload: true, }),
|
|
114
116
|
new IORedisInstrumentation(),
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
117
|
+
];
|
|
118
|
+
|
|
119
|
+
if (enableFsInstrumentation) {
|
|
120
|
+
// Enable fs instrumentation if specified
|
|
121
|
+
// This instrumentation is useful for tracing file system operations.
|
|
122
|
+
instrumentations.push(new FsInstrumentation());
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
if (enableDnsInstrumentation) {
|
|
126
|
+
// Enable DNS instrumentation if specified
|
|
127
|
+
// This instrumentation is useful for tracing DNS operations.
|
|
128
|
+
instrumentations.push(new DnsInstrumentation());
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
// Register instrumentations
|
|
132
|
+
registerInstrumentations({
|
|
133
|
+
tracerProvider: tracerProvider,
|
|
134
|
+
instrumentations: instrumentations,
|
|
118
135
|
});
|
|
119
136
|
|
|
120
137
|
// Return the tracer for the service
|