@saidsef/tracing-node 2.2.5 → 2.2.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
@@ -43,12 +43,12 @@ ENDPOINT
43
43
  Function args
44
44
  ```
45
45
  const { setupTracing } = require('@saidsef/tracing-node');
46
- setupTracing({hostname: 'hostname', serviceName: 'service_name', endpoint: 'endpoint'});
46
+ setupTracing({hostname: 'hostname', serviceName: 'service_name', url: 'endpoint'});
47
47
  ```
48
48
 
49
49
  ```
50
50
  import { setupTracing } from '@saidsef/tracing-node';
51
- setupTracing({hostname: 'hostname', serviceName: 'service_name', endpoint: 'endpoint'});
51
+ setupTracing({hostname: 'hostname', serviceName: 'service_name', url: 'endpoint'});
52
52
  ```
53
53
 
54
54
  ### Required Parameters are
@@ -57,7 +57,7 @@ setupTracing({hostname: 'hostname', serviceName: 'service_name', endpoint: 'endp
57
57
  |----- | ---- | ------------- |
58
58
  | hostname | string | container / pod hostname |
59
59
  | service_name | string | service / application name |
60
- | endpoint | string | tracing endpoint i.e. `<schema>://<host>:<port>` |
60
+ | url | string | tracing endpoint i.e. `<schema>://<host>:<port>` |
61
61
 
62
62
  ## Source
63
63
 
package/libs/index.mjs CHANGED
@@ -17,19 +17,19 @@
17
17
  */
18
18
 
19
19
  import {CompositePropagator, W3CBaggagePropagator, W3CTraceContextPropagator} from '@opentelemetry/core';
20
- import {registerInstrumentations} from '@opentelemetry/instrumentation';
21
20
  import {NodeTracerProvider} from '@opentelemetry/sdk-trace-node';
22
21
  import {BatchSpanProcessor} from '@opentelemetry/sdk-trace-base';
22
+ import {registerInstrumentations} from '@opentelemetry/instrumentation';
23
+ import {diag, DiagConsoleLogger, DiagLogLevel} from '@opentelemetry/api';
24
+ import {AwsInstrumentation} from '@opentelemetry/instrumentation-aws-sdk';
23
25
  import {OTLPTraceExporter} from '@opentelemetry/exporter-trace-otlp-grpc';
26
+ import {B3Propagator, B3InjectEncoding} from '@opentelemetry/propagator-b3';
24
27
  import {HttpInstrumentation} from '@opentelemetry/instrumentation-http';
25
- import {ExpressInstrumentation} from '@opentelemetry/instrumentation-express';
26
- import {diag, DiagConsoleLogger, DiagLogLevel} from '@opentelemetry/api';
27
28
  import {Resource} from '@opentelemetry/resources';
28
29
  import {SemanticResourceAttributes} from '@opentelemetry/semantic-conventions';
29
- import {AwsInstrumentation} from '@opentelemetry/instrumentation-aws-sdk';
30
+ import {ExpressInstrumentation} from '@opentelemetry/instrumentation-express';
30
31
  import {PinoInstrumentation} from '@opentelemetry/instrumentation-pino';
31
32
  import {DnsInstrumentation} from '@opentelemetry/instrumentation-dns';
32
- import {B3Propagator, B3InjectEncoding} from '@opentelemetry/propagator-b3';
33
33
 
34
34
  diag.setLogger(new DiagConsoleLogger(), DiagLogLevel.INFO);
35
35
 
@@ -77,6 +77,12 @@ export function setupTracing (options={}) {
77
77
  }),
78
78
  });
79
79
 
80
+ // Initialize the tracer provider
81
+ provider.register({
82
+ propagator: new CompositePropagator({
83
+ propagators: [new W3CBaggagePropagator(), new W3CTraceContextPropagator(), new B3Propagator({injectEncoding: B3InjectEncoding.MULTI_HEADER})],
84
+ })});
85
+
80
86
  // Configure exporter with the Collector endpoint - uses gRPC
81
87
  const exportOptions = {
82
88
  concurrencyLimit: concurrencyLimit,
@@ -97,32 +103,26 @@ export function setupTracing (options={}) {
97
103
  registerInstrumentations({
98
104
  tracerProvider: provider,
99
105
  instrumentations: [
100
- new HttpInstrumentation({
101
- requireParentforOutgoingSpans: false,
102
- requireParentforIncomingSpans: false,
103
- ignoreIncomingRequestHook,
104
- }),
105
106
  new ExpressInstrumentation({
106
107
  ignoreIncomingRequestHook,
107
108
  }),
108
- new AwsInstrumentation({
109
- sqsExtractContextPropagationFromPayload: true
110
- }),
111
109
  new PinoInstrumentation({
112
110
  logHook: (span, record) => {
113
111
  record['resource.service.name'] = provider.resource.attributes['service.name'];
114
112
  },
115
113
  }),
114
+ new HttpInstrumentation({
115
+ requireParentforOutgoingSpans: false,
116
+ requireParentforIncomingSpans: false,
117
+ ignoreIncomingRequestHook,
118
+ }),
119
+ new AwsInstrumentation({
120
+ sqsExtractContextPropagationFromPayload: true
121
+ }),
116
122
  new DnsInstrumentation(),
117
123
  ],
118
124
  });
119
125
 
120
- // Initialize the tracer provider
121
- provider.register({
122
- propagator: new CompositePropagator({
123
- propagators: [new W3CBaggagePropagator(), new W3CTraceContextPropagator(), new B3Propagator({injectEncoding: B3InjectEncoding.MULTI_HEADER})],
124
- })});
125
-
126
126
  // Return the tracer for the service
127
127
  return provider.getTracer(serviceName);
128
128
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@saidsef/tracing-node",
3
- "version": "2.2.5",
3
+ "version": "2.2.7",
4
4
  "description": "tracing NodeJS - This is a wrapper for OpenTelemetry instrumentation packages",
5
5
  "main": "libs/index.mjs",
6
6
  "scripts": {
@@ -42,10 +42,10 @@
42
42
  "@opentelemetry/exporter-trace-otlp-grpc": "^0.53.0",
43
43
  "@opentelemetry/instrumentation": "^0.53.0",
44
44
  "@opentelemetry/instrumentation-aws-sdk": "^0.44.0",
45
- "@opentelemetry/instrumentation-dns": "^0.39.0",
46
- "@opentelemetry/instrumentation-express": "^0.43.0",
45
+ "@opentelemetry/instrumentation-dns": "^0.40.0",
46
+ "@opentelemetry/instrumentation-express": "^0.44.0",
47
47
  "@opentelemetry/instrumentation-http": "^0.53.0",
48
- "@opentelemetry/instrumentation-pino": "^0.42.0",
48
+ "@opentelemetry/instrumentation-pino": "^0.43.0",
49
49
  "@opentelemetry/propagator-b3": "^1.25.1",
50
50
  "@opentelemetry/resources": "^1.26.0",
51
51
  "@opentelemetry/sdk-trace-base": "^1.26.0",