@saidsef/tracing-node 2.1.0 → 2.1.1

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
@@ -22,14 +22,28 @@ npm install @saidsef/tracing-node --save
22
22
 
23
23
  ## Usage
24
24
 
25
+ You can set required params via env variables or function:
26
+
27
+ Env vars:
28
+ ```
29
+ CONTAINER_NAME
30
+ NODE_ENV
31
+ HOSTNAME
32
+ SERVICE_NAME
33
+ NAME_SPACE
34
+ SERVICE_VERSION
35
+ ENDPOINT
36
+ ```
37
+
38
+ Function args
25
39
  ```
26
40
  const { setupTracing } = require('@saidsef/tracing-node');
27
- setupTracing('hostname', 'application_name', 'endpoint');
41
+ setupTracing({hostname: 'hostname', serviceName: 'service_name', endpoint: 'endpoint'});
28
42
  ```
29
43
 
30
44
  ```
31
45
  import { setupTracing } from '@saidsef/tracing-node';
32
- setupTracing('hostname', 'application_name', 'endpoint');
46
+ setupTracing({hostname: 'hostname', serviceName: 'service_name', endpoint: 'endpoint'});
33
47
  ```
34
48
 
35
49
  ### Required Parameters are
@@ -37,7 +51,7 @@ setupTracing('hostname', 'application_name', 'endpoint');
37
51
  | Name | Type | Description|
38
52
  |----- | ---- | ------------- |
39
53
  | hostname | string | container / pod hostname |
40
- | application_name | string | service / application name |
54
+ | service_name | string | service / application name |
41
55
  | endpoint | string | tracing endpoint i.e. `<schema>://<host>:<port>` |
42
56
 
43
57
  ## Source
package/libs/index.mjs CHANGED
@@ -66,7 +66,7 @@ export function setupTracing (options={}) {
66
66
 
67
67
  const provider = new NodeTracerProvider({
68
68
  resource: new Resource({
69
- [SemanticResourceAttributes.CONTAINER_NAME]: containerName,
69
+ [SemanticResourceAttributes.CONTAINER_NAME]: containerName || serviceName,
70
70
  [SemanticResourceAttributes.DEPLOYMENT_ENVIRONMENT]: deploymentEnvironment,
71
71
  [SemanticResourceAttributes.HOSTNAME]: hostname,
72
72
  [SemanticResourceAttributes.SERVICE_NAME]: serviceName,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@saidsef/tracing-node",
3
- "version": "2.1.0",
3
+ "version": "2.1.1",
4
4
  "description": "tracing NodeJS - This is a wrapper for OpenTelemetry instrumentation packages",
5
5
  "main": "libs/index.mjs",
6
6
  "scripts": {