@devopsplaybook.io/otel-utils 1.0.14 → 1.0.16-beta.16.1ec2637
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/.github/workflows/npm-upgrade.yml +3 -0
- package/dist/{src/ModuleLogger.js → ModuleLogger.js} +2 -3
- package/package.json +4 -4
- package/tsconfig.json +12 -6
- package/dist/index.d.ts +0 -6
- package/dist/index.js +0 -22
- package/dist/src/ModuleLogger.d.ts +0 -11
- package/dist/src/StandardLogger.d.ts +0 -11
- package/dist/src/StandardMeter.d.ts +0 -12
- package/dist/src/StandardTracer.d.ts +0 -10
- package/dist/src/models/ConfigOTelInterface.d.ts +0 -11
- package/dist/src/models/StandardLoggerInterface.d.ts +0 -4
- /package/dist/{src/StandardLogger.js → StandardLogger.js} +0 -0
- /package/dist/{src/StandardMeter.js → StandardMeter.js} +0 -0
- /package/dist/{src/StandardTracer.js → StandardTracer.js} +0 -0
- /package/dist/{src/models → models}/ConfigOTelInterface.js +0 -0
- /package/dist/{src/models → models}/StandardLoggerInterface.js +0 -0
|
@@ -17,7 +17,6 @@ class ModuleLogger {
|
|
|
17
17
|
this.display("error", message, api_logs_1.SeverityNumber.ERROR, error, context);
|
|
18
18
|
}
|
|
19
19
|
display(level, message, severityNumber = api_logs_1.SeverityNumber.INFO, error, context) {
|
|
20
|
-
var _a, _b;
|
|
21
20
|
let formattedMessage = message;
|
|
22
21
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
23
22
|
const attributes = { "log.type": "custom" };
|
|
@@ -36,10 +35,10 @@ class ModuleLogger {
|
|
|
36
35
|
}
|
|
37
36
|
}
|
|
38
37
|
console.log(`[${level}] [${this.module}] ${formattedMessage}`);
|
|
39
|
-
if (!
|
|
38
|
+
if (!this.standardLogger?.getLogger()) {
|
|
40
39
|
return;
|
|
41
40
|
}
|
|
42
|
-
|
|
41
|
+
this.standardLogger.getLogger()?.emit({
|
|
43
42
|
severityNumber,
|
|
44
43
|
severityText: level,
|
|
45
44
|
body: `[${this.module}] ${formattedMessage}`,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@devopsplaybook.io/otel-utils",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.16-beta.16.1ec2637",
|
|
4
4
|
"description": "Utility to simplify integration with Open Telemetry",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"Open",
|
|
@@ -34,11 +34,11 @@
|
|
|
34
34
|
},
|
|
35
35
|
"devDependencies": {
|
|
36
36
|
"@eslint/js": "^10.0.1",
|
|
37
|
-
"@types/node": "^25.
|
|
37
|
+
"@types/node": "^25.6.0",
|
|
38
38
|
"@types/sqlite3": "^5.1.0",
|
|
39
39
|
"ts-node": "^10.9.2",
|
|
40
|
-
"typescript-eslint": "^8.
|
|
41
|
-
"typescript": "^
|
|
40
|
+
"typescript-eslint": "^8.58.2",
|
|
41
|
+
"typescript": "^6.0.2"
|
|
42
42
|
},
|
|
43
43
|
"publishConfig": {
|
|
44
44
|
"access": "public"
|
package/tsconfig.json
CHANGED
|
@@ -1,13 +1,19 @@
|
|
|
1
1
|
{
|
|
2
2
|
"compilerOptions": {
|
|
3
|
-
"target": "
|
|
3
|
+
"target": "ES2020",
|
|
4
4
|
"module": "commonjs",
|
|
5
|
-
"
|
|
6
|
-
"
|
|
7
|
-
"
|
|
5
|
+
"lib": ["ES2020"],
|
|
6
|
+
"rootDir": "src",
|
|
7
|
+
"outDir": "dist",
|
|
8
|
+
"allowJs": true,
|
|
8
9
|
"esModuleInterop": true,
|
|
9
10
|
"skipLibCheck": true,
|
|
10
|
-
"forceConsistentCasingInFileNames": true
|
|
11
|
+
"forceConsistentCasingInFileNames": true,
|
|
12
|
+
"strict": false,
|
|
13
|
+
"noImplicitAny": false,
|
|
14
|
+
"strictPropertyInitialization": false,
|
|
15
|
+
"strictNullChecks": false
|
|
11
16
|
},
|
|
12
|
-
"include": ["
|
|
17
|
+
"include": ["src/**/*"],
|
|
18
|
+
"exclude": ["node_modules", "coverage", "test", "dist", "src/**/*.spec.ts"]
|
|
13
19
|
}
|
package/dist/index.d.ts
DELETED
package/dist/index.js
DELETED
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
-
};
|
|
16
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
__exportStar(require("./src/models/ConfigOTelInterface"), exports);
|
|
18
|
-
__exportStar(require("./src/models/StandardLoggerInterface"), exports);
|
|
19
|
-
__exportStar(require("./src/ModuleLogger"), exports);
|
|
20
|
-
__exportStar(require("./src/StandardLogger"), exports);
|
|
21
|
-
__exportStar(require("./src/StandardMeter"), exports);
|
|
22
|
-
__exportStar(require("./src/StandardTracer"), exports);
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { StandardLoggerInterface } from "./models/StandardLoggerInterface";
|
|
2
|
-
import { Span } from "@opentelemetry/sdk-trace-base";
|
|
3
|
-
export declare class ModuleLogger {
|
|
4
|
-
private module;
|
|
5
|
-
private standardLogger?;
|
|
6
|
-
constructor(module: string, standardLogger: StandardLoggerInterface);
|
|
7
|
-
info(message: string, context?: Span): void;
|
|
8
|
-
warn(message: string, context?: Span): void;
|
|
9
|
-
error(message: string, error?: Error, context?: Span): void;
|
|
10
|
-
private display;
|
|
11
|
-
}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import type { Logger as OTelLogger } from "@opentelemetry/api-logs";
|
|
2
|
-
import { ConfigOTelInterface } from "./models/ConfigOTelInterface";
|
|
3
|
-
import { ModuleLogger } from "./ModuleLogger";
|
|
4
|
-
export declare class StandardLogger {
|
|
5
|
-
private logger?;
|
|
6
|
-
private serviceVersion?;
|
|
7
|
-
private serviceName?;
|
|
8
|
-
initOTel(config: ConfigOTelInterface): void;
|
|
9
|
-
getLogger(): OTelLogger | undefined;
|
|
10
|
-
createModuleLogger(moduleName: string): ModuleLogger;
|
|
11
|
-
}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { Counter, Histogram, ObservableGauge } from "@opentelemetry/api";
|
|
2
|
-
import { ConfigOTelInterface } from "./models/ConfigOTelInterface";
|
|
3
|
-
export declare class StandardMeter {
|
|
4
|
-
private meter;
|
|
5
|
-
private serviceVersion;
|
|
6
|
-
private serviceName;
|
|
7
|
-
constructor(config: ConfigOTelInterface);
|
|
8
|
-
createCounter(key: string): Counter;
|
|
9
|
-
createUpDownCounter(key: string): Counter;
|
|
10
|
-
createHistogram(key: string): Histogram;
|
|
11
|
-
createObservableGauge(key: string, callback: (observableResult: any) => void, description?: any): ObservableGauge;
|
|
12
|
-
}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { Span } from "@opentelemetry/sdk-trace-base";
|
|
2
|
-
import { ConfigOTelInterface } from "./models/ConfigOTelInterface";
|
|
3
|
-
export declare class StandardTracer {
|
|
4
|
-
private tracer;
|
|
5
|
-
private serviceVersion;
|
|
6
|
-
private serviceName;
|
|
7
|
-
constructor(config: ConfigOTelInterface);
|
|
8
|
-
startSpan(name: string, parentSpan?: Span): Span;
|
|
9
|
-
static updateHttpHeader(context: Span, headers?: {}): any;
|
|
10
|
-
}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
export interface ConfigOTelInterface {
|
|
2
|
-
SERVICE_ID: string;
|
|
3
|
-
VERSION: string;
|
|
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
|
-
}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|