@comprehend/telemetry-node 0.2.1 → 0.2.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
@@ -121,7 +121,7 @@ This collects `process.cpu.time`, `process.cpu.utilization`, and `process.memory
121
121
 
122
122
  ### Kubernetes / container resources
123
123
 
124
- When running in containers or Kubernetes, the `NodeSDK` default resource detectors (`env`, `process`, `host`) do not include container or pod attributes. To populate `container.id`, `k8s.pod.name`, `k8s.namespace.name`, and similar, add the container resource detector explicitly via `resourceDetectors`:
124
+ When running in containers or Kubernetes, the `NodeSDK` default resource detectors (`env`, `process`, `host`) do not include container or pod attributes. Configure `resourceDetectors` explicitly to add them — note that doing so replaces the defaults, so include the built-in detectors too:
125
125
 
126
126
  ```bash
127
127
  npm install @opentelemetry/resource-detector-container
@@ -129,16 +129,20 @@ npm install @opentelemetry/resource-detector-container
129
129
 
130
130
  ```typescript
131
131
  import { NodeSDK } from '@opentelemetry/sdk-node';
132
- import { envDetector, hostDetector, processDetector } from '@opentelemetry/resources';
132
+ import { envDetector, hostDetector, processDetector, serviceInstanceIdDetector } from '@opentelemetry/resources';
133
133
  import { containerDetector } from '@opentelemetry/resource-detector-container';
134
134
 
135
135
  const sdk = new NodeSDK({
136
136
  // ...
137
- resourceDetectors: [envDetector, processDetector, hostDetector, containerDetector],
137
+ resourceDetectors: [envDetector, processDetector, hostDetector, containerDetector, serviceInstanceIdDetector],
138
138
  });
139
139
  ```
140
140
 
141
- Note that passing `resourceDetectors` replaces the defaults, so make sure to include the built-in detectors alongside `containerDetector`. The container detector reads `container.id` from `/proc/self/cgroup`. For other k8s attributes (pod name, namespace, node), use the Kubernetes Downward API to inject them as `OTEL_RESOURCE_ATTRIBUTES`:
141
+ **`serviceInstanceIdDetector`** generates a random UUID (`service.instance.id`) at process startup. This gives each deployment instance a unique identity that changes on every restart, which is useful for distinguishing runs in environments where `container.id` is not available (see below).
142
+
143
+ **`containerDetector`** reads `container.id` from `/proc/self/cgroup`. This works reliably with Docker-based runtimes but not on modern containerd-based Kubernetes clusters (which is the default since k8s 1.24), where the cgroup format does not expose the container ID in the expected location. Add it anyway — it will populate `container.id` when available and is a no-op otherwise.
144
+
145
+ For k8s identity attributes that cannot be read from the host (pod name, namespace, node), use the Kubernetes Downward API to inject them as `OTEL_RESOURCE_ATTRIBUTES`:
142
146
 
143
147
  ```yaml
144
148
  env:
@@ -7,7 +7,7 @@ const utils_1 = require("@noble/hashes/utils");
7
7
  const api_1 = require("@opentelemetry/api");
8
8
  const sqlDbSystems = new Set([
9
9
  'mysql', 'postgresql', 'mssql', 'oracle', 'db2', 'sqlite', 'hsqldb', 'h2',
10
- 'informix', 'cockroachdb', 'redshift', 'tidb', 'trino', 'greenplum'
10
+ 'informix', 'cockroachdb', 'redshift', 'tidb', 'trino', 'greenplum', 'clickhouse'
11
11
  ]);
12
12
  class ComprehendDevSpanProcessor {
13
13
  constructor(connection) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@comprehend/telemetry-node",
3
- "version": "0.2.1",
3
+ "version": "0.2.2",
4
4
  "description": "Integration of comprehend.dev with OpenTelemetry in Node.js and similar environemnts.",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -64,7 +64,7 @@ interface ObservedDatabaseConnection {
64
64
 
65
65
  const sqlDbSystems = new Set([
66
66
  'mysql', 'postgresql', 'mssql', 'oracle', 'db2', 'sqlite', 'hsqldb', 'h2',
67
- 'informix', 'cockroachdb', 'redshift', 'tidb', 'trino', 'greenplum'
67
+ 'informix', 'cockroachdb', 'redshift', 'tidb', 'trino', 'greenplum', 'clickhouse'
68
68
  ]);
69
69
 
70
70
  export class ComprehendDevSpanProcessor implements SpanProcessor {