@ogcio/o11y-sdk-node 0.1.0-beta.2 → 0.1.0-beta.4

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 (42) hide show
  1. package/CHANGELOG.md +14 -0
  2. package/README.md +96 -10
  3. package/coverage/cobertura-coverage.xml +191 -80
  4. package/coverage/lcov-report/index.html +17 -17
  5. package/coverage/lcov-report/sdk-node/index.html +1 -1
  6. package/coverage/lcov-report/sdk-node/index.ts.html +8 -2
  7. package/coverage/lcov-report/sdk-node/lib/console.ts.html +130 -0
  8. package/coverage/lcov-report/sdk-node/lib/grpc.ts.html +27 -27
  9. package/coverage/lcov-report/sdk-node/lib/http.ts.html +6 -6
  10. package/coverage/lcov-report/sdk-node/lib/index.html +46 -16
  11. package/coverage/lcov-report/sdk-node/lib/index.ts.html +5 -14
  12. package/coverage/lcov-report/sdk-node/lib/instrumentation.node.ts.html +82 -58
  13. package/coverage/lcov-report/sdk-node/lib/metrics.ts.html +295 -0
  14. package/coverage/lcov-report/sdk-node/lib/options.ts.html +4 -7
  15. package/coverage/lcov-report/sdk-node/lib/utils.ts.html +1 -1
  16. package/coverage/lcov.info +196 -90
  17. package/dist/index.d.ts +1 -0
  18. package/dist/index.js +1 -0
  19. package/dist/lib/console.d.ts +3 -0
  20. package/dist/lib/console.js +12 -0
  21. package/dist/lib/grpc.js +4 -4
  22. package/dist/lib/http.js +4 -4
  23. package/dist/lib/index.d.ts +2 -2
  24. package/dist/lib/instrumentation.node.js +10 -1
  25. package/dist/lib/metrics.d.ts +18 -0
  26. package/dist/lib/metrics.js +28 -0
  27. package/dist/lib/options.d.ts +2 -3
  28. package/dist/package.json +50 -0
  29. package/index.ts +2 -0
  30. package/lib/console.ts +15 -0
  31. package/lib/grpc.ts +4 -4
  32. package/lib/http.ts +4 -4
  33. package/lib/index.ts +2 -2
  34. package/lib/instrumentation.node.ts +9 -1
  35. package/lib/metrics.ts +70 -0
  36. package/lib/options.ts +2 -3
  37. package/package.json +22 -22
  38. package/test/metrics.test.ts +142 -0
  39. package/test/node-config.test.ts +35 -9
  40. package/test/validation.test.ts +31 -0
  41. package/test-report.xml +45 -13
  42. package/tsconfig.json +2 -1
@@ -1,12 +1,14 @@
1
- import { NodeSDK } from "@opentelemetry/sdk-node";
1
+ import { NodeSDK, resources } from "@opentelemetry/sdk-node";
2
2
  import type { NodeSDKConfig } from "./index.js";
3
3
  import type { Exporters } from "./options.js";
4
4
  import isUrl from "is-url";
5
5
  import buildHttpExporters from "./http.js";
6
6
  import buildGrpcExporters from "./grpc.js";
7
+ import buildConsoleExporters from "./console.js";
7
8
  import { diag, DiagConsoleLogger, DiagLogLevel } from "@opentelemetry/api";
8
9
  import { getNodeAutoInstrumentations } from "@opentelemetry/auto-instrumentations-node";
9
10
  import { W3CTraceContextPropagator } from "@opentelemetry/core";
11
+ import packageJson from "../package.json" with { type: "json" };
10
12
 
