@devopsplaybook.io/otel-utils 1.0.0 → 1.0.1-beta2

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/dist/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
1
  export * from "./src/Logger";
2
2
  export * from "./src/StandardMeter";
3
3
  export * from "./src/StandardTracer";
4
- export * as models from "./src/models/ConfigInterface";
4
+ export * as models from "./src/models/ConfigInterfaceOTel";
package/dist/index.js CHANGED
@@ -42,4 +42,4 @@ exports.models = void 0;
42
42
  __exportStar(require("./src/Logger"), exports);
43
43
  __exportStar(require("./src/StandardMeter"), exports);
44
44
  __exportStar(require("./src/StandardTracer"), exports);
45
- exports.models = __importStar(require("./src/models/ConfigInterface"));
45
+ exports.models = __importStar(require("./src/models/ConfigInterfaceOTel"));
@@ -1,6 +1,6 @@
1
1
  import { Span } from "@opentelemetry/sdk-trace-base";
2
- import { ConfigInterface } from "./models/ConfigInterface";
3
- export declare function LoggerInit(context: Span, config: ConfigInterface): void;
2
+ import { ConfigInterfaceOTel } from "./models/ConfigInterfaceOTel";
3
+ export declare function LoggerInit(context: Span, config: ConfigInterfaceOTel): void;
4
4
  export declare class Logger {
5
5
  private module;
6
6
  constructor(module: string);
@@ -1,6 +1,6 @@
1
1
  import { Counter, Histogram, ObservableGauge } from "@opentelemetry/api";
2
- import { ConfigInterface } from "./models/ConfigInterface";
3
- export declare function StandardMeterInitTelemetry(initConfig: ConfigInterface): void;
2
+ import { ConfigInterfaceOTel } from "./models/ConfigInterfaceOTel";
3
+ export declare function StandardMeterInitTelemetry(initConfig: ConfigInterfaceOTel): void;
4
4
  export declare function StandardMeterCreateCounter(key: string): Counter;
5
5
  export declare function StandardMeterCreateUpDownCounter(key: string): Counter;
6
6
  export declare function StandardMeterCreateHistorgram(key: string): Histogram;
@@ -1,7 +1,6 @@
1
1
  import { Span } from "@opentelemetry/sdk-trace-base";
2
- import { ConfigInterface } from "./models/ConfigInterface";
3
- export declare function StandardTracerInitTelemetry(initConfig: ConfigInterface): void;
4
- export declare function StandardTracerGetSpanFromRequest(req: any): Span;
2
+ import { ConfigInterfaceOTel } from "./models/ConfigInterfaceOTel";
3
+ export declare function StandardTracerInitTelemetry(initConfig: ConfigInterfaceOTel): void;
5
4
  export declare function StandardTracerStartSpan(name: string, parentSpan?: Span): Span;
6
5
  export declare function StandardTracerGetTracer(): any;
7
6
  export declare function StandardTracerAppendHeader(context: Span, headers?: {}): any;
@@ -34,7 +34,6 @@ var __importStar = (this && this.__importStar) || (function () {
34
34
  })();
35
35
  Object.defineProperty(exports, "__esModule", { value: true });
36
36
  exports.StandardTracerInitTelemetry = StandardTracerInitTelemetry;
37
- exports.StandardTracerGetSpanFromRequest = StandardTracerGetSpanFromRequest;
38
37
  exports.StandardTracerStartSpan = StandardTracerStartSpan;
39
38
  exports.StandardTracerGetTracer = StandardTracerGetTracer;
40
39
  exports.StandardTracerAppendHeader = StandardTracerAppendHeader;
@@ -80,11 +79,6 @@ function StandardTracerInitTelemetry(initConfig) {
80
79
  contextManager.enable();
81
80
  api_1.default.context.setGlobalContextManager(contextManager);
82
81
  }
83
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
84
- function StandardTracerGetSpanFromRequest(req) {
85
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
86
- return req.tracerSpanApi;
87
- }
88
82
  function StandardTracerStartSpan(name, parentSpan) {
89
83
  const sanitizedName = String(name).replace(/[^a-zA-Z0-9-_/]/g, "_");
90
84
  const tracer = StandardTracerGetTracer();
@@ -0,0 +1,11 @@
1
+ export interface ConfigInterfaceOTel {
2
+ SERVICE_ID: string;
3
+ VERSION: number;
4
+ OPENTELEMETRY_COLLECTOR_HTTP_TRACES: string;
5
+ OPENTELEMETRY_COLLECTOR_HTTP_METRICS: string;
6
+ OPENTELEMETRY_COLLECTOR_HTTP_LOGS: string;
7
+ OPENTELEMETRY_COLLECTOR_EXPORT_LOGS_INTERVAL_SECONDS: number;
8
+ OPENTELEMETRY_COLLECTOR_EXPORT_METRICS_INTERVAL_SECONDS: number;
9
+ OPENTELEMETRY_COLLECTOR_AWS: boolean;
10
+ OPENTELEMETRY_COLLECT_AUTHORIZATION_HEADER: string;
11
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
package/index.ts CHANGED
@@ -4,4 +4,4 @@
4
4
  export * from "./src/Logger";
5
5
  export * from "./src/StandardMeter";
6
6
  export * from "./src/StandardTracer";
7
- export * as models from "./src/models/ConfigInterface";
7
+ export * as models from "./src/models/ConfigInterfaceOTel";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@devopsplaybook.io/otel-utils",
3
- "version": "1.0.0",
3
+ "version": "1.0.1-beta2",
4
4
  "description": "Utility to simplify integration with Open Telemetry",
5
5
  "keywords": [
6
6
  "Open",
@@ -21,7 +21,7 @@
21
21
  "dependencies": {
22
22
  "@opentelemetry/api": "^1.9.0",
23
23
  "@opentelemetry/api-logs": "^0.203.0",
24
- "@opentelemetry/auto-instrumentations-node": "^0.62.0",
24
+ "@opentelemetry/auto-instrumentations-node": "^0.62.1",
25
25
  "@opentelemetry/exporter-logs-otlp-http": "^0.203.0",
26
26
  "@opentelemetry/exporter-trace-otlp-http": "^0.203.0",
27
27
  "@opentelemetry/id-generator-aws-xray": "^2.0.0",
@@ -34,7 +34,7 @@
34
34
  },
35
35
  "devDependencies": {
36
36
  "@types/node": "^24.3.0",
37
- "@types/sqlite3": "^3.1.11"
37
+ "@types/sqlite3": "^5.1.0"
38
38
  },
39
39
  "publishConfig": {
40
40
  "access": "public"
package/src/Logger.ts CHANGED
@@ -13,12 +13,12 @@ import {
13
13
  ATTR_SERVICE_VERSION,
14
14
  } from "@opentelemetry/semantic-conventions";
15
15
  import * as os from "os";
16
- import { ConfigInterface } from "./models/ConfigInterface";
16
+ import { ConfigInterfaceOTel } from "./models/ConfigInterfaceOTel";
17
17
  import { StandardTracerStartSpan } from "./StandardTracer";
18
18
 
19
19
  let loggerOTel: OTelLogger;
20
20
 
21
- export function LoggerInit(context: Span, config: ConfigInterface) {
21
+ export function LoggerInit(context: Span, config: ConfigInterfaceOTel) {
22
22
  const span = StandardTracerStartSpan("LoggerInit", context);
23
23
 
24
24
  if (config.OPENTELEMETRY_COLLECTOR_HTTP_LOGS) {
@@ -11,14 +11,14 @@ import {
11
11
  ATTR_SERVICE_VERSION,
12
12
  } from "@opentelemetry/semantic-conventions";
13
13
  import * as os from "os";
14
- import { ConfigInterface } from "./models/ConfigInterface";
14
+ import { ConfigInterfaceOTel } from "./models/ConfigInterfaceOTel";
15
15
 
16
16
  let meterProvider: MeterProvider;
17
- let config: ConfigInterface;
17
+ let config: ConfigInterfaceOTel;
18
18
  const METER_NAME = "default";
19
19
 
20
20
  //
21
- export function StandardMeterInitTelemetry(initConfig: ConfigInterface) {
21
+ export function StandardMeterInitTelemetry(initConfig: ConfigInterfaceOTel) {
22
22
  config = initConfig;
23
23
 
24
24
  // Metrics
@@ -19,14 +19,14 @@ import {
19
19
  ATTR_SERVICE_VERSION,
20
20
  } from "@opentelemetry/semantic-conventions";
21
21
  import * as os from "os";
22
- import { ConfigInterface } from "./models/ConfigInterface";
22
+ import { ConfigInterfaceOTel } from "./models/ConfigInterfaceOTel";
23
23
 
24
24
  let tracerInstance: Tracer;
25
25
  const propagator = new W3CTraceContextPropagator();
26
- let config: ConfigInterface;
26
+ let config: ConfigInterfaceOTel;
27
27
 
28
28
  //
29
- export function StandardTracerInitTelemetry(initConfig: ConfigInterface) {
29
+ export function StandardTracerInitTelemetry(initConfig: ConfigInterfaceOTel) {
30
30
  config = initConfig;
31
31
  const spanProcessors = [];
32
32
 
@@ -58,12 +58,6 @@ export function StandardTracerInitTelemetry(initConfig: ConfigInterface) {
58
58
  opentelemetry.context.setGlobalContextManager(contextManager);
59
59
  }
60
60
 
61
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
62
- export function StandardTracerGetSpanFromRequest(req: any): Span {
63
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
64
- return (req as any).tracerSpanApi as Span;
65
- }
66
-
67
61
  export function StandardTracerStartSpan(name: string, parentSpan?: Span): Span {
68
62
  const sanitizedName = String(name).replace(/[^a-zA-Z0-9-_/]/g, "_");
69
63
  const tracer = StandardTracerGetTracer();
@@ -1,4 +1,4 @@
1
- export interface ConfigInterface {
1
+ export interface ConfigInterfaceOTel {
2
2
  SERVICE_ID: string;
3
3
  VERSION: number;
4
4
  OPENTELEMETRY_COLLECTOR_HTTP_TRACES: string;