@codefresh-io/cf-telemetry 4.5.0 → 4.5.1
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/init.js +2 -0
- package/dist/init.js.map +1 -1
- package/dist/otel/internal-api.d.ts +1 -0
- package/dist/otel/internal-api.js +24 -0
- package/dist/otel/internal-api.js.map +1 -1
- package/dist/otel/sdk/init.js +0 -2
- package/dist/otel/sdk/init.js.map +1 -1
- package/dist/{otel/sdk/track-unhandled-errors.d.ts → track-unhandled-errors.d.ts} +1 -1
- package/dist/track-unhandled-errors.js +26 -0
- package/dist/track-unhandled-errors.js.map +1 -0
- package/package.json +1 -1
- package/dist/otel/sdk/track-unhandled-errors.js +0 -26
- package/dist/otel/sdk/track-unhandled-errors.js.map +0 -1
package/dist/init.js
CHANGED
|
@@ -41,6 +41,7 @@ const global_config_1 = require("./global-config");
|
|
|
41
41
|
const logs = __importStar(require("./logs"));
|
|
42
42
|
const prometheus = __importStar(require("./metrics/prometheus"));
|
|
43
43
|
const profiles = __importStar(require("./profiles"));
|
|
44
|
+
const track_unhandled_errors_js_1 = require("./track-unhandled-errors.js");
|
|
44
45
|
let isInitialized = false;
|
|
45
46
|
/**
|
|
46
47
|
* Initializes telemetry services.
|
|
@@ -53,6 +54,7 @@ const init = () => {
|
|
|
53
54
|
const logger = new logs.Logger(global_config_1.globalConfig.libLogScope);
|
|
54
55
|
logger.info('Initializing telemetry services');
|
|
55
56
|
logger.debug('Telemetry configuration', global_config_1.globalConfig);
|
|
57
|
+
(0, track_unhandled_errors_js_1.trackUnhandledErrors)(logger);
|
|
56
58
|
logs.init(logger);
|
|
57
59
|
otel.init(logger);
|
|
58
60
|
profiles.init(logger);
|
package/dist/init.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"init.js","sourceRoot":"","sources":["../src/init.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,6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AuB,EAAiB,EAAE;IACxE,IAAI,CAAC;QACH,MAAM,MAAM,GAAG,IAAI,IAAI,CAAC,MAAM,CAAC,4BAAY,CAAC,WAAW,CAAC,CAAC;QACzD,IAAI,MAAM;YAAE,MAAM,CAAC,IAAI,CAAC,oBAAoB,MAAM,EAAE,CAAC,CAAC;QACtD,MAAM,CAAC,IAAI,CAAC,gCAAgC,CAAC,CAAC;QAC9C,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC;QACvB,MAAM,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;QACjD,MAAM,QAAQ,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;QACrD,aAAa,GAAG,KAAK,CAAC;QACtB,MAAM,CAAC,IAAI,CAAC,+BAA+B,CAAC,CAAC;IAC/C,CAAC;IAAC,OAAO,SAAS,EAAE,CAAC;QACnB,OAAO,CAAC,KAAK,CAAC,wCAAwC,EAAE,SAAS,CAAC,CAAC;IACrE,CAAC;AACH,CAAC,CAAC;AAbW,QAAA,SAAS,aAapB;AAEF,OAAO,CAAC,IAAI,CAAC,YAAY,EAAE,iBAAS,CAAC,CAAC;AAEtC,IAAA,YAAI,GAAE,CAAC"}
|
|
@@ -11,9 +11,33 @@ var __createBinding = (this && this.__createBinding) || (Object.create ? (functi
|
|
|
11
11
|
if (k2 === undefined) k2 = k;
|
|
12
12
|
o[k2] = m[k];
|
|
13
13
|
}));
|
|
14
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
15
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
16
|
+
}) : function(o, v) {
|
|
17
|
+
o["default"] = v;
|
|
18
|
+
});
|
|
14
19
|
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
15
20
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
16
21
|
};
|
|
22
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
23
|
+
var ownKeys = function(o) {
|
|
24
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
25
|
+
var ar = [];
|
|
26
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
27
|
+
return ar;
|
|
28
|
+
};
|
|
29
|
+
return ownKeys(o);
|
|
30
|
+
};
|
|
31
|
+
return function (mod) {
|
|
32
|
+
if (mod && mod.__esModule) return mod;
|
|
33
|
+
var result = {};
|
|
34
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
35
|
+
__setModuleDefault(result, mod);
|
|
36
|
+
return result;
|
|
37
|
+
};
|
|
38
|
+
})();
|
|
17
39
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
40
|
+
exports.cf = void 0;
|
|
18
41
|
__exportStar(require("./sdk/init.js"), exports);
|
|
42
|
+
exports.cf = __importStar(require("./cf/index.js"));
|
|
19
43
|
//# sourceMappingURL=internal-api.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"internal-api.js","sourceRoot":"","sources":["../../src/otel/internal-api.ts"],"names":[],"mappings":";AAAA,eAAe
|
|
1
|
+
{"version":3,"file":"internal-api.js","sourceRoot":"","sources":["../../src/otel/internal-api.ts"],"names":[],"mappings":";AAAA,eAAe;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEf,gDAA8B;AAC9B,oDAAoC"}
|
package/dist/otel/sdk/init.js
CHANGED
|
@@ -3,7 +3,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.terminate = exports.init = void 0;
|
|
4
4
|
const config_1 = require("../config");
|
|
5
5
|
const sdk_1 = require("./sdk");
|
|
6
|
-
const track_unhandled_errors_1 = require("./track-unhandled-errors");
|
|
7
6
|
const init = (logger) => {
|
|
8
7
|
logger = logger.child('otel');
|
|
9
8
|
try {
|
|
@@ -14,7 +13,6 @@ const init = (logger) => {
|
|
|
14
13
|
logger.info('Initializing OpenTelemetry');
|
|
15
14
|
logger.debug('OpenTelemetry configuration', config_1.config);
|
|
16
15
|
sdk_1.sdk.start();
|
|
17
|
-
(0, track_unhandled_errors_1.trackUnhandledErrors)(logger);
|
|
18
16
|
logger.info('OpenTelemetry initialized');
|
|
19
17
|
}
|
|
20
18
|
catch (exception) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"init.js","sourceRoot":"","sources":["../../../src/otel/sdk/init.ts"],"names":[],"mappings":";;;AACA,sCAAmC;AACnC,+BAA4B;
|
|
1
|
+
{"version":3,"file":"init.js","sourceRoot":"","sources":["../../../src/otel/sdk/init.ts"],"names":[],"mappings":";;;AACA,sCAAmC;AACnC,+BAA4B;AAErB,MAAM,IAAI,GAAG,CAAC,MAAc,EAAQ,EAAE;IAC3C,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"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import type { Logger } from '
|
|
1
|
+
import type { Logger } from './logs/index.js';
|
|
2
2
|
export declare const trackUnhandledErrors: (logger: Logger) => void;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.trackUnhandledErrors = void 0;
|
|
4
|
+
const api_1 = require("@opentelemetry/api");
|
|
5
|
+
const internal_api_js_1 = require("./otel/internal-api.js");
|
|
6
|
+
const trackUnhandledErrors = (logger) => {
|
|
7
|
+
logger = logger.child('unhandled-errors');
|
|
8
|
+
logger.info('Setting up unhandled errors tracking');
|
|
9
|
+
const unhandledErrorsTotal = internal_api_js_1.cf.getMeter().createCounter('codefresh.unhandled_errors', {
|
|
10
|
+
description: 'Number of unhandled errors',
|
|
11
|
+
unit: '{unhandled_error}',
|
|
12
|
+
valueType: api_1.ValueType.INT,
|
|
13
|
+
});
|
|
14
|
+
unhandledErrorsTotal.add(0, { [internal_api_js_1.cf.Attribute.UnhandledErrorType]: 'uncaughtException' }); // Initialize metric with 0 value
|
|
15
|
+
unhandledErrorsTotal.add(0, { [internal_api_js_1.cf.Attribute.UnhandledErrorType]: 'unhandledRejection' }); // Initialize metric with 0 value
|
|
16
|
+
process.on('uncaughtException', (err) => {
|
|
17
|
+
unhandledErrorsTotal.add(1, { [internal_api_js_1.cf.Attribute.UnhandledErrorType]: 'uncaughtException' });
|
|
18
|
+
logger.error(`Uncaught Exception`, { [internal_api_js_1.cf.Attribute.UnhandledErrorType]: 'uncaughtException', err });
|
|
19
|
+
});
|
|
20
|
+
process.on('unhandledRejection', (err) => {
|
|
21
|
+
unhandledErrorsTotal.add(1, { [internal_api_js_1.cf.Attribute.UnhandledErrorType]: 'unhandledRejection' });
|
|
22
|
+
logger.error(`Unhandled Promise Rejection`, { [internal_api_js_1.cf.Attribute.UnhandledErrorType]: 'unhandledRejection', err });
|
|
23
|
+
});
|
|
24
|
+
};
|
|
25
|
+
exports.trackUnhandledErrors = trackUnhandledErrors;
|
|
26
|
+
//# sourceMappingURL=track-unhandled-errors.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"track-unhandled-errors.js","sourceRoot":"","sources":["../src/track-unhandled-errors.ts"],"names":[],"mappings":";;;AAAA,4CAA+C;AAE/C,4DAAsD;AAE/C,MAAM,oBAAoB,GAAG,CAAC,MAAc,EAAQ,EAAE;IAC3D,MAAM,GAAG,MAAM,CAAC,KAAK,CAAC,kBAAkB,CAAC,CAAC;IAC1C,MAAM,CAAC,IAAI,CAAC,sCAAsC,CAAC,CAAC;IAEpD,MAAM,oBAAoB,GAAG,oBAAM,CAAC,QAAQ,EAAE,CAAC,aAAa,CAC1D,4BAA4B,EAC5B;QACE,WAAW,EAAE,4BAA4B;QACzC,IAAI,EAAE,mBAAmB;QACzB,SAAS,EAAE,eAAS,CAAC,GAAG;KACzB,CACF,CAAC;IACF,oBAAoB,CAAC,GAAG,CAAC,CAAC,EAAE,EAAE,CAAC,oBAAM,CAAC,SAAS,CAAC,kBAAkB,CAAC,EAAE,mBAAmB,EAAE,CAAC,CAAC,CAAC,iCAAiC;IAC9H,oBAAoB,CAAC,GAAG,CAAC,CAAC,EAAE,EAAE,CAAC,oBAAM,CAAC,SAAS,CAAC,kBAAkB,CAAC,EAAE,oBAAoB,EAAE,CAAC,CAAC,CAAC,iCAAiC;IAE/H,OAAO,CAAC,EAAE,CAAC,mBAAmB,EAAE,CAAC,GAAG,EAAE,EAAE;QACtC,oBAAoB,CAAC,GAAG,CAAC,CAAC,EAAE,EAAE,CAAC,oBAAM,CAAC,SAAS,CAAC,kBAAkB,CAAC,EAAE,mBAAmB,EAAE,CAAC,CAAC;QAC5F,MAAM,CAAC,KAAK,CAAC,oBAAoB,EAAE,EAAE,CAAC,oBAAM,CAAC,SAAS,CAAC,kBAAkB,CAAC,EAAE,mBAAmB,EAAE,GAAG,EAAE,CAAC,CAAC;IAC1G,CAAC,CAAC,CAAC;IAEH,OAAO,CAAC,EAAE,CAAC,oBAAoB,EAAE,CAAC,GAAG,EAAE,EAAE;QACvC,oBAAoB,CAAC,GAAG,CAAC,CAAC,EAAE,EAAE,CAAC,oBAAM,CAAC,SAAS,CAAC,kBAAkB,CAAC,EAAE,oBAAoB,EAAE,CAAC,CAAC;QAC7F,MAAM,CAAC,KAAK,CAAC,6BAA6B,EAAE,EAAE,CAAC,oBAAM,CAAC,SAAS,CAAC,kBAAkB,CAAC,EAAE,oBAAoB,EAAE,GAAG,EAAE,CAAC,CAAC;IACpH,CAAC,CAAC,CAAC;AACL,CAAC,CAAC;AAxBW,QAAA,oBAAoB,wBAwB/B"}
|
package/package.json
CHANGED
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.trackUnhandledErrors = void 0;
|
|
4
|
-
const api_1 = require("@opentelemetry/api");
|
|
5
|
-
const cf_1 = require("../cf");
|
|
6
|
-
const trackUnhandledErrors = (logger) => {
|
|
7
|
-
logger = logger.child('unhandled-errors');
|
|
8
|
-
logger.info('Setting up unhandled errors tracking');
|
|
9
|
-
const unhandledErrorsTotal = (0, cf_1.getMeter)().createCounter('codefresh.unhandled_errors', {
|
|
10
|
-
description: 'Number of unhandled errors',
|
|
11
|
-
unit: '{unhandled_error}',
|
|
12
|
-
valueType: api_1.ValueType.INT,
|
|
13
|
-
});
|
|
14
|
-
unhandledErrorsTotal.add(0, { [cf_1.Attribute.UnhandledErrorType]: 'uncaughtException' }); // Initialize metric with 0 value
|
|
15
|
-
unhandledErrorsTotal.add(0, { [cf_1.Attribute.UnhandledErrorType]: 'unhandledRejection' }); // Initialize metric with 0 value
|
|
16
|
-
process.on('uncaughtException', (err) => {
|
|
17
|
-
unhandledErrorsTotal.add(1, { [cf_1.Attribute.UnhandledErrorType]: 'uncaughtException' });
|
|
18
|
-
logger.error(`Uncaught Exception`, { [cf_1.Attribute.UnhandledErrorType]: 'uncaughtException', err });
|
|
19
|
-
});
|
|
20
|
-
process.on('unhandledRejection', (err) => {
|
|
21
|
-
unhandledErrorsTotal.add(1, { [cf_1.Attribute.UnhandledErrorType]: 'unhandledRejection' });
|
|
22
|
-
logger.error(`Unhandled Promise Rejection`, { [cf_1.Attribute.UnhandledErrorType]: 'unhandledRejection', err });
|
|
23
|
-
});
|
|
24
|
-
};
|
|
25
|
-
exports.trackUnhandledErrors = trackUnhandledErrors;
|
|
26
|
-
//# sourceMappingURL=track-unhandled-errors.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"track-unhandled-errors.js","sourceRoot":"","sources":["../../../src/otel/sdk/track-unhandled-errors.ts"],"names":[],"mappings":";;;AAAA,4CAA+C;AAE/C,8BAA4C;AAErC,MAAM,oBAAoB,GAAG,CAAC,MAAc,EAAQ,EAAE;IAC3D,MAAM,GAAG,MAAM,CAAC,KAAK,CAAC,kBAAkB,CAAC,CAAC;IAC1C,MAAM,CAAC,IAAI,CAAC,sCAAsC,CAAC,CAAC;IAEpD,MAAM,oBAAoB,GAAG,IAAA,aAAQ,GAAE,CAAC,aAAa,CACnD,4BAA4B,EAC5B;QACE,WAAW,EAAE,4BAA4B;QACzC,IAAI,EAAE,mBAAmB;QACzB,SAAS,EAAE,eAAS,CAAC,GAAG;KACzB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