@golemio/core 1.21.2-dev.2016578744 → 1.21.2-dev.2027401422
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/monitoring/opentelemetry/semconv.d.ts +1 -0
- package/dist/monitoring/opentelemetry/semconv.js +9 -0
- package/dist/monitoring/opentelemetry/semconv.js.map +1 -0
- package/dist/monitoring/opentelemetry/trace-provider.d.ts +6 -8
- package/dist/monitoring/opentelemetry/trace-provider.js +41 -39
- package/dist/monitoring/opentelemetry/trace-provider.js.map +1 -1
- package/package.json +2 -2
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const ATTR_DEPLOYMENT_ENVIRONMENT_NAME: "deployment.environment.name";
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ATTR_DEPLOYMENT_ENVIRONMENT_NAME = void 0;
|
|
4
|
+
/*
|
|
5
|
+
* according to https://github.com/open-telemetry/opentelemetry-js/blob/main/semantic-conventions/README.md#unstable-semconv
|
|
6
|
+
* this file should be used for experimental semantic conventions
|
|
7
|
+
**/
|
|
8
|
+
exports.ATTR_DEPLOYMENT_ENVIRONMENT_NAME = "deployment.environment.name";
|
|
9
|
+
//# sourceMappingURL=semconv.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"semconv.js","sourceRoot":"","sources":["../../../src/monitoring/opentelemetry/semconv.ts"],"names":[],"mappings":";;;AAAA;;;IAGI;AACS,QAAA,gCAAgC,GAAG,6BAAsC,CAAC"}
|
|
@@ -1,17 +1,15 @@
|
|
|
1
1
|
import { DiagLogLevel, Span } from "@opentelemetry/api";
|
|
2
|
-
export declare enum
|
|
2
|
+
export declare enum TelemetryProcessorType {
|
|
3
3
|
CONSOLE = "CONSOLE",
|
|
4
4
|
EXPORTER = "EXPORTER",
|
|
5
5
|
BOTH = "BOTH"
|
|
6
6
|
}
|
|
7
|
-
export interface
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
jaegerPort: number | undefined;
|
|
12
|
-
jaegerProcessor: keyof typeof JaegerProcessorType;
|
|
7
|
+
export interface ITelemetryConfig {
|
|
8
|
+
telemetryEnabled: boolean;
|
|
9
|
+
otlpEndpoint: string | undefined;
|
|
10
|
+
telemetryProcessor: keyof typeof TelemetryProcessorType;
|
|
13
11
|
diagLogLevel: DiagLogLevel;
|
|
14
|
-
|
|
12
|
+
serviceName: string | undefined;
|
|
15
13
|
}
|
|
16
14
|
export declare const initTraceProvider: () => void;
|
|
17
15
|
export declare const createChildSpan: (spanName: string) => undefined | Span;
|
|
@@ -1,73 +1,75 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.createChildSpan = exports.initTraceProvider = exports.
|
|
4
|
-
const instrumentation_1 = require("
|
|
5
|
-
const sdk_trace_node_1 = require("@opentelemetry/sdk-trace-node");
|
|
6
|
-
const semantic_conventions_1 = require("@opentelemetry/semantic-conventions");
|
|
7
|
-
const sdk_trace_base_1 = require("@opentelemetry/sdk-trace-base");
|
|
8
|
-
const exporter_jaeger_1 = require("@opentelemetry/exporter-jaeger");
|
|
3
|
+
exports.createChildSpan = exports.initTraceProvider = exports.TelemetryProcessorType = void 0;
|
|
4
|
+
const instrumentation_1 = require("./instrumentation");
|
|
9
5
|
const api_1 = require("@opentelemetry/api");
|
|
10
|
-
const
|
|
6
|
+
const exporter_trace_otlp_grpc_1 = require("@opentelemetry/exporter-trace-otlp-grpc");
|
|
7
|
+
const instrumentation_2 = require("@opentelemetry/instrumentation");
|
|
11
8
|
const resources_1 = require("@opentelemetry/resources");
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
9
|
+
const sdk_trace_base_1 = require("@opentelemetry/sdk-trace-base");
|
|
10
|
+
const sdk_trace_node_1 = require("@opentelemetry/sdk-trace-node");
|
|
11
|
+
const semconv_1 = require("./semconv");
|
|
12
|
+
const semantic_conventions_1 = require("@opentelemetry/semantic-conventions");
|
|
13
|
+
var TelemetryProcessorType;
|
|
14
|
+
(function (TelemetryProcessorType) {
|
|
15
|
+
TelemetryProcessorType["CONSOLE"] = "CONSOLE";
|
|
16
|
+
TelemetryProcessorType["EXPORTER"] = "EXPORTER";
|
|
17
|
+
TelemetryProcessorType["BOTH"] = "BOTH";
|
|
18
|
+
})(TelemetryProcessorType || (exports.TelemetryProcessorType = TelemetryProcessorType = {}));
|
|
18
19
|
const getTelemetryConfig = () => {
|
|
19
20
|
return {
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
? process.env.JAEGER_PROCESSOR
|
|
26
|
-
: JaegerProcessorType.CONSOLE,
|
|
21
|
+
telemetryEnabled: process.env.TELEMETRY_ENABLED === "true",
|
|
22
|
+
otlpEndpoint: process.env.OTLP_ENDPOINT || process.env.JAEGER_ENDPOINT,
|
|
23
|
+
telemetryProcessor: process.env.TELEMETRY_PROCESSOR && process.env.TELEMETRY_PROCESSOR in TelemetryProcessorType
|
|
24
|
+
? process.env.TELEMETRY_PROCESSOR
|
|
25
|
+
: TelemetryProcessorType.CONSOLE,
|
|
27
26
|
diagLogLevel: process.env.TELEMETRY_LOG_LEVEL ? parseInt(process.env.TELEMETRY_LOG_LEVEL, 10) : 60,
|
|
28
|
-
|
|
27
|
+
serviceName: process.env.APP_NAME || "golemio",
|
|
29
28
|
};
|
|
30
29
|
};
|
|
31
30
|
const initTraceProvider = () => {
|
|
32
31
|
const config = getTelemetryConfig();
|
|
33
32
|
const spanProcessors = [];
|
|
34
33
|
api_1.diag.setLogger(new api_1.DiagConsoleLogger(), config.diagLogLevel);
|
|
35
|
-
if (!config.
|
|
36
|
-
api_1.diag.info(`Telemetry disabled (service: ${config.
|
|
34
|
+
if (!config.telemetryEnabled) {
|
|
35
|
+
api_1.diag.info(`Telemetry disabled (service: ${config.serviceName})`);
|
|
37
36
|
return;
|
|
38
37
|
}
|
|
39
38
|
else {
|
|
40
|
-
api_1.diag.info(`Telemetry enabled (service: ${config.
|
|
39
|
+
api_1.diag.info(`Telemetry enabled (service: ${config.serviceName})`);
|
|
41
40
|
}
|
|
42
|
-
if (config.
|
|
41
|
+
if (config.telemetryProcessor === TelemetryProcessorType.CONSOLE ||
|
|
42
|
+
config.telemetryProcessor === TelemetryProcessorType.BOTH) {
|
|
43
43
|
spanProcessors.push(new sdk_trace_base_1.SimpleSpanProcessor(new sdk_trace_base_1.ConsoleSpanExporter()));
|
|
44
44
|
}
|
|
45
|
-
if (config.
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
45
|
+
if (config.telemetryProcessor === TelemetryProcessorType.EXPORTER ||
|
|
46
|
+
config.telemetryProcessor === TelemetryProcessorType.BOTH) {
|
|
47
|
+
if (config.otlpEndpoint) {
|
|
48
|
+
const spanExporter = new exporter_trace_otlp_grpc_1.OTLPTraceExporter({
|
|
49
|
+
url: config.otlpEndpoint,
|
|
50
|
+
});
|
|
51
|
+
spanProcessors.push(new sdk_trace_base_1.BatchSpanProcessor(spanExporter));
|
|
52
|
+
}
|
|
53
|
+
else {
|
|
54
|
+
api_1.diag.warn("OTLP endpoint not configured, skipping exporter setup");
|
|
55
|
+
}
|
|
54
56
|
}
|
|
55
57
|
const provider = new sdk_trace_node_1.NodeTracerProvider({
|
|
56
58
|
resource: (0, resources_1.resourceFromAttributes)({
|
|
57
|
-
[semantic_conventions_1.
|
|
58
|
-
...(process.env.NODE_ENV && { [
|
|
59
|
+
[semantic_conventions_1.ATTR_SERVICE_NAME]: process.env.APP_NAME,
|
|
60
|
+
...(process.env.NODE_ENV && { [semconv_1.ATTR_DEPLOYMENT_ENVIRONMENT_NAME]: process.env.NODE_ENV }),
|
|
59
61
|
}),
|
|
60
62
|
spanProcessors,
|
|
61
63
|
});
|
|
62
64
|
provider.register();
|
|
63
|
-
(0,
|
|
65
|
+
(0, instrumentation_2.registerInstrumentations)({
|
|
64
66
|
tracerProvider: provider,
|
|
65
|
-
instrumentations: (0,
|
|
67
|
+
instrumentations: (0, instrumentation_1.getInstrumentation)(),
|
|
66
68
|
});
|
|
67
69
|
};
|
|
68
70
|
exports.initTraceProvider = initTraceProvider;
|
|
69
71
|
const createChildSpan = (spanName) => {
|
|
70
|
-
if (!(process.env.
|
|
72
|
+
if (!(process.env.TELEMETRY_ENABLED === "true")) {
|
|
71
73
|
return;
|
|
72
74
|
}
|
|
73
75
|
const tracer = api_1.trace.getTracerProvider().getTracer("tracer");
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"trace-provider.js","sourceRoot":"","sources":["../../../src/monitoring/opentelemetry/trace-provider.ts"],"names":[],"mappings":";;;AAAA,oEAA0E;AAC1E,
|
|
1
|
+
{"version":3,"file":"trace-provider.js","sourceRoot":"","sources":["../../../src/monitoring/opentelemetry/trace-provider.ts"],"names":[],"mappings":";;;AAAA,uDAA+E;AAC/E,4CAAwF;AACxF,sFAA4E;AAC5E,oEAA0E;AAC1E,wDAAkE;AAClE,kEAA2H;AAC3H,kEAAmE;AACnE,uCAA6D;AAC7D,8EAAwE;AAExE,IAAY,sBAIX;AAJD,WAAY,sBAAsB;IAC9B,6CAAmB,CAAA;IACnB,+CAAqB,CAAA;IACrB,uCAAa,CAAA;AACjB,CAAC,EAJW,sBAAsB,sCAAtB,sBAAsB,QAIjC;AAUD,MAAM,kBAAkB,GAAG,GAAqB,EAAE;IAC9C,OAAO;QACH,gBAAgB,EAAE,OAAO,CAAC,GAAG,CAAC,iBAAiB,KAAK,MAAM;QAC1D,YAAY,EAAE,OAAO,CAAC,GAAG,CAAC,aAAa,IAAI,OAAO,CAAC,GAAG,CAAC,eAAe;QACtE,kBAAkB,EACd,OAAO,CAAC,GAAG,CAAC,mBAAmB,IAAI,O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
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -74,7 +74,7 @@
|
|
|
74
74
|
"@golemio/validator": "0.3.6-dev.1288217736",
|
|
75
75
|
"@google-cloud/storage": "^7.16.0",
|
|
76
76
|
"@opentelemetry/api": "^1.9.0",
|
|
77
|
-
"@opentelemetry/exporter-
|
|
77
|
+
"@opentelemetry/exporter-trace-otlp-grpc": "^0.204.0",
|
|
78
78
|
"@opentelemetry/instrumentation-amqplib": "^0.50.0",
|
|
79
79
|
"@opentelemetry/instrumentation-aws-sdk": "^0.56.0",
|
|
80
80
|
"@opentelemetry/instrumentation-express": "^0.52.0",
|