@saidsef/tracing-node 3.3.7 → 3.4.2

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
@@ -31,13 +31,9 @@ You can set required params via env variables or function:
31
31
 
32
32
  Env vars:
33
33
  ```
34
- CONTAINER_NAME
35
- NODE_ENV
36
- HOSTNAME
37
- SERVICE_NAME
38
- NAME_SPACE
39
- SERVICE_VERSION
34
+ CONTAINER_NAME || HOSTNAME
40
35
  ENDPOINT
36
+ SERVICE_NAME
41
37
  ```
42
38
 
43
39
  Function args
@@ -34,4 +34,4 @@ spec:
34
34
  gitRepo:
35
35
  directory: "."
36
36
  repository: "https://github.com/saidsef/tracing-node.git"
37
- revision: "fix-trace-resources"
37
+ revision: "dependabot-npm_and_yarn-opentelemetry-instrumentation-aws-sdk-0.50.0"
package/libs/index.mjs CHANGED
@@ -31,8 +31,9 @@ import {OTLPTraceExporter} from '@opentelemetry/exporter-trace-otlp-grpc';
31
31
  import {PinoInstrumentation} from '@opentelemetry/instrumentation-pino';
32
32
  import {IORedisInstrumentation} from '@opentelemetry/instrumentation-ioredis';
33
33
  import {registerInstrumentations} from '@opentelemetry/instrumentation';
34
- import {Resource} from '@opentelemetry/resources';
34
+ import {Resource, detectResourcesSync} from '@opentelemetry/resources';
35
35
  import {ATTR_SERVICE_NAME} from '@opentelemetry/semantic-conventions';
36
+ import {ATTR_CONTAINER_NAME} from '@opentelemetry/semantic-conventions/incubating';
36
37
 
37
38
  diag.setLogger(new DiagConsoleLogger(), DiagLogLevel.INFO);
38
39
 
@@ -55,6 +56,7 @@ let tracerProvider = null; // Declare provider in module scope for access in sto
55
56
 
56
57
  export function setupTracing(options = {}) {
57
58
  const {
59
+ hostname = process.env.CONTAINER_NAME || process.env.HOSTNAME,
58
60
  serviceName = process.env.SERVICE_NAME,
59
61
  url = process.env.ENDPOINT,
60
62
  concurrencyLimit = 10,
@@ -73,9 +75,12 @@ export function setupTracing(options = {}) {
73
75
 
74
76
  tracerProvider = new NodeTracerProvider({
75
77
  spanProcessors: [spanProcessor],
76
- resource: new Resource({
77
- [ATTR_SERVICE_NAME]: serviceName,
78
- }),
78
+ resource: detectResourcesSync().merge(
79
+ new Resource({
80
+ [ATTR_SERVICE_NAME]: serviceName,
81
+ [ATTR_CONTAINER_NAME]: hostname,
82
+ }),
83
+ ),
79
84
  });
80
85
 
81
86
  // Initialize the tracer provider with propagators
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@saidsef/tracing-node",
3
- "version": "3.3.7",
3
+ "version": "3.4.2",
4
4
  "description": "tracing NodeJS - Wrapper for OpenTelemetry instrumentation packages",
5
5
  "main": "libs/index.mjs",
6
6
  "scripts": {
@@ -33,7 +33,7 @@
33
33
  "@opentelemetry/api": "^1.9.0",
34
34
  "@opentelemetry/exporter-trace-otlp-grpc": "^0.200.0",
35
35
  "@opentelemetry/instrumentation": "^0.200.0",
36
- "@opentelemetry/instrumentation-aws-sdk": "^0.49.0",
36
+ "@opentelemetry/instrumentation-aws-sdk": "^0.50.0",
37
37
  "@opentelemetry/instrumentation-connect": "^0.44.0",
38
38
  "@opentelemetry/instrumentation-dns": "^0.44.0",
39
39
  "@opentelemetry/instrumentation-express": "^0.48.0",