@saidsef/tracing-node 3.4.5 → 3.4.7

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 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
 
@@ -34,4 +34,4 @@ spec:
34
34
  gitRepo:
35
35
  directory: "."
36
36
  repository: "https://github.com/saidsef/tracing-node.git"
37
- revision: "dependabot-npm_and_yarn-opentelemetry-instrumentation-aws-sdk-0.50.0"
37
+ revision: "optional-dns-fs-instrumentation"
package/libs/index.mjs CHANGED
@@ -22,9 +22,9 @@ import {BatchSpanProcessor} from '@opentelemetry/sdk-trace-base';
22
22
  import {CompositePropagator, W3CBaggagePropagator, W3CTraceContextPropagator} from '@opentelemetry/core';
23
23
  import {ConnectInstrumentation} from '@opentelemetry/instrumentation-connect';
24
24
  import {diag, DiagConsoleLogger, DiagLogLevel} from '@opentelemetry/api';
25
+ import {HttpInstrumentation} from '@opentelemetry/instrumentation-http';
25
26
  import {DnsInstrumentation} from '@opentelemetry/instrumentation-dns';
26
27
  import {ExpressInstrumentation} from '@opentelemetry/instrumentation-express';
27
- import {HttpInstrumentation} from '@opentelemetry/instrumentation-http';
28
28
  import {NodeTracerProvider} from '@opentelemetry/sdk-trace-node';
29
29
  import {OTLPTraceExporter} from '@opentelemetry/exporter-trace-otlp-grpc';
30
30
  import {PinoInstrumentation} from '@opentelemetry/instrumentation-pino';
@@ -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
- registerInstrumentations({
107
- tracerProvider: tracerProvider,
108
- instrumentations: [
109
- new PinoInstrumentation(),
110
- new HttpInstrumentation({ requireParentforOutgoingSpans: false, requireParentforIncomingSpans: false, ignoreIncomingRequestHook, }),
110
+ const instrumentations = [
111
+ new HttpInstrumentation({ serverName: serviceName, requireParentforOutgoingSpans: false, requireParentforIncomingSpans: false, ignoreIncomingRequestHook, }),
111
112
  new ExpressInstrumentation({ ignoreIncomingRequestHook, }),
113
+ new PinoInstrumentation(),
112
114
  new ConnectInstrumentation(),
113
115
  new AwsInstrumentation({ sqsExtractContextPropagationFromPayload: true, }),
114
- new IORedisInstrumentation(),
115
- new FsInstrumentation(),
116
- new DnsInstrumentation(),
117
- ],
116
+ new IORedisInstrumentation({ requireParentSpan: false, }),
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
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@saidsef/tracing-node",
3
- "version": "3.4.5",
3
+ "version": "3.4.7",
4
4
  "description": "tracing NodeJS - Wrapper for OpenTelemetry instrumentation packages",
5
5
  "main": "libs/index.mjs",
6
6
  "scripts": {