@saidsef/tracing-node 3.6.0 → 3.7.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/README.md +14 -22
- package/libs/index.mjs +4 -2
- package/package.json +3 -2
package/README.md
CHANGED
|
@@ -7,17 +7,14 @@
|
|
|
7
7
|

|
|
8
8
|

|
|
9
9
|
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
10
|
Get telemetry for your app in less than 3 minutes!
|
|
14
11
|
|
|
15
|
-
|
|
12
|
+
Effortlessly supercharge your applications with world-class distributed tracing! This OpenTelemetry wrapper delivers seamless, lightning-fast observability, empowering developers to monitor, debug, and optimise microservices with ease. Designed for modern cloud-native environments, it’s the smart choice for engineers who demand reliability, scalability, and actionable insights. Get started in minutes and unlock the full potential of your service architecture—no fuss, just results. This is to make instrumentation (more) idempotent.
|
|
16
13
|
|
|
17
14
|
## Prerequisites
|
|
18
15
|
- NodeJS
|
|
19
16
|
- ...
|
|
20
|
-
- Profit
|
|
17
|
+
- Profit?
|
|
21
18
|
|
|
22
19
|
## Instalation
|
|
23
20
|
|
|
@@ -30,18 +27,13 @@ npm install @saidsef/tracing-node --save
|
|
|
30
27
|
You can set required params via env variables or function:
|
|
31
28
|
|
|
32
29
|
Env vars:
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
30
|
+
| Environment Variable | Description | Required |
|
|
31
|
+
|-----------------------|----------------------------| --------- |
|
|
32
|
+
| CONTAINER_NAME/HOSTNAME| Container or pod hostname | No |
|
|
33
|
+
| ENDPOINT | Tracing collector endpoint | Yes |
|
|
34
|
+
| SERVICE_NAME | Service/application name | Yes |
|
|
38
35
|
|
|
39
36
|
Function args
|
|
40
|
-
```
|
|
41
|
-
const { setupTracing } = require('@saidsef/tracing-node');
|
|
42
|
-
setupTracing({hostname: 'hostname', serviceName: 'service_name', url: 'endpoint'});
|
|
43
|
-
```
|
|
44
|
-
|
|
45
37
|
```
|
|
46
38
|
import { setupTracing } from '@saidsef/tracing-node';
|
|
47
39
|
setupTracing({hostname: 'hostname', serviceName: 'service_name', url: 'endpoint'});
|
|
@@ -49,13 +41,13 @@ setupTracing({hostname: 'hostname', serviceName: 'service_name', url: 'endpoint'
|
|
|
49
41
|
|
|
50
42
|
### Required Parameters are
|
|
51
43
|
|
|
52
|
-
| Name | Type | Description|
|
|
53
|
-
|----- | ---- | ------------- |
|
|
54
|
-
| hostname | string | container / pod hostname |
|
|
55
|
-
| serviceName | string | service / application name |
|
|
56
|
-
| url | string | tracing endpoint i.e. `<schema>://<host>:<port>` |
|
|
57
|
-
| enableFsInstrumentation | boolean | enable FS instrumentation
|
|
58
|
-
| enableDnsInstrumentation | boolean | enable DNS instrumentation
|
|
44
|
+
| Name | Type | Description| Required | Default |
|
|
45
|
+
|----- | ---- | ------------- | ----- | ---- |
|
|
46
|
+
| hostname | string | container / pod hostname | No | `hostname` |
|
|
47
|
+
| serviceName | string | service / application name | Yes | `n/a` |
|
|
48
|
+
| url | string | tracing endpoint i.e. `<schema>://<host>:<port>` | Yes | `n/a` |
|
|
49
|
+
| enableFsInstrumentation | boolean | enable FS instrumentation | No | `false` |
|
|
50
|
+
| enableDnsInstrumentation | boolean | enable DNS instrumentation | No | `false` |
|
|
59
51
|
|
|
60
52
|
## Source
|
|
61
53
|
|
package/libs/index.mjs
CHANGED
|
@@ -17,6 +17,7 @@
|
|
|
17
17
|
*/
|
|
18
18
|
|
|
19
19
|
import {AwsInstrumentation} from '@opentelemetry/instrumentation-aws-sdk';
|
|
20
|
+
import {AsyncHooksContextManager} from '@opentelemetry/context-async-hooks';
|
|
20
21
|
import {BatchSpanProcessor} from '@opentelemetry/sdk-trace-base';
|
|
21
22
|
import {CompositePropagator, W3CBaggagePropagator, W3CTraceContextPropagator} from '@opentelemetry/core';
|
|
22
23
|
import {ConnectInstrumentation} from '@opentelemetry/instrumentation-connect';
|
|
@@ -91,6 +92,7 @@ export function setupTracing(options = {}) {
|
|
|
91
92
|
|
|
92
93
|
// Initialize the tracer provider with propagators
|
|
93
94
|
tracerProvider.register({
|
|
95
|
+
contextManager: new AsyncHooksContextManager().enable(),
|
|
94
96
|
propagator: new CompositePropagator({
|
|
95
97
|
propagators: [
|
|
96
98
|
new W3CTraceContextPropagator(),
|
|
@@ -106,12 +108,12 @@ export function setupTracing(options = {}) {
|
|
|
106
108
|
|
|
107
109
|
// Register instrumentations
|
|
108
110
|
const instrumentations = [
|
|
109
|
-
new HttpInstrumentation({serverName: serviceName,
|
|
111
|
+
new HttpInstrumentation({serverName: serviceName, ignoreIncomingRequestHook,}),
|
|
110
112
|
new ExpressInstrumentation({ ignoreIncomingRequestHook, }),
|
|
111
113
|
new PinoInstrumentation({logHook: (span, record) => {record['trace_id'] = span.spanContext().traceId;record['span_id'] = span.spanContext().spanId;},}),
|
|
112
114
|
new ConnectInstrumentation(),
|
|
113
115
|
new AwsInstrumentation({ sqsExtractContextPropagationFromPayload: true, }),
|
|
114
|
-
new IORedisInstrumentation(
|
|
116
|
+
new IORedisInstrumentation(),
|
|
115
117
|
];
|
|
116
118
|
|
|
117
119
|
if (enableFsInstrumentation) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@saidsef/tracing-node",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.7.3",
|
|
4
4
|
"description": "tracing NodeJS - Wrapper for OpenTelemetry instrumentation packages",
|
|
5
5
|
"main": "libs/index.mjs",
|
|
6
6
|
"scripts": {
|
|
@@ -31,9 +31,10 @@
|
|
|
31
31
|
"homepage": "https://github.com/saidsef/tracing-node#readme",
|
|
32
32
|
"dependencies": {
|
|
33
33
|
"@opentelemetry/api": "^1.9.0",
|
|
34
|
+
"@opentelemetry/context-async-hooks": "^2.0.1",
|
|
34
35
|
"@opentelemetry/exporter-trace-otlp-grpc": "^0.203.0",
|
|
35
36
|
"@opentelemetry/instrumentation": "^0.203.0",
|
|
36
|
-
"@opentelemetry/instrumentation-aws-sdk": "^0.
|
|
37
|
+
"@opentelemetry/instrumentation-aws-sdk": "^0.57.0",
|
|
37
38
|
"@opentelemetry/instrumentation-connect": "^0.47.0",
|
|
38
39
|
"@opentelemetry/instrumentation-dns": "^0.47.0",
|
|
39
40
|
"@opentelemetry/instrumentation-express": "^0.52.0",
|