@codefresh-io/cf-telemetry 2.0.0-alpha.1 → 2.0.0-alpha.3
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/config.d.ts +3 -0
- package/dist/config.js +7 -0
- package/dist/config.js.map +1 -0
- package/dist/import.d.mts +1 -0
- package/dist/import.mjs +6 -0
- package/dist/import.mjs.map +1 -0
- package/dist/index.d.ts +9 -5
- package/dist/index.js +36 -13
- package/dist/index.js.map +1 -1
- package/dist/metrics/prometheus/index.d.ts +1 -1
- package/dist/metrics/prometheus/index.js +2 -2
- package/dist/metrics/prometheus/index.js.map +1 -1
- package/dist/metrics/prometheus/init-prometheus.d.ts +1 -1
- package/dist/metrics/prometheus/init-prometheus.js +10 -9
- package/dist/metrics/prometheus/init-prometheus.js.map +1 -1
- package/dist/otel/config.d.ts +4 -0
- package/dist/otel/config.js +8 -0
- package/dist/otel/config.js.map +1 -0
- package/dist/otel/index.d.ts +4 -0
- package/dist/otel/index.js +69 -0
- package/dist/otel/index.js.map +1 -0
- package/dist/otel/sdk.d.ts +2 -0
- package/dist/otel/sdk.js +35 -0
- package/dist/otel/sdk.js.map +1 -0
- package/dist/profiles/index.d.ts +1 -1
- package/dist/profiles/index.js +5 -4
- package/dist/profiles/index.js.map +1 -1
- package/package.json +8 -2
package/dist/config.d.ts
ADDED
package/dist/config.js
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.config = void 0;
|
|
4
|
+
exports.config = {
|
|
5
|
+
terminateSignals: process.env['CF_TELEMETRY_TERMINATE_SIGNALS']?.split(',') ?? ['SIGINT', 'SIGTERM'],
|
|
6
|
+
};
|
|
7
|
+
//# sourceMappingURL=config.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.js","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":";;;AAAa,QAAA,MAAM,GAAG;IACpB,gBAAgB,EAAE,OAAO,CAAC,GAAG,CAAC,gCAAgC,CAAC,EAAE,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC,QAAQ,EAAE,SAAS,CAAC;CAC5F,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/dist/import.mjs
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"import.mjs","sourceRoot":"","sources":["../src/import.mts"],"names":[],"mappings":";AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,SAAS,CAAC;AAE/B,6DAA6D;AAC7D,aAAa;AACb,MAAM,IAAI,EAAE,CAAC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,14 +1,18 @@
|
|
|
1
|
-
import * as
|
|
2
|
-
import * as
|
|
1
|
+
import * as _logger from './logger';
|
|
2
|
+
import * as _prometheus from './metrics/prometheus';
|
|
3
|
+
import * as _otel from './otel';
|
|
3
4
|
export declare const init: () => Promise<void>;
|
|
4
5
|
export declare const prometheus: {
|
|
5
|
-
register:
|
|
6
|
-
metrics: typeof
|
|
6
|
+
register: _prometheus.client.Registry<"text/plain; version=0.0.4; charset=utf-8">;
|
|
7
|
+
metrics: typeof _prometheus.metrics;
|
|
7
8
|
};
|
|
8
9
|
export declare const mongodb: {
|
|
9
10
|
monitorMongoDBClient: (client: import("mongodb").MongoClient, connectionPool?: string) => void;
|
|
10
11
|
};
|
|
11
12
|
export declare const logs: {
|
|
12
|
-
Logger: typeof
|
|
13
|
+
Logger: typeof _logger.Logger;
|
|
13
14
|
runInContext: <R, TArgs extends unknown[]>({ initiator, target, account_id }: import("./logger/types").LogMetadata, callback: (...args: TArgs) => R, ...args: TArgs) => R;
|
|
14
15
|
};
|
|
16
|
+
export declare const otel: {
|
|
17
|
+
api: typeof _otel.api;
|
|
18
|
+
};
|
package/dist/index.js
CHANGED
|
@@ -33,30 +33,53 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
33
33
|
};
|
|
34
34
|
})();
|
|
35
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
-
exports.logs = exports.mongodb = exports.prometheus = exports.init = void 0;
|
|
37
|
-
const
|
|
38
|
-
const
|
|
39
|
-
const
|
|
40
|
-
const
|
|
36
|
+
exports.otel = exports.logs = exports.mongodb = exports.prometheus = exports.init = void 0;
|
|
37
|
+
const config_1 = require("./config");
|
|
38
|
+
const _logger = __importStar(require("./logger"));
|
|
39
|
+
const _mongodb = __importStar(require("./metrics/mongodb"));
|
|
40
|
+
const _prometheus = __importStar(require("./metrics/prometheus"));
|
|
41
|
+
const _otel = __importStar(require("./otel"));
|
|
42
|
+
const _profiles = __importStar(require("./profiles"));
|
|
43
|
+
let isInitialized = false;
|
|
44
|
+
const terminate = async () => {
|
|
45
|
+
const logger = new _logger.Logger('telemetry');
|
|
46
|
+
try {
|
|
47
|
+
logger.info('Terminating telemetry services');
|
|
48
|
+
await _otel.terminate(logger).catch(logger.error);
|
|
49
|
+
isInitialized = false;
|
|
50
|
+
logger.info('Telemetry services terminated');
|
|
51
|
+
}
|
|
52
|
+
catch (exception) {
|
|
53
|
+
logger.error('Failed to terminate telemetry services', exception);
|
|
54
|
+
}
|
|
55
|
+
};
|
|
41
56
|
const init = async () => {
|
|
42
|
-
|
|
57
|
+
if (isInitialized)
|
|
58
|
+
return;
|
|
59
|
+
const logger = new _logger.Logger('telemetry');
|
|
43
60
|
logger.info('Initializing telemetry services');
|
|
61
|
+
await _otel.init(logger).catch(logger.error); // Should initialize first
|
|
44
62
|
await Promise.all([
|
|
45
|
-
|
|
46
|
-
|
|
63
|
+
_prometheus.init(logger).catch(logger.error),
|
|
64
|
+
_profiles.init(logger).catch(logger.error),
|
|
47
65
|
]);
|
|
66
|
+
config_1.config.terminateSignals.forEach(signal => process.on(signal, terminate));
|
|
67
|
+
isInitialized = true;
|
|
48
68
|
logger.info('Telemetry services initialized');
|
|
49
69
|
};
|
|
50
70
|
exports.init = init;
|
|
51
71
|
exports.prometheus = {
|
|
52
|
-
register:
|
|
53
|
-
metrics:
|
|
72
|
+
register: _prometheus.register,
|
|
73
|
+
metrics: _prometheus.metrics,
|
|
54
74
|
};
|
|
55
75
|
exports.mongodb = {
|
|
56
|
-
monitorMongoDBClient:
|
|
76
|
+
monitorMongoDBClient: _mongodb.monitorMongoDBClient,
|
|
57
77
|
};
|
|
58
78
|
exports.logs = {
|
|
59
|
-
Logger:
|
|
60
|
-
runInContext:
|
|
79
|
+
Logger: _logger.Logger,
|
|
80
|
+
runInContext: _logger.runInContext,
|
|
81
|
+
};
|
|
82
|
+
exports.otel = {
|
|
83
|
+
api: _otel.api,
|
|
61
84
|
};
|
|
62
85
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,8CAAgC;AAChC,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,qCAAkC;AAClC,kDAAoC;AACpC,4DAA8C;AAC9C,kEAAoD;AACpD,8CAAgC;AAChC,sDAAwC;AAExC,IAAI,aAAa,GAAG,KAAK,CAAC;AAE1B,MAAM,SAAS,GAAG,KAAK,IAAmB,EAAE;IAC1C,MAAM,MAAM,GAAG,IAAI,OAAO,CAAC,MAAM,CAAC,WAAW,CAAC,CAAC;IAC/C,IAAI,CAAC;QACH,MAAM,CAAC,IAAI,CAAC,gCAAgC,CAAC,CAAC;QAC9C,MAAM,KAAK,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;QAClD,aAAa,GAAG,KAAK,CAAC;QACtB,MAAM,CAAC,IAAI,CAAC,+BAA+B,CAAC,CAAC;IA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AAI,GAAG;IAClB,GAAG,EAAE,KAAK,CAAC,GAAG;CACf,CAAC"}
|
|
@@ -33,11 +33,11 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
33
33
|
};
|
|
34
34
|
})();
|
|
35
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
-
exports.metrics = exports.
|
|
36
|
+
exports.metrics = exports.init = exports.register = exports.client = void 0;
|
|
37
37
|
var client_1 = require("./client");
|
|
38
38
|
Object.defineProperty(exports, "client", { enumerable: true, get: function () { return client_1.client; } });
|
|
39
39
|
Object.defineProperty(exports, "register", { enumerable: true, get: function () { return client_1.register; } });
|
|
40
40
|
var init_prometheus_1 = require("./init-prometheus");
|
|
41
|
-
Object.defineProperty(exports, "
|
|
41
|
+
Object.defineProperty(exports, "init", { enumerable: true, get: function () { return init_prometheus_1.init; } });
|
|
42
42
|
exports.metrics = __importStar(require("./metrics"));
|
|
43
43
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/metrics/prometheus/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,mCAA4C;AAAnC,gGAAA,MAAM,OAAA;AAAE,kGAAA,QAAQ,OAAA;AACzB,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/metrics/prometheus/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,mCAA4C;AAAnC,gGAAA,MAAM,OAAA;AAAE,kGAAA,QAAQ,OAAA;AACzB,qDAAyC;AAAhC,uGAAA,IAAI,OAAA;AACb,qDAAqC"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import type { Logger } from '../../logger';
|
|
2
|
-
export declare const
|
|
2
|
+
export declare const init: (logger: Logger) => Promise<void>;
|
|
@@ -3,19 +3,20 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.
|
|
6
|
+
exports.init = void 0;
|
|
7
7
|
const fastify_1 = __importDefault(require("fastify"));
|
|
8
8
|
const client_1 = require("./client");
|
|
9
9
|
const config_1 = require("./config");
|
|
10
|
-
const
|
|
10
|
+
const init = async (logger) => {
|
|
11
11
|
logger = logger.child('prometheus');
|
|
12
|
-
if (config_1.config.enabled === false) {
|
|
13
|
-
logger.info('Prometheus server is disabled. Set CF_TELEMETRY_PROMETHEUS_ENABLE=true to enable it');
|
|
14
|
-
return;
|
|
15
|
-
}
|
|
16
|
-
;
|
|
17
12
|
try {
|
|
18
|
-
|
|
13
|
+
if (config_1.config.enabled === false) {
|
|
14
|
+
logger.info('Prometheus server is disabled. Set CF_TELEMETRY_PROMETHEUS_ENABLE=true to enable it');
|
|
15
|
+
return;
|
|
16
|
+
}
|
|
17
|
+
;
|
|
18
|
+
logger.info('Initializing Prometheus');
|
|
19
|
+
logger.debug('Prometheus configuration', config_1.config);
|
|
19
20
|
if (config_1.config.shouldCollectProcessMetrics)
|
|
20
21
|
client_1.client.collectDefaultMetrics();
|
|
21
22
|
const metricsServer = (0, fastify_1.default)();
|
|
@@ -34,5 +35,5 @@ const initPrometheus = async (logger) => {
|
|
|
34
35
|
logger.error('Failed to initialize Prometheus', exception);
|
|
35
36
|
}
|
|
36
37
|
};
|
|
37
|
-
exports.
|
|
38
|
+
exports.init = init;
|
|
38
39
|
//# sourceMappingURL=init-prometheus.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"init-prometheus.js","sourceRoot":"","sources":["../../../src/metrics/prometheus/init-prometheus.ts"],"names":[],"mappings":";;;;;;AAAA,sDAA8B;AAE9B,qCAA4C;AAC5C,qCAAkC;AAE3B,MAAM,
|
|
1
|
+
{"version":3,"file":"init-prometheus.js","sourceRoot":"","sources":["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wBf"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.config = void 0;
|
|
4
|
+
exports.config = {
|
|
5
|
+
enabled: process.env['CF_TELEMETRY_OTEL_ENABLE'] === 'true',
|
|
6
|
+
serviceName: process.env['CF_TELEMETRY_SERVICE_NAME'],
|
|
7
|
+
};
|
|
8
|
+
//# sourceMappingURL=config.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.js","sourceRoot":"","sources":["../../src/otel/config.ts"],"names":[],"mappings":";;;AAAa,QAAA,MAAM,GAAG;IACpB,OAAO,EAAE,OAAO,CAAC,GAAG,CAAC,0BAA0B,CAAC,KAAK,MAAM;IAC3D,WAAW,EAAE,OAAO,CAAC,GAAG,CAAC,2BAA2B,CAAC;CAC7C,CAAC"}
|
|
@@ -0,0 +1,69 @@
|
|
|
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 __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
exports.api = exports.terminate = exports.init = void 0;
|
|
37
|
+
const sdk_1 = require("./sdk");
|
|
38
|
+
const config_1 = require("./config");
|
|
39
|
+
const init = async (logger) => {
|
|
40
|
+
logger = logger.child('otel');
|
|
41
|
+
try {
|
|
42
|
+
if (!config_1.config.enabled) {
|
|
43
|
+
logger.info('OpenTelemetry is disabled. Set CF_TELEMETRY_OTEL_ENABLE=true to enable it');
|
|
44
|
+
return;
|
|
45
|
+
}
|
|
46
|
+
logger.info('Initializing OpenTelemetry');
|
|
47
|
+
logger.debug('OpenTelemetry configuration', config_1.config);
|
|
48
|
+
sdk_1.sdk.start();
|
|
49
|
+
logger.info('OpenTelemetry initialized');
|
|
50
|
+
}
|
|
51
|
+
catch (exception) {
|
|
52
|
+
logger.error('Failed to initialize OpenTelemetry', exception);
|
|
53
|
+
}
|
|
54
|
+
};
|
|
55
|
+
exports.init = init;
|
|
56
|
+
const terminate = async (logger) => {
|
|
57
|
+
logger = logger.child('otel');
|
|
58
|
+
try {
|
|
59
|
+
logger.info('Terminating OpenTelemetry');
|
|
60
|
+
await sdk_1.sdk.shutdown();
|
|
61
|
+
logger.info('OpenTelemetry terminated');
|
|
62
|
+
}
|
|
63
|
+
catch (exception) {
|
|
64
|
+
logger.error('Failed to terminate OpenTelemetry', exception);
|
|
65
|
+
}
|
|
66
|
+
};
|
|
67
|
+
exports.terminate = terminate;
|
|
68
|
+
exports.api = __importStar(require("@opentelemetry/api"));
|
|
69
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/otel/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,+BAA4B;AAC5B,qCAAkC;AAG3B,MAAM,IAAI,GAAG,KAAK,EAAE,MAAc,EAAiB,EAAE;IAC1D,MAAM,GAAG,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;IAC9B,IAAI,CAAC;QACH,IAAI,CAAC,eAAM,CAAC,OAAO,EAAE,CAAC;YACpB,MAAM,CAAC,IAAI,CAAC,2EAA2E,CAAC,CAAC;YACzF,OAAO;QACT,CAAC;QACD,MAAM,CAAC,IAAI,CAAC,4BAA4B,CAAC,CAAC;QAC1C,MAAM,CAAC,KAAK,CAAC,6BAA6B,EAAE,eAAM,CAAC,CAAC;QACpD,SAAG,CAAC,KAAK,EAAE,CAAC;QACZ,MAAM,CAAC,IAAI,CAAC,2BAA2B,CAAC,CAAC;IAC3C,CAAC;IAAC,OAAO,SAAS,EAAE,CAAC;QACnB,MAAM,CAAC,KAAK,CAAC,oCAAoC,EAAE,SAAS,CAAC,CAAC;IAChE,CAAC;AACH,CAAC,CAAC;AAdW,QAAA,IAAI,QAcf;AAEK,MAAM,SAAS,GAAG,KAAK,EAAE,MAAc,EAAiB,EAAE;IAC/D,MAAM,GAAG,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;IAC9B,IAAI,CAAC;QACH,MAAM,CAAC,IAAI,CAAC,2BAA2B,CAAC,CAAC;QACzC,MAAM,SAAG,CAAC,QAAQ,EAAE,CAAC;QACrB,MAAM,CAAC,IAAI,CAAC,0BAA0B,CAAC,CAAC;IAC1C,CAAC;IAAC,OAAO,SAAS,EAAE,CAAC;QACnB,MAAM,CAAC,KAAK,CAAC,mCAAmC,EAAE,SAAS,CAAC,CAAC;IAC/D,CAAC;AACH,CAAC,CAAC;AATW,QAAA,SAAS,aASpB;AAEF,0DAA0C"}
|
package/dist/otel/sdk.js
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.sdk = void 0;
|
|
4
|
+
const auto_instrumentations_node_1 = require("@opentelemetry/auto-instrumentations-node");
|
|
5
|
+
const baggage_span_processor_1 = require("@opentelemetry/baggage-span-processor");
|
|
6
|
+
const context_async_hooks_1 = require("@opentelemetry/context-async-hooks");
|
|
7
|
+
const core_1 = require("@opentelemetry/core");
|
|
8
|
+
const exporter_prometheus_1 = require("@opentelemetry/exporter-prometheus");
|
|
9
|
+
const exporter_trace_otlp_grpc_1 = require("@opentelemetry/exporter-trace-otlp-grpc");
|
|
10
|
+
const propagator_b3_1 = require("@opentelemetry/propagator-b3");
|
|
11
|
+
const sdk_node_1 = require("@opentelemetry/sdk-node");
|
|
12
|
+
const sdk_trace_base_1 = require("@opentelemetry/sdk-trace-base");
|
|
13
|
+
const config_1 = require("./config");
|
|
14
|
+
exports.sdk = new sdk_node_1.NodeSDK({
|
|
15
|
+
serviceName: config_1.config.serviceName,
|
|
16
|
+
metricReader: new exporter_prometheus_1.PrometheusExporter(),
|
|
17
|
+
spanProcessors: [
|
|
18
|
+
new sdk_trace_base_1.BatchSpanProcessor(new exporter_trace_otlp_grpc_1.OTLPTraceExporter()),
|
|
19
|
+
// It copies baggage info from parent span to child span
|
|
20
|
+
new baggage_span_processor_1.BaggageSpanProcessor(baggage_span_processor_1.ALLOW_ALL_BAGGAGE_KEYS),
|
|
21
|
+
],
|
|
22
|
+
contextManager: new context_async_hooks_1.AsyncLocalStorageContextManager(),
|
|
23
|
+
textMapPropagator: new core_1.CompositePropagator({
|
|
24
|
+
propagators: [
|
|
25
|
+
new core_1.W3CTraceContextPropagator(),
|
|
26
|
+
new core_1.W3CBaggagePropagator(),
|
|
27
|
+
new propagator_b3_1.B3Propagator(),
|
|
28
|
+
new propagator_b3_1.B3Propagator({
|
|
29
|
+
injectEncoding: propagator_b3_1.B3InjectEncoding.MULTI_HEADER,
|
|
30
|
+
}),
|
|
31
|
+
],
|
|
32
|
+
}),
|
|
33
|
+
instrumentations: [(0, auto_instrumentations_node_1.getNodeAutoInstrumentations)()],
|
|
34
|
+
});
|
|
35
|
+
//# sourceMappingURL=sdk.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sdk.js","sourceRoot":"","sources":["../../src/otel/sdk.ts"],"names":[],"mappings":";;;AAAA,0FAAwF;AACxF,kFAAqG;AACrG,4EAAqF;AACrF,8CAA2G;AAC3G,4EAAwE;AACxE,sFAA4E;AAC5E,gEAA8E;AAC9E,sDAAkD;AAClD,kEAAmE;AACnE,qCAAkC;AAErB,QAAA,GAAG,GAAG,IAAI,kBAAO,CAAC;IAC7B,WAAW,EAAE,eAAM,CAAC,WAAW;IAC/B,YAAY,EAAE,IAAI,wCAAkB,EAAE;IACtC,cAAc,EAAE;QACd,IAAI,mCAAkB,CAAC,IAAI,4CAAiB,EAAE,CAAC;QAC/C,wDAAwD;QACxD,IAAI,6CAAoB,CAAC,+CAAsB,CAAC;KACjD;IACD,cAAc,EAAE,IAAI,qDAA+B,EAAE;IACrD,iBAAiB,EAAE,IAAI,0BAAmB,CAAC;QACzC,WAAW,EAAE;YACX,IAAI,gCAAyB,EAAE;YAC/B,IAAI,2BAAoB,EAAE;YAC1B,IAAI,4BAAY,EAAE;YAClB,IAAI,4BAAY,CAAC;gBACf,cAAc,EAAE,gCAAgB,CAAC,YAAY;aAC9C,CAAC;SACH;KACF,CAAC;IACF,gBAAgB,EAAE,CAAC,IAAA,wDAA2B,GAAE,CAAC;CAClD,CAAC,CAAC"}
|
package/dist/profiles/index.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import type { Logger } from '../logger';
|
|
2
|
-
export declare const
|
|
2
|
+
export declare const init: (logger: Logger) => Promise<void>;
|
package/dist/profiles/index.js
CHANGED
|
@@ -3,19 +3,20 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.
|
|
6
|
+
exports.init = void 0;
|
|
7
7
|
const nodejs_1 = __importDefault(require("@pyroscope/nodejs"));
|
|
8
8
|
const config_1 = require("./config");
|
|
9
|
-
const
|
|
9
|
+
const init = async (logger) => {
|
|
10
10
|
logger = logger.child('pyroscope');
|
|
11
11
|
if (!config_1.config.enabled) {
|
|
12
12
|
logger.info('Pyroscope is disabled. Set CF_TELEMETRY_PYROSCOPE_ENABLE=true to enable it');
|
|
13
13
|
return;
|
|
14
14
|
}
|
|
15
|
-
logger.info('Initializing Pyroscope'
|
|
15
|
+
logger.info('Initializing Pyroscope');
|
|
16
|
+
logger.debug('Pyroscope configuration', config_1.config);
|
|
16
17
|
nodejs_1.default.init(config_1.config.config);
|
|
17
18
|
nodejs_1.default.start();
|
|
18
19
|
logger.info('Pyroscope initialized');
|
|
19
20
|
};
|
|
20
|
-
exports.
|
|
21
|
+
exports.init = init;
|
|
21
22
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/profiles/index.ts"],"names":[],"mappings":";;;;;;AAAA,+DAA0C;AAE1C,qCAAkC;AAE3B,MAAM,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/profiles/index.ts"],"names":[],"mappings":";;;;;;AAAA,+DAA0C;AAE1C,qCAAkC;AAE3B,MAAM,IAAI,GAAG,KAAK,EAAE,MAAc,EAAiB,EAAE;IAC1D,MAAM,GAAG,MAAM,CAAC,KAAK,CAAC,WAAW,CAAC,CAAC;IACnC,IAAI,CAAC,eAAM,CAAC,OAAO,EAAE,CAAC;QACpB,MAAM,CAAC,IAAI,CAAC,4EAA4E,CAAC,CAAC;QAC1F,OAAO;IACT,CAAC;IAED,MAAM,CAAC,IAAI,CAAC,wBAAwB,CAAC,CAAC;IACtC,MAAM,CAAC,KAAK,CAAC,yBAAyB,EAAE,eAAM,CAAC,CAAC;IAChD,gBAAS,CAAC,IAAI,CAAC,eAAM,CAAC,MAAM,CAAC,CAAC;IAC9B,gBAAS,CAAC,KAAK,EAAE,CAAC;IAClB,MAAM,CAAC,IAAI,CAAC,uBAAuB,CAAC,CAAC;AACvC,CAAC,CAAC;AAZW,QAAA,IAAI,QAYf"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@codefresh-io/cf-telemetry",
|
|
3
|
-
"version": "2.0.0-alpha.
|
|
3
|
+
"version": "2.0.0-alpha.3",
|
|
4
4
|
"main": "dist/index.js",
|
|
5
5
|
"files": [
|
|
6
6
|
"dist/**/*"
|
|
@@ -28,7 +28,6 @@
|
|
|
28
28
|
"@types/node": "^22.12.0",
|
|
29
29
|
"eslint": "^9.19.0",
|
|
30
30
|
"mongodb": "^6.13.0",
|
|
31
|
-
"pino-pretty": "^13.0.0",
|
|
32
31
|
"rimraf": "^6.0.1",
|
|
33
32
|
"typescript": "^5.7.3",
|
|
34
33
|
"typescript-eslint": "^8.22.0",
|
|
@@ -36,9 +35,16 @@
|
|
|
36
35
|
},
|
|
37
36
|
"dependencies": {
|
|
38
37
|
"@christiangalsterer/mongodb-driver-prometheus-exporter": "^2.3.0",
|
|
38
|
+
"@opentelemetry/api": "^1.9.0",
|
|
39
|
+
"@opentelemetry/auto-instrumentations-node": "^0.56.0",
|
|
40
|
+
"@opentelemetry/baggage-span-processor": "^0.3.1",
|
|
41
|
+
"@opentelemetry/sdk-metrics": "^1.30.1",
|
|
42
|
+
"@opentelemetry/sdk-node": "^0.57.2",
|
|
43
|
+
"@opentelemetry/sdk-trace-node": "^1.30.1",
|
|
39
44
|
"@pyroscope/nodejs": "^0.4.3",
|
|
40
45
|
"fastify": "^5.2.1",
|
|
41
46
|
"pino": "^9.6.0",
|
|
47
|
+
"pino-pretty": "^13.0.0",
|
|
42
48
|
"prom-client": "^15.1.3"
|
|
43
49
|
}
|
|
44
50
|
}
|