@codefresh-io/cf-telemetry 2.0.0-alpha.20 → 2.0.0-alpha.22
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 +2 -2
- package/dist/index.js +2 -7
- package/dist/index.js.map +1 -1
- package/dist/otel/{index.js → init.js} +9 -9
- package/dist/otel/init.js.map +1 -0
- package/dist/public.d.mts +1 -0
- package/dist/public.d.ts +1 -0
- package/dist/public.js +19 -0
- package/dist/public.js.map +1 -0
- package/dist/public.mjs +3 -0
- package/dist/public.mjs.map +1 -0
- package/package.json +6 -4
- package/dist/index.d.mts +0 -1
- package/dist/index.mjs +0 -2
- package/dist/index.mjs.map +0 -1
- package/dist/init.mjs +0 -5
- package/dist/init.mjs.map +0 -1
- package/dist/otel/index.d.ts +0 -3
- package/dist/otel/index.js.map +0 -1
- /package/dist/{init.d.mts → otel/init.d.ts} +0 -0
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Initializes telemetry services. Should be called once as early as possible in the application lifecycle.
|
|
3
|
-
*
|
|
4
|
-
*
|
|
3
|
+
* Initializaton of OpenTelemetry autoinstrumentation should be done separately
|
|
4
|
+
* by adding --require=@codefresh-io/cf-telemetry/otel/init to the node command.
|
|
5
5
|
*/
|
|
6
6
|
export declare const init: () => Promise<void>;
|
|
7
7
|
export declare const terminate: () => Promise<void>;
|
package/dist/index.js
CHANGED
|
@@ -34,24 +34,20 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
34
34
|
})();
|
|
35
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
36
|
exports.terminate = exports.init = void 0;
|
|
37
|
-
// ↓ Should be imported first
|
|
38
|
-
const otel = __importStar(require("./otel"));
|
|
39
|
-
// ↑ Should be imported first
|
|
40
37
|
const logs = __importStar(require("./logs"));
|
|
41
38
|
const prometheus = __importStar(require("./metrics/prometheus"));
|
|
42
39
|
const profiles = __importStar(require("./profiles"));
|
|
43
40
|
let isInitialized = false;
|
|
44
41
|
/**
|
|
45
42
|
* Initializes telemetry services. Should be called once as early as possible in the application lifecycle.
|
|
46
|
-
*
|
|
47
|
-
*
|
|
43
|
+
* Initializaton of OpenTelemetry autoinstrumentation should be done separately
|
|
44
|
+
* by adding --require=@codefresh-io/cf-telemetry/otel/init to the node command.
|
|
48
45
|
*/
|
|
49
46
|
const init = async () => {
|
|
50
47
|
if (isInitialized)
|
|
51
48
|
return;
|
|
52
49
|
const logger = new logs.Logger('telemetry');
|
|
53
50
|
logger.info('Initializing telemetry services');
|
|
54
|
-
await otel.init(logger).catch(logger.error);
|
|
55
51
|
await Promise.all([
|
|
56
52
|
prometheus.init(logger).catch(logger.error),
|
|
57
53
|
profiles.init(logger).catch(logger.error),
|
|
@@ -64,7 +60,6 @@ const terminate = async () => {
|
|
|
64
60
|
const logger = new logs.Logger('telemetry');
|
|
65
61
|
try {
|
|
66
62
|
logger.info('Terminating telemetry services');
|
|
67
|
-
await otel.terminate(logger).catch(logger.error);
|
|
68
63
|
isInitialized = false;
|
|
69
64
|
logger.info('Telemetry services terminated');
|
|
70
65
|
}
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,6CAA+B;AAC/B,iEAAmD;AACnD,qDAAuC;AAEvC,IAAI,aAAa,GAAG,KAAK,CAAC;AAE1B;;;;GAIG;AACI,MAAM,IAAI,GAAG,KAAK,IAAmB,EAAE;IAC5C,IAAI,aAAa;QAAE,OAAO;IAE1B,MAAM,MAAM,GAAG,IAAI,IAAI,CAAC,MAAM,CAAC,WAAW,CAAC,CAAC;IAC5C,MAAM,CAAC,IAAI,CAAC,iCAAiC,CAAC,CAAC;IAC/C,MAAM,OAAO,CAAC,GAAG,CAAC;QAChB,UAAU,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC;QAC3C,QAAQ,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC;KAC1C,CAAC,CAAC;IACH,aAAa,GAAG,IAAI,CAAC;IACrB,MAAM,CAAC,IAAI,CAAC,gCAAgC,CAAC,CAAC;AAChD,CAAC,CAAC;AAXW,QAAA,IAAI,QAWf;AAEK,MAAM,SAAS,GAAG,KAAK,IAAmB,EAAE;IACjD,MAAM,MAAM,GAAG,IAAI,IAAI,CAAC,MAAM,CAAC,WAAW,CAAC,CAAC;IAC5C,IAAI,CAAC;QACH,MAAM,CAAC,IAAI,CAAC,gCAAgC,CAAC,CAAC;QAC9C,aAAa,GAAG,KAAK,CAAC;QACtB,MAAM,CAAC,IAAI,CAAC,+BAA+B,CAAC,CAAC;IAC/C,CAAC;IAAC,OAAO,SAAS,EAAE,CAAC;QACnB,MAAM,CAAC,KAAK,CAAC,wCAAwC,EAAE,SAAS,CAAC,CAAC;IACpE,CAAC;AACH,CAAC,CAAC;AATW,QAAA,SAAS,aASpB"}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.terminate = exports.init = void 0;
|
|
4
|
-
const config_1 = require("./config");
|
|
5
3
|
const sdk_1 = require("./sdk");
|
|
6
|
-
const
|
|
7
|
-
|
|
4
|
+
const logs_1 = require("../logs");
|
|
5
|
+
const config_1 = require("./config");
|
|
6
|
+
const logger = new logs_1.Logger('telemetry:otel');
|
|
7
|
+
const init = () => {
|
|
8
8
|
try {
|
|
9
9
|
if (!config_1.config.enabled) {
|
|
10
10
|
logger.info('OpenTelemetry is disabled. Set CF_TELEMETRY_OTEL_ENABLE=true to enable it');
|
|
@@ -19,9 +19,7 @@ const init = async (logger) => {
|
|
|
19
19
|
logger.error('Failed to initialize OpenTelemetry', exception);
|
|
20
20
|
}
|
|
21
21
|
};
|
|
22
|
-
|
|
23
|
-
const terminate = async (logger) => {
|
|
24
|
-
logger = logger.child('otel');
|
|
22
|
+
const terminate = async () => {
|
|
25
23
|
try {
|
|
26
24
|
logger.info('Terminating OpenTelemetry');
|
|
27
25
|
await sdk_1.sdk.shutdown();
|
|
@@ -31,5 +29,7 @@ const terminate = async (logger) => {
|
|
|
31
29
|
logger.error('Failed to terminate OpenTelemetry', exception);
|
|
32
30
|
}
|
|
33
31
|
};
|
|
34
|
-
|
|
35
|
-
|
|
32
|
+
init();
|
|
33
|
+
process.on('SIGTERM', terminate);
|
|
34
|
+
process.once('beforeExit', terminate);
|
|
35
|
+
//# sourceMappingURL=init.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"init.js","sourceRoot":"","sources":["../../src/otel/init.ts"],"names":[],"mappings":";;AAAA,+BAA4B;AAE5B,kCAAiC;AACjC,qCAAkC;AAElC,MAAM,MAAM,GAAG,IAAI,aAAM,CAAC,gBAAgB,CAAC,CAAC;AAE5C,MAAM,IAAI,GAAG,GAAS,EAAE;IACtB,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;AAEF,MAAM,SAAS,GAAG,KAAK,IAAmB,EAAE;IAC1C,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;AAEF,IAAI,EAAE,CAAC;AAEP,OAAO,CAAC,EAAE,CAAC,SAAS,EAAE,SAAS,CAAC,CAAC;AACjC,OAAO,CAAC,IAAI,CAAC,YAAY,EAAE,SAAS,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './public.js';
|
package/dist/public.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './index';
|
package/dist/public.js
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// Public API (CommonJS)
|
|
3
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
4
|
+
if (k2 === undefined) k2 = k;
|
|
5
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
6
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
7
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
8
|
+
}
|
|
9
|
+
Object.defineProperty(o, k2, desc);
|
|
10
|
+
}) : (function(o, m, k, k2) {
|
|
11
|
+
if (k2 === undefined) k2 = k;
|
|
12
|
+
o[k2] = m[k];
|
|
13
|
+
}));
|
|
14
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
15
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
16
|
+
};
|
|
17
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
+
__exportStar(require("./index"), exports);
|
|
19
|
+
//# sourceMappingURL=public.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"public.js","sourceRoot":"","sources":["../src/public.ts"],"names":[],"mappings":";AAAA,wBAAwB;;;;;;;;;;;;;;;;AAExB,0CAAwB"}
|
package/dist/public.mjs
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"public.mjs","sourceRoot":"","sources":["../src/public.mts"],"names":[],"mappings":"AAAA,mBAAmB;AAEnB,cAAc,aAAa,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@codefresh-io/cf-telemetry",
|
|
3
|
-
"version": "2.0.0-alpha.
|
|
3
|
+
"version": "2.0.0-alpha.22",
|
|
4
4
|
"exports": {
|
|
5
|
-
"./init": "./dist/init.mjs",
|
|
6
5
|
".": {
|
|
7
|
-
"import": "./dist/
|
|
8
|
-
"require": "./dist/
|
|
6
|
+
"import": "./dist/public.mjs",
|
|
7
|
+
"require": "./dist/public.js"
|
|
9
8
|
},
|
|
10
9
|
"./logs": {
|
|
11
10
|
"import": "./dist/logs/public.mjs",
|
|
@@ -30,6 +29,9 @@
|
|
|
30
29
|
"./otel": {
|
|
31
30
|
"import": "./dist/otel/public.mjs",
|
|
32
31
|
"require": "./dist/otel/public.js"
|
|
32
|
+
},
|
|
33
|
+
"./otel/init": {
|
|
34
|
+
"require": "./dist/otel/init.js"
|
|
33
35
|
}
|
|
34
36
|
},
|
|
35
37
|
"files": [
|
package/dist/index.d.mts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './index.js';
|
package/dist/index.mjs
DELETED
package/dist/index.mjs.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","sourceRoot":"","sources":["../src/index.mts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAC"}
|
package/dist/init.mjs
DELETED
package/dist/init.mjs.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"init.mjs","sourceRoot":"","sources":["../src/init.mts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,YAAY,CAAC;AAElC,6DAA6D;AAC7D,aAAa;AACb,MAAM,IAAI,EAAE,CAAC"}
|
package/dist/otel/index.d.ts
DELETED
package/dist/otel/index.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/otel/index.ts"],"names":[],"mappings":";;;AACA,qCAAkC;AAClC,+BAA4B;AAErB,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"}
|
|
File without changes
|