@saidsef/tracing-node 2.0.0 → 2.1.0

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.
Files changed (2) hide show
  1. package/libs/index.mjs +25 -11
  2. package/package.json +1 -1
package/libs/index.mjs CHANGED
@@ -41,33 +41,47 @@ diag.setLogger(new DiagConsoleLogger(), DiagLogLevel.INFO);
41
41
  * tracing for HTTP, Express, AWS, Pino, and DNS.
42
42
  *
43
43
  * @param {Object} options - Configuration options for tracing.
44
- * @param {string} [options.serviceName=process.env.HOSTNAME] - The name of the service.
45
- * @param {string} [options.appName=process.env.APP_NAME] - The name of the application.
46
- * @param {string} [options.endpoint=process.env.ENDPOINT] - The endpoint for the trace exporter.
44
+ * @param {string} [options.containerName=process.env.CONTAINER_NAME] - The name of the container.
45
+ * @param {string} [options.deploymentEnvironment=process.env.NODE_ENV] - The deployment environment.
46
+ * @param {string} [options.hostname=process.env.HOSTNAME] - The hostname of the service.
47
+ * @param {string} [options.serviceName=process.env.SERVICE_NAME] - The name of the service.
48
+ * @param {string} [options.serviceNameSpace=process.env.NAME_SPACE || 'default'] - The namespace of the service.
49
+ * @param {string} [options.serviceVersion=process.env.SERVICE_VERSION || '0.0.0'] - The version of the service.
50
+ * @param {string} [options.url=process.env.ENDPOINT] - The endpoint URL for the tracing collector.
51
+ * @param {number} [options.concurrencyLimit=10] - The concurrency limit for the exporter.
47
52
  *
48
53
  * @returns {Tracer} - The tracer for the service.
49
54
  */
50
55
  export function setupTracing (options={}) {
51
56
  const {
52
- serviceName = process.env.HOSTNAME,
53
- appName = process.env.APP_NAME,
54
- endpoint = process.env.ENDPOINT
57
+ containerName = process.env.CONTAINER_NAME,
58
+ deploymentEnvironment = process.env.NODE_ENV,
59
+ hostname = process.env.HOSTNAME,
60
+ serviceName = process.env.SERVICE_NAME,
61
+ serviceNameSpace = process.env.NAME_SPACE || 'default',
62
+ serviceVersion = process.env.SERVICE_VERSION || '0.0.0',
63
+ url = process.env.ENDPOINT,
64
+ concurrencyLimit = 10,
55
65
  } = options;
56
66
 
57
67
  const provider = new NodeTracerProvider({
58
68
  resource: new Resource({
69
+ [SemanticResourceAttributes.CONTAINER_NAME]: containerName,
70
+ [SemanticResourceAttributes.DEPLOYMENT_ENVIRONMENT]: deploymentEnvironment,
71
+ [SemanticResourceAttributes.HOSTNAME]: hostname,
59
72
  [SemanticResourceAttributes.SERVICE_NAME]: serviceName,
60
- [SemanticResourceAttributes.SERVICE_NAMESPACE]: appName,
61
- [SemanticResourceAttributes.CONTAINER_NAME]: serviceName,
62
- [SemanticResourceAttributes.HOST_NAME]: serviceName,
73
+ [SemanticResourceAttributes.SERVICE_NAMESPACE]: serviceNameSpace,
74
+ [SemanticResourceAttributes.SERVICE_VERSION]: serviceVersion || '0.0.0',
75
+ [SemanticResourceAttributes.URL]: url,
63
76
  instrumentationLibrarySemanticConvention: true,
64
77
  }),
65
78
  });
66
79
 
67
80
  // Configure exporter with the Collector endpoint - uses gRPC
68
81
  const exportOptions = {
69
- serviceName: serviceName,
70
- url: endpoint,
82
+ concurrencyLimit: concurrencyLimit,
83
+ url: url,
84
+ timeoutMillis: 1000,
71
85
  };
72
86
 
73
87
  // Register the span processor with the tracer provider
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@saidsef/tracing-node",
3
- "version": "2.0.0",
3
+ "version": "2.1.0",
4
4
  "description": "tracing NodeJS - This is a wrapper for OpenTelemetry instrumentation packages",
5
5
  "main": "libs/index.mjs",
6
6
  "scripts": {