11
13
  export default function buildNodeInstrumentation(
12
14
  config?: NodeSDKConfig,
@@ -36,6 +38,8 @@ export default function buildNodeInstrumentation(
36
38
 
37
39
  if (config.protocol === "http") {
38
40
  exporter = buildHttpExporters(config);
41
+ } else if (config.protocol === "console") {
42
+ exporter = buildConsoleExporters(config);
39
43
  } else {
40
44
  exporter = buildGrpcExporters(config);
41
45
  }
@@ -49,6 +53,10 @@ export default function buildNodeInstrumentation(
49
53
  );
50
54
 
51
55
  const sdk = new NodeSDK({
56
+ resource: new resources.Resource({
57
+ "o11y.sdk.name": packageJson.name,
58
+ "o11y.sdk.version": packageJson.version,
59
+ }),
52
60
  serviceName: config.serviceName,
53
61
  traceExporter: exporter.traces,
54
62
  metricReader: exporter.metrics,
package/lib/metrics.ts ADDED
@@ -0,0 +1,70 @@
1
+ import {
2
+ Counter,
3
+ createNoopMeter,
4
+ Gauge,
5
+ Histogram,
6
+ Meter,
7
+ MetricOptions,
8
+ metrics,
9
+ ObservableCounter,
10
+ ObservableGauge,
11
+ ObservableUpDownCounter,
12
+ UpDownCounter,
13
+ } from "@opentelemetry/api";
14
+
15
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
16
+ declare const MetricsMap: {
17
+ gauge: Gauge;
18
+ histogram: Histogram;
19
+ counter: Counter;
20
+ updowncounter: UpDownCounter;
21
+ "async-counter": ObservableCounter;
22
+ "async-updowncounter": ObservableUpDownCounter;
23
+ "async-gauge": ObservableGauge;
24
+ };
25
+
26
+ type MetricType = keyof typeof MetricsMap;
27
+
28
+ const MetricsFactoryMap: {
29
+ [K in MetricType]: (
30
+ meter: Meter,
31
+ ) => (name: string, options?: MetricOptions) => (typeof MetricsMap)[K];
32
+ } = {
33
+ gauge: (meter: Meter) => meter.createGauge,
34
+ histogram: (meter: Meter) => meter.createHistogram,
35
+ counter: (meter: Meter) => meter.createCounter,
36
+ updowncounter: (meter: Meter) => meter.createUpDownCounter,
37
+ "async-counter": (meter: Meter) => meter.createObservableCounter,
38
+ "async-updowncounter": (meter: Meter) => meter.createObservableUpDownCounter,
39
+ "async-gauge": (meter: Meter) => meter.createObservableGauge,
40
+ };
41
+
42
+ export interface MetricsParams {
43
+ metricName: string;
44
+ attributeName: string;
45
+ options?: MetricOptions;
46
+ }
47
+
48
+ function getMeter({ metricName, attributeName }: MetricsParams) {
49
+ let meter: Meter;
50
+ if (!metricName || !attributeName) {
51
+ console.error("Invaid metric configuration!");
52
+ meter = createNoopMeter();
53
+ } else {
54
+ meter = metrics.getMeter(`custom_metric.${metricName}`);
55
+ }
56
+ return meter;
57
+ }
58
+
59
+ export function getMetric<T extends MetricType>(
60
+ type: T,
61
+ p: MetricsParams,
62
+ ): (typeof MetricsMap)[T] {
63
+ const meter = getMeter(p);
64
+
65
+ if (!MetricsFactoryMap[type]) {
66
+ throw new Error(`Unsupported metric type: ${type}`);
67
+ }
68
+
69
+ return MetricsFactoryMap[type](meter).bind(meter)(p.attributeName, p.options);
70
+ }
package/lib/options.ts CHANGED
@@ -1,8 +1,7 @@
1
- import type { MetricReader } from "@opentelemetry/sdk-metrics";
2
- import type { logs, tracing } from "@opentelemetry/sdk-node";
1
+ import type { logs, tracing, metrics } from "@opentelemetry/sdk-node";
3
2
 
4
3
  export type Exporters = {
5
4
  traces: tracing.SpanExporter;
6
- metrics: MetricReader;
5
+ metrics: metrics.MetricReader;
7
6
  logs: logs.LogRecordProcessor[];
8
7
  };
package/package.json CHANGED
@@ -1,13 +1,9 @@
1
1
  {
2
2
  "name": "@ogcio/o11y-sdk-node",
3
- "version": "0.1.0-beta.2",
3
+ "version": "0.1.0-beta.4",
4
4
  "description": "Opentelemetry standard instrumentation SDK for NodeJS based project",
5
5
  "main": "dist/index.js",
6
6
  "type": "module",
7
- "scripts": {
8
- "build": "rm -rf dist && tsc -p tsconfig.json",
9
- "test": "vitest"
10
- },
11
7
  "exports": {
12
8
  ".": "./dist/index.js",
13
9
  "./*": "./dist/*.js"
@@ -24,26 +20,30 @@
24
20
  "license": "ISC",
25
21
  "dependencies": {
26
22
  "@opentelemetry/api": "^1.9.0",
27
- "@opentelemetry/auto-instrumentations-node": "^0.53.0",
28
- "@opentelemetry/core": "1.28.0",
29
- "@opentelemetry/exporter-logs-otlp-grpc": "^0.55.0",
30
- "@opentelemetry/exporter-logs-otlp-http": "^0.55.0",
31
- "@opentelemetry/exporter-metrics-otlp-grpc": "^0.55.0",
32
- "@opentelemetry/exporter-metrics-otlp-http": "^0.55.0",
33
- "@opentelemetry/exporter-trace-otlp-grpc": "^0.55.0",
34
- "@opentelemetry/exporter-trace-otlp-http": "^0.55.0",
35
- "@opentelemetry/instrumentation": "^0.55.0",
36
- "@opentelemetry/otlp-exporter-base": "^0.55.0",
37
- "@opentelemetry/sdk-metrics": "^1.28.0",
38
- "@opentelemetry/sdk-node": "^0.55.0",
23
+ "@opentelemetry/auto-instrumentations-node": "^0.55.3",
24
+ "@opentelemetry/core": "1.30.1",
25
+ "@opentelemetry/exporter-logs-otlp-grpc": "^0.57.1",
26
+ "@opentelemetry/exporter-logs-otlp-http": "^0.57.1",
27
+ "@opentelemetry/exporter-metrics-otlp-grpc": "^0.57.1",
28
+ "@opentelemetry/exporter-metrics-otlp-http": "^0.57.1",
29
+ "@opentelemetry/exporter-trace-otlp-grpc": "^0.57.1",
30
+ "@opentelemetry/exporter-trace-otlp-http": "^0.57.1",
31
+ "@opentelemetry/instrumentation": "^0.57.1",
32
+ "@opentelemetry/otlp-exporter-base": "^0.57.1",
33
+ "@opentelemetry/sdk-metrics": "^1.30.1",
34
+ "@opentelemetry/sdk-node": "^0.57.1",
39
35
  "is-url": "^1.2.4"
40
36
  },
41
37
  "devDependencies": {
42
38
  "@types/is-url": "^1.2.32",
43
- "@types/node": "^22.10.0",
44
- "@vitest/coverage-v8": "^2.1.6",
39
+ "@types/node": "^22.12.0",
40
+ "@vitest/coverage-v8": "^3.0.4",
45
41
  "tsx": "^4.19.2",
46
- "typescript": "^5.7.2",
47
- "vitest": "^2.1.6"
42
+ "typescript": "^5.7.3",
43
+ "vitest": "^3.0.4"
44
+ },
45
+ "scripts": {
46
+ "build": "rm -rf dist && tsc -p tsconfig.json",
47
+ "test": "vitest"
48
48
  }
49
- }
49
+ }
@@ -0,0 +1,142 @@
1
+ import { describe, test, expect, vi, beforeEach, assert } from "vitest";
2
+ import { getMetric, MetricsParams } from "../lib/metrics";
3
+
4
+ const mockMeter = {
5
+ createGauge: vi.fn(),
6
+ createHistogram: vi.fn(),
7
+ createCounter: vi.fn(),
8
+ createUpDownCounter: vi.fn(),
9
+ createObservableCounter: vi.fn(),
10
+ createObservableUpDownCounter: vi.fn(),
11
+ createObservableGauge: vi.fn(),
12
+ };
13
+
14
+ vi.mock("@opentelemetry/api", async () => {
15
+ const { createNoopMeter } = await import("@opentelemetry/api");
16
+
17
+ return {
18
+ metrics: {
19
+ getMeter: vi.fn(() => mockMeter),
20
+ },
21
+ createNoopMeter: createNoopMeter,
22
+ };
23
+ });
24
+
25
+ describe("MetricsFactoryMap", () => {
26
+ beforeEach(() => {
27
+ vi.clearAllMocks();
28
+ });
29
+
30
+ const validMetricParams: MetricsParams = {
31
+ metricName: "test-metric",
32
+ attributeName: "test-attribute",
33
+ options: { description: "A test metric" },
34
+ };
35
+
36
+ test("should call createGauge when type is 'gauge'", () => {
37
+ mockMeter.createGauge.mockReturnValue("mocked-gauge");
38
+
39
+ const result = getMetric("gauge", validMetricParams);
40
+
41
+ expect(result).toBe("mocked-gauge");
42
+ expect(mockMeter.createGauge).toHaveBeenCalledWith(
43
+ validMetricParams.attributeName,
44
+ validMetricParams.options,
45
+ );
46
+ });
47
+
48
+ test("should call createHistogram when type is 'histogram'", () => {
49
+ mockMeter.createHistogram.mockReturnValue("mocked-histogram");
50
+
51
+ const result = getMetric("histogram", validMetricParams);
52
+
53
+ expect(result).toBe("mocked-histogram");
54
+ expect(mockMeter.createHistogram).toHaveBeenCalledWith(
55
+ validMetricParams.attributeName,
56
+ validMetricParams.options,
57
+ );
58
+ });
59
+
60
+ test("should call createCounter when type is 'counter'", () => {
61
+ mockMeter.createCounter.mockReturnValue("mocked-counter");
62
+
63
+ const result = getMetric("counter", validMetricParams);
64
+
65
+ expect(result).toBe("mocked-counter");
66
+ expect(mockMeter.createCounter).toHaveBeenCalledWith(
67
+ validMetricParams.attributeName,
68
+ validMetricParams.options,
69
+ );
70
+ });
71
+
72
+ test("should call createUpDownCounter when type is 'updowncounter'", () => {
73
+ mockMeter.createUpDownCounter.mockReturnValue("mocked-updowncounter");
74
+
75
+ const result = getMetric("updowncounter", validMetricParams);
76
+
77
+ expect(result).toBe("mocked-updowncounter");
78
+ expect(mockMeter.createUpDownCounter).toHaveBeenCalledWith(
79
+ validMetricParams.attributeName,
80
+ validMetricParams.options,
81
+ );
82
+ });
83
+
84
+ test("should call createObservableCounter when type is 'async-counter'", () => {
85
+ mockMeter.createObservableCounter.mockReturnValue("mocked-async-counter");
86
+
87
+ const result = getMetric("async-counter", validMetricParams);
88
+
89
+ expect(result).toBe("mocked-async-counter");
90
+ expect(mockMeter.createObservableCounter).toHaveBeenCalledWith(
91
+ validMetricParams.attributeName,
92
+ validMetricParams.options,
93
+ );
94
+ });
95
+
96
+ test("should call createObservableUpDownCounter when type is 'async-updowncounter'", () => {
97
+ mockMeter.createObservableUpDownCounter.mockReturnValue(
98
+ "mocked-async-updowncounter",
99
+ );
100
+
101
+ const result = getMetric("async-updowncounter", validMetricParams);
102
+
103
+ expect(result).toBe("mocked-async-updowncounter");
104
+ expect(mockMeter.createObservableUpDownCounter).toHaveBeenCalledWith(
105
+ validMetricParams.attributeName,
106
+ validMetricParams.options,
107
+ );
108
+ });
109
+
110
+ test("should call createObservableGauge when type is 'async-gauge'", () => {
111
+ mockMeter.createObservableGauge.mockReturnValue("mocked-async-gauge");
112
+
113
+ const result = getMetric("async-gauge", validMetricParams);
114
+
115
+ expect(result).toBe("mocked-async-gauge");
116
+ expect(mockMeter.createObservableGauge).toHaveBeenCalledWith(
117
+ validMetricParams.attributeName,
118
+ validMetricParams.options,
119
+ );
120
+ });
121
+
122
+ test("should throw an error for unsupported metric types", () => {
123
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
124
+ const invalidMetricType = "invalid-type" as any;
125
+
126
+ expect(() => getMetric(invalidMetricType, validMetricParams)).toThrow(
127
+ `Unsupported metric type: ${invalidMetricType}`,
128
+ );
129
+ });
130
+
131
+ test("should return noop metric fallback for null config", async () => {
132
+ const nullMetricParams: MetricsParams = {
133
+ metricName: null!,
134
+ attributeName: "",
135
+ };
136
+
137
+ const result = getMetric("async-gauge", nullMetricParams);
138
+
139
+ assert.isNotNull(result);
140
+ assert.equal(result.constructor.name, "NoopObservableGaugeMetric");
141
+ });
142
+ });
@@ -1,6 +1,6 @@
1
1
  import { test, describe, assert, expect } from "vitest";
2
2
  import buildNodeInstrumentation from "../lib/instrumentation.node.js";
3
- import { NodeSDK, logs } from "@opentelemetry/sdk-node";
3
+ import { NodeSDK, logs, metrics, tracing } from "@opentelemetry/sdk-node";
4
4
  import { OTLPTraceExporter as GRPC_OTLPTraceExporter } from "@opentelemetry/exporter-trace-otlp-grpc";
5
5
  import { OTLPMetricExporter as GRPC_OTLPMetricExporter } from "@opentelemetry/exporter-metrics-otlp-grpc";
6
6
  import { OTLPLogExporter as GRPC_OTLPLogExporter } from "@opentelemetry/exporter-logs-otlp-grpc";
@@ -32,10 +32,7 @@ describe("verify config settings", () => {
32
32
  assert.equal(_configuration.serviceName, commonConfig.serviceName);
33
33
 
34
34
  const traceExporter = _configuration.traceExporter;
35
- assert.equal(
36
- traceExporter["_transport"]["_parameters"]["compression"],
37
- "gzip",
38
- );
35
+
39
36
  assert.ok(traceExporter instanceof GRPC_OTLPTraceExporter);
40
37
 
41
38
  const logRecordProcessors = _configuration.logRecordProcessors;
@@ -64,10 +61,6 @@ describe("verify config settings", () => {
64
61
  assert.equal(_configuration.serviceName, commonConfig.serviceName);
65
62
 
66
63
  const traceExporter = _configuration.traceExporter;
67
- assert.equal(
68
- traceExporter._transport._transport._parameters.compression,
69
- "gzip",
70
- );
71
64
  assert.ok(traceExporter instanceof HTTP_OTLPTraceExporter);
72
65
 
73
66
  const logRecordProcessors = _configuration.logRecordProcessors;
@@ -82,6 +75,39 @@ describe("verify config settings", () => {
82
75
  assert.ok(metricReader._exporter instanceof HTTP_OTLPMetricExporter);
83
76
  });
84
77
 
78
+ test("console - console config", () => {
79
+ const config: NodeSDKConfig = {
80
+ ...commonConfig,
81
+ protocol: "console",
82
+ diagLogLevel: "NONE",
83
+ };
84
+
85
+ const sdk: NodeSDK | undefined = buildNodeInstrumentation(config);
86
+ assert.ok(sdk);
87
+
88
+ const _configuration = sdk["_configuration"];
89
+ assert.equal(_configuration.serviceName, commonConfig.serviceName);
90
+
91
+ const traceExporter = _configuration.traceExporter;
92
+
93
+ assert.ok(traceExporter instanceof tracing.ConsoleSpanExporter);
94
+ assert.isUndefined(traceExporter._transport);
95
+
96
+ const logRecordProcessors = _configuration.logRecordProcessors;
97
+ assert.equal(logRecordProcessors.length, 1);
98
+
99
+ assert.ok(logRecordProcessors[0] instanceof logs.SimpleLogRecordProcessor);
100
+ assert.ok(
101
+ logRecordProcessors[0]["_exporter"] instanceof
102
+ logs.ConsoleLogRecordExporter,
103
+ );
104
+ assert.isUndefined(logRecordProcessors[0]["_exporter"]._transport);
105
+
106
+ const metricReader = _configuration.metricReader;
107
+ assert.ok(metricReader._exporter instanceof metrics.ConsoleMetricExporter);
108
+ assert.isUndefined(metricReader._exporter._transport);
109
+ });
110
+
85
111
  test("single log sending config", () => {
86
112
  const config: NodeSDKConfig = {
87
113
  ...commonConfig,
@@ -63,4 +63,35 @@ describe("validation config: should return without breaking the execution", () =
63
63
  );
64
64
  expect(consoleLogSpy).not.toHaveBeenCalled();
65
65
  });
66
+
67
+ test("node instrumentation: verify no instrumentation if exception occurs", () => {
68
+ let sdk: NodeSDK | undefined = undefined;
69
+
70
+ const consoleErrorSpy = vi
71
+ .spyOn(console, "error")
72
+ .mockImplementation(vi.fn());
73
+ const consoleLogSpy = vi.spyOn(console, "log").mockImplementation(vi.fn());
74
+
75
+ vi.mock("@opentelemetry/auto-instrumentations-node", () => ({
76
+ getNodeAutoInstrumentations: vi.fn(() => {
77
+ throw new Error("Wanted error");
78
+ }),
79
+ }));
80
+
81
+ assert.doesNotThrow(() => {
82
+ sdk = buildNodeInstrumentation({
83
+ collectorUrl: "https://testurl.com",
84
+ serviceName: "test",
85
+ });
86
+ });
87
+
88
+ assert.equal(sdk, undefined);
89
+
90
+ expect(consoleErrorSpy).toHaveBeenCalled();
91
+ expect(consoleErrorSpy).toHaveBeenCalledWith(
92
+ "Error starting NodeJS OpenTelemetry instrumentation:",
93
+ new Error("Wanted error"),
94
+ );
95
+ expect(consoleLogSpy).not.toHaveBeenCalled();
96
+ });
66
97
  });
package/test-report.xml CHANGED
@@ -1,39 +1,71 @@
1
1
  <?xml version="1.0" encoding="UTF-8" ?>
2
- <testsuites name="vitest tests" tests="9" failures="0" errors="0" time="0.781">
3
- <testsuite name="test/index.test.ts" timestamp="2024-11-26T09:25:25.586Z" hostname="ABozzelli-ITMAC24" tests="2" failures="0" errors="0" skipped="0" time="0.002388">
4
- <testcase classname="test/index.test.ts" name="instrumentNode &gt; should call buildNodeInstrumentation with the provided config" time="0.001363792">
2
+ <testsuites name="vitest tests" tests="20" failures="0" errors="0" time="0.189321701">
3
+ <testsuite name="test/index.test.ts" timestamp="2025-01-28T15:28:22.386Z" hostname="fv-az367-418" tests="2" failures="0" errors="0" skipped="0" time="0.008525973">
4
+ <testcase classname="test/index.test.ts" name="instrumentNode &gt; should call buildNodeInstrumentation with the provided config" time="0.004943385">
5
5
  </testcase>
6
- <testcase classname="test/index.test.ts" name="instrumentNode &gt; should not throw when called without arguments" time="0.000454542">
6
+ <testcase classname="test/index.test.ts" name="instrumentNode &gt; should not throw when called without arguments" time="0.001780995">
7
7
  </testcase>
8
8
  </testsuite>
9
- <testsuite name="test/node-config.test.ts" timestamp="2024-11-26T09:25:25.587Z" hostname="ABozzelli-ITMAC24" tests="4" failures="0" errors="0" skipped="0" time="0.042719333">
10
- <testcase classname="test/node-config.test.ts" name="verify config settings &gt; grpc config" time="0.017177333">
9
+ <testsuite name="test/metrics.test.ts" timestamp="2025-01-28T15:28:22.388Z" hostname="fv-az367-418" tests="9" failures="0" errors="0" skipped="0" time="0.016880947">
10
+ <testcase classname="test/metrics.test.ts" name="MetricsFactoryMap &gt; should call createGauge when type is &apos;gauge&apos;" time="0.005396083">
11
+ </testcase>
12
+ <testcase classname="test/metrics.test.ts" name="MetricsFactoryMap &gt; should call createHistogram when type is &apos;histogram&apos;" time="0.000557498">
13
+ </testcase>
14
+ <testcase classname="test/metrics.test.ts" name="MetricsFactoryMap &gt; should call createCounter when type is &apos;counter&apos;" time="0.000447099">
15
+ </testcase>
16
+ <testcase classname="test/metrics.test.ts" name="MetricsFactoryMap &gt; should call createUpDownCounter when type is &apos;updowncounter&apos;" time="0.000433999">
17
+ </testcase>
18
+ <testcase classname="test/metrics.test.ts" name="MetricsFactoryMap &gt; should call createObservableCounter when type is &apos;async-counter&apos;" time="0.000520098">
19
+ </testcase>
20
+ <testcase classname="test/metrics.test.ts" name="MetricsFactoryMap &gt; should call createObservableUpDownCounter when type is &apos;async-updowncounter&apos;" time="0.000518598">
21
+ </testcase>
22
+ <testcase classname="test/metrics.test.ts" name="MetricsFactoryMap &gt; should call createObservableGauge when type is &apos;async-gauge&apos;" time="0.000397299">
23
+ </testcase>
24
+ <testcase classname="test/metrics.test.ts" name="MetricsFactoryMap &gt; should throw an error for unsupported metric types" time="0.001743294">
25
+ </testcase>
26
+ <testcase classname="test/metrics.test.ts" name="MetricsFactoryMap &gt; should return noop metric fallback for null config" time="0.004466986">
27
+ <system-err>
28
+ Invaid metric configuration!
29
+
30
+ </system-err>
31
+ </testcase>
32
+ </testsuite>
33
+ <testsuite name="test/node-config.test.ts" timestamp="2025-01-28T15:28:22.391Z" hostname="fv-az367-418" tests="5" failures="0" errors="0" skipped="0" time="0.146814435">
34
+ <testcase classname="test/node-config.test.ts" name="verify config settings &gt; grpc config" time="0.056207422">
35
+ <system-out>
36
+ NodeJS OpenTelemetry instrumentation started successfully.
37
+
38
+ </system-out>
39
+ </testcase>
40
+ <testcase classname="test/node-config.test.ts" name="verify config settings &gt; http config" time="0.04112677">
11
41
  <system-out>
12
42
  NodeJS OpenTelemetry instrumentation started successfully.
13
43
 
14
44
  </system-out>
15
45
  </testcase>
16
- <testcase classname="test/node-config.test.ts" name="verify config settings &gt; http config" time="0.016206917">
46
+ <testcase classname="test/node-config.test.ts" name="verify config settings &gt; console - console config" time="0.01881204">
17
47
  <system-out>
18
48
  NodeJS OpenTelemetry instrumentation started successfully.
19
49
 
20
50
  </system-out>
21
51
  </testcase>
22
- <testcase classname="test/node-config.test.ts" name="verify config settings &gt; single log sending config" time="0.008346875">
52
+ <testcase classname="test/node-config.test.ts" name="verify config settings &gt; single log sending config" time="0.027214414">
23
53
  <system-out>
24
54
  NodeJS OpenTelemetry instrumentation started successfully.
25
55
 
26
56
  </system-out>
27
57
  </testcase>
28
- <testcase classname="test/node-config.test.ts" name="verify config settings &gt; check if clear base endpoint final slash" time="0.000374">
58
+ <testcase classname="test/node-config.test.ts" name="verify config settings &gt; check if clear base endpoint final slash" time="0.001299795">
29
59
  </testcase>
30
60
  </testsuite>
31
- <testsuite name="test/validation.test.ts" timestamp="2024-11-26T09:25:25.587Z" hostname="ABozzelli-ITMAC24" tests="3" failures="0" errors="0" skipped="0" time="0.003302375">
32
- <testcase classname="test/validation.test.ts" name="validation config: should return without breaking the execution &gt; should call buildNodeInstrumentation without config and skip instrumentation" time="0.00188275">
61
+ <testsuite name="test/validation.test.ts" timestamp="2025-01-28T15:28:22.394Z" hostname="fv-az367-418" tests="4" failures="0" errors="0" skipped="0" time="0.017100346">
62
+ <testcase classname="test/validation.test.ts" name="validation config: should return without breaking the execution &gt; should call buildNodeInstrumentation without config and skip instrumentation" time="0.005204683">
63
+ </testcase>
64
+ <testcase classname="test/validation.test.ts" name="validation config: should return without breaking the execution &gt; node instrumentation: url undefined" time="0.002382393">
33
65
  </testcase>
34
- <testcase classname="test/validation.test.ts" name="validation config: should return without breaking the execution &gt; node instrumentation: url undefined" time="0.000551875">
66
+ <testcase classname="test/validation.test.ts" name="validation config: should return without breaking the execution &gt; node instrumentation: invalid url" time="0.000839897">
35
67
  </testcase>
36
- <testcase classname="test/validation.test.ts" name="validation config: should return without breaking the execution &gt; node instrumentation: invalid url" time="0.000253958">
68
+ <testcase classname="test/validation.test.ts" name="validation config: should return without breaking the execution &gt; node instrumentation: verify no instrumentation if exception occurs" time="0.006574379">
37
69
  </testcase>
38
70
  </testsuite>
39
71
  </testsuites>
package/tsconfig.json CHANGED
@@ -8,7 +8,8 @@
8
8
  "forceConsistentCasingInFileNames": true /* Ensure that casing is correct in imports. */,
9
9
  "strict": true /* Enable all strict type-checking options. */,
10
10
  "skipLibCheck": true /* Skip type checking all .d.ts files. */,
11
- "declaration": true
11
+ "declaration": true,
12
+ "resolveJsonModule": true
12
13
  },
13
14
  "exclude": ["**/test/**"]
14
15
  }