@codefresh-io/cf-telemetry 3.0.1-alpha.1 → 3.1.0

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.d.ts CHANGED
@@ -3,4 +3,4 @@
3
3
  * Should be called once as early as possible in the application lifecycle.
4
4
  */
5
5
  export declare const init: () => void;
6
- export declare const terminate: NodeJS.SignalsListener;
6
+ export declare const terminate: () => Promise<void>;
package/dist/init.js CHANGED
@@ -53,7 +53,6 @@ const init = () => {
53
53
  const logger = new logs.Logger(global_config_1.globalConfig.libLogScope);
54
54
  logger.info('Initializing telemetry services');
55
55
  logger.debug('Telemetry configuration', global_config_1.globalConfig);
56
- logs.init(logger);
57
56
  otel.init(logger);
58
57
  profiles.init(logger);
59
58
  prometheus.init(logger).catch(logger.error);
@@ -65,20 +64,17 @@ const init = () => {
65
64
  }
66
65
  };
67
66
  exports.init = init;
68
- const terminate = async (signal) => {
67
+ const terminate = async () => {
68
+ const logger = new logs.Logger(global_config_1.globalConfig.libLogScope);
69
69
  try {
70
- const logger = new logs.Logger(global_config_1.globalConfig.libLogScope);
71
- if (signal)
72
- logger.info(`Received signal: ${signal}`);
73
70
  logger.info('Terminating telemetry services');
74
- logs.terminate(logger);
75
71
  await otel.terminate(logger).catch(logger.error);
76
72
  await profiles.terminate(logger).catch(logger.error);
77
73
  isInitialized = false;
78
74
  logger.info('Telemetry services terminated');
79
75
  }
80
76
  catch (exception) {
81
- console.error('Failed to terminate telemetry services', exception);
77
+ logger.error('Failed to terminate telemetry services', exception);
82
78
  }
83
79
  };
84
80
  exports.terminate = terminate;
package/dist/init.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"init.js","sourceRoot":"","sources":["../src/init.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,6BAA6B;AAC7B,6CAA+B;AAC/B,6BAA6B;AAE7B,mDAA+C;AAC/C,6CAA+B;AAC/B,iEAAm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}
28
28
  };
29
+ const getPrettifyTimeFormat = () => {
30
+ return process.env['CF_TELEMETRY_LOGS_PRETTIFY_TIME_FORMAT'] ?? true;
31
+ };
29
32
  exports.config = {
30
33
  level: getLevel(),
31
34
  prettify: getPrettify(),
35
+ prettifyTimeFormat: getPrettifyTimeFormat(),
32
36
  sync: process.env['CF_TELEMETRY_LOGS_SYNC'] === 'true',
33
37
  defaultInitiator: { type: 'system' },
34
38
  };
@@ -1 +1 @@
1
- {"version":3,"file":"config.js","sourceRoot":"","sources":["../../src/logs/config.ts"],"names":[],"mappings":";;;AAAA,mCAAsD;AAEtD,MAAM,QAAQ,GAAG,GAAU,EAAE;IAC3B,MAAM,aAAa,GAAG,OAAO,CAAC,GAAG,CAAC,yBAAyB,CAAC,IAAI,MAAM,CAAC;IACvE,8DAA8D;IAC9D,MAAM,YAAY,GAAG,aAAK,CAAC,QAAQ,CAAC,aAAoB,CAAC,CAAC;IAC1D,IAAI,CAAC,YAAY,EAAE,CAAC;QAClB,OAAO,CAAC,IAAI,CAAC,iDAAiD,aAAa,4CAA4C,aAAK,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;QAC3I,OAAO,MAAM,CAAC;IAChB,CAAC;IAAA,CAAC;IACF,OAAO,aAAsB,CAAC;AAChC,CAAC,CAAC;AAEF,MAAM,WAAW,GAAG,GAAa,EAAE;IACjC,MAAM,QAAQ,GAAG,OAAO,CAAC,GAAG,CAAC,4BAA4B,CAAC,IAAI,OAAO,CAAC;IACtE,QAAQ,QAAQ,EAAE,CAAC;QACjB,KAAK,aAAa,CAAC;QACnB,KAAK,YAAY;YACf,OAAO,QAAQ,CAAC;QAClB,KAAK,OAAO;YACV,OAAO,KAAK,CAAC;QACf;YACE,OAAO,CAAC,IAAI,CAAC,oDAAoD,QAAQ,2CAA2C,gBAAQ,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;YAC3I,OAAO,KAAK,CAAC;IACjB,CAAC;AACH,CAAC,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AO,CAAC,GAAG,CAAC,wCAAwC,CAAC,IAAI,IAAI,CAAC;AACvE,CAAC,CAAC;AAEW,QAAA,MAAM,GAAe;IAChC,KAAK,EAAE,QAAQ,EAAE;IACjB,QAAQ,EAAE,WAAW,EAAE;IACvB,kBAAkB,EAAE,qBAAqB,EAAE;IAC3C,IAAI,EAAE,OAAO,CAAC,GAAG,CAAC,wBAAwB,CAAC,KAAK,MAAM;IACtD,gBAAgB,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE;CAC5B,CAAC"}
@@ -1,4 +1,2 @@
1
- export { init } from './init';
2
1
  export { Logger } from './logger';
3
2
  export { runInContext } from './run-in-context';
4
- export { terminate } from './terminate';
@@ -1,12 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.terminate = exports.runInContext = exports.Logger = exports.init = void 0;
4
- var init_1 = require("./init");
5
- Object.defineProperty(exports, "init", { enumerable: true, get: function () { return init_1.init; } });
3
+ exports.runInContext = exports.Logger = void 0;
6
4
  var logger_1 = require("./logger");
7
5
  Object.defineProperty(exports, "Logger", { enumerable: true, get: function () { return logger_1.Logger; } });
8
6
  var run_in_context_1 = require("./run-in-context");
9
7
  Object.defineProperty(exports, "runInContext", { enumerable: true, get: function () { return run_in_context_1.runInContext; } });
10
- var terminate_1 = require("./terminate");
11
- Object.defineProperty(exports, "terminate", { enumerable: true, get: function () { return terminate_1.terminate; } });
12
8
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/logs/index.ts"],"names":[],"mappings":";;;AAAA,+BAA8B;AAArB,4FAAA,IAAI,OAAA;AACb,mCAAkC;AAAzB,gGAAA,MAAM,OAAA;AACf,mDAAgD;AAAvC,8GAAA,YAAY,OAAA;AACrB,yCAAwC;AAA/B,sGAAA,SAAS,OAAA"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/logs/index.ts"],"names":[],"mappings":";;;AAAA,mCAAkC;AAAzB,gGAAA,MAAM,OAAA;AACf,mDAAgD;AAAvC,8GAAA,YAAY,OAAA"}
@@ -1,5 +1,4 @@
1
1
  import type { Logger as ILogger, LoggerOptions, Scope } from './types';
2
- export declare const pinoDestination: import("sonic-boom").default;
3
2
  export declare class Logger implements ILogger {
4
3
  #private;
5
4
  constructor(options?: Scope | LoggerOptions);
@@ -3,11 +3,10 @@ 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.Logger = exports.pinoDestination = void 0;
6
+ exports.Logger = void 0;
7
7
  const pino_1 = __importDefault(require("pino"));
8
8
  const config_1 = require("./config");
9
9
  const metadata_storage_1 = require("./metadata-storage");
10
- exports.pinoDestination = pino_1.default.destination({ sync: config_1.config.sync });
11
10
  class Logger {
12
11
  #options;
13
12
  #baseLogger;
@@ -31,10 +30,11 @@ class Logger {
31
30
  options: {
32
31
  colorize: true,
33
32
  singleLine: config_1.config.prettify === 'single-line',
33
+ translateTime: config_1.config.prettifyTimeFormat,
34
34
  },
35
35
  },
36
36
  },
37
- }, exports.pinoDestination);
37
+ }, pino_1.default.destination({ sync: config_1.config.sync }));
38
38
  }
39
39
  #getChildScope(childScope) {
40
40
  return this.#options.scope
@@ -1 +1 @@
1
- {"version":3,"file":"logger.js","sourceRoot":"","sources":["../../src/logs/logger.ts"],"names":[],"mappings":";;;;;;AAAA,gDAAwB;AAExB,qCAAkC;AAClC,yDAAqD;AAUxC,QAAA,eAAe,GAAG,cAAI,CAAC,WAAW,CAAC,EAAE,IAAI,EAAE,eAAM,CAAC,IAAI,EAAE,CAAC,CAAC;AAEvE,MAAa,MAAM;IACjB,QAAQ,CAAgB;IACxB,WAAW,CAAc;IACzB,iBAAiB,GAAG,eAAM,CAAC,gBAAgB,CAAC;IAE5C,YAAY,UAAiC,EAAE;QAC7C,IAAI,CAAC,QAAQ,GAAG,OAAO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AC,GAAG,CAAC;oBACvB,wFAAwF;gBACxF,CAAC;qBAAM,IAAI,OAAO,IAAI,IAAI,CAAC,IAAI,EAAE,CAAC;oBAChC,IAAI,CAAC,GAAG,GAAG,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC;oBAC3B,OAAO,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC;gBACzB,CAAC;YACH,CAAC;iBAAM,CAAC;gBACN,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;YACnB,CAAC;QACH,CAAC;QAED,OAAO,IAAI,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC,IAAI,CAAC,CAAC;IACvC,CAAC;IAaD,KAAK,CAAC,GAAG,IAAa;QACpB,IAAI,CAAC,MAAM,CAAC,OAAO,EAAE,GAAG,IAAI,CAAC,CAAC;IAChC,CAAC;IAaD,IAAI,CAAC,GAAG,IAAa;QACnB,IAAI,CAAC,MAAM,CAAC,MAAM,EAAE,GAAG,IAAI,CAAC,CAAC;IAC/B,CAAC;IAED;;OAEG;IACH,GAAG,GAAG,IAAI,CAAC,IAAI,CAAC;IAahB,IAAI,CAAC,GAAG,IAAa;QACnB,IAAI,CAAC,MAAM,CAAC,MAAM,EAAE,GAAG,IAAI,CAAC,CAAC;IAC/B,CAAC;IAaD,KAAK,CAAC,GAAG,IAAa;QACpB,IAAI,CAAC,MAAM,CAAC,OAAO,EAAE,GAAG,IAAI,CAAC,CAAC;IAChC,CAAC;IAED;;;OAGG;IACH,KAAK,CAAC,UAAiC,EAAE;QACvC,OAAO,IAAI,MAAM,CAAC,IAAI,CAAC,gBAAgB,CAAC,IAAI,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC,CAAC;IACnE,CAAC;CACF;AAnKD,wBAmKC"}
@@ -2,10 +2,12 @@ import type { LoggerService } from '@nestjs/common';
2
2
  export declare const Level: readonly ["debug", "info", "warn", "error"];
3
3
  export type Level = (typeof Level[number]);
4
4
  export declare const Prettify: readonly ["single-line", "multi-line", false];
5
+ export type PrettifyTimeFormat = string | true;
5
6
  export type Prettify = (typeof Prettify[number]);
6
7
  export interface LogsConfig {
7
8
  level: Level;
8
9
  prettify: Prettify;
10
+ prettifyTimeFormat: PrettifyTimeFormat;
9
11
  sync: boolean;
10
12
  defaultInitiator: LogMetadata['initiator'];
11
13
  }
@@ -1 +1 @@
1
- {"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/logs/types.ts"],"names":[],"mappings":";;;AAEa,QAAA,KAAK,GAAG,CAAC,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,CAAU,CAAC;AAGpD,QAAA,QAAQ,GAAG,CAAC,aAAa,EAAE,YAAY,EAAE,KAAK,CAAU,CAAC;AAQrE,CAAC;AAoBD,CAAC;AAQD,CAAC;AAWD,CAAC;AAsCD,CAAC"}
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/logs/types.ts"],"names":[],"mappings":";;;AAEa,QAAA,KAAK,GAAG,CAAC,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,CAAU,CAAC;AAGpD,QAAA,QAAQ,GAAG,CAAC,aAAa,EAAE,YAAY,EAAE,KAAK,CAAU,CAAC;AAUrE,CAAC;AAoBD,CAAC;AAQD,CAAC;AAWD,CAAC;AAsCD,CAAC"}
@@ -1,5 +1,5 @@
1
1
  import { Attributes as A, Meter } from '@opentelemetry/api';
2
- type Name<Prefix extends string = 'codefresh'> = Prefix extends '' ? `${string}_info` : `${Prefix}_${string}_info`;
2
+ type Name<Prefix extends string = 'codefresh'> = Prefix extends '' ? `${string}.info` : `${Prefix}.${string}.info`;
3
3
  /**
4
4
  * InfoGauge is a specialized gauge for recording information metrics.
5
5
  * It records a value of 1 for the current state and 0 for the previous state,
@@ -21,7 +21,7 @@ type Name<Prefix extends string = 'codefresh'> = Prefix extends '' ? `${string}_
21
21
  * const meter = otel.cf.getMeter();
22
22
  * const buildInfoGauge = new otel.cf.InfoGauge<ClassicBuildInfo>(
23
23
  * meter,
24
- * 'codefresh_classic_build_info',
24
+ * 'codefresh.classic.build.info',
25
25
  * 'Codefresh classic build info',
26
26
  * ['build_id'],
27
27
  * );
@@ -31,24 +31,24 @@ type Name<Prefix extends string = 'codefresh'> = Prefix extends '' ? `${string}_
31
31
  * build_status: 'running',
32
32
  * });
33
33
  * // Results in the following state:
34
- * // codefresh_classic_build_info{ build_id: '111', build_status: 'running' } = 1
34
+ * // codefresh.classic.build.info{ build_id: '111', build_status: 'running' } = 1
35
35
  *
36
36
  * buildInfoGauge.set({
37
37
  * build_id: '111',
38
38
  * build_status: 'success',
39
39
  * });
40
40
  * // Results in the following state:
41
- * // codefresh_classic_build_info{ build_id: '111', build_status: 'running' } = 0
42
- * // codefresh_classic_build_info{ build_id: '111', build_status: 'success' } = 1
41
+ * // codefresh.classic.build.info{ build_id: '111', build_status: 'running' } = 0
42
+ * // codefresh.classic.build.info{ build_id: '111', build_status: 'success' } = 1
43
43
  *
44
44
  * buildInfoGauge.set({
45
45
  * build_id: '222',
46
46
  * build_status: 'running',
47
47
  * });
48
48
  * // Results in the following state:
49
- * // codefresh_classic_build_info{ build_id: '111', build_status: 'running' } = 0
50
- * // codefresh_classic_build_info{ build_id: '111', build_status: 'success' } = 1
51
- * // codefresh_classic_build_info{ build_id: '222', build_status: 'running' } = 1
49
+ * // codefresh.classic.build.info{ build_id: '111', build_status: 'running' } = 0
50
+ * // codefresh.classic.build.info{ build_id: '111', build_status: 'success' } = 1
51
+ * // codefresh.classic.build.info{ build_id: '222', build_status: 'running' } = 1
52
52
  */
53
53
  export declare class InfoGauge<Attributes extends A, Prefix extends string = 'codefresh'> {
54
54
  #private;
@@ -59,7 +59,7 @@ export declare class InfoGauge<Attributes extends A, Prefix extends string = 'co
59
59
  * @param description the description of the gauge, used for documentation purposes.
60
60
  * @param immutableAttributes an array of attribute keys that should be treated as immutable
61
61
  * and will be used to identify unique series.
62
- * For example, `codefresh_classic_build_info{ build_id, build_status }` will have
62
+ * For example, `codefresh.classic.build.info{ build_id, build_status }` will have
63
63
  * immutable attribute `build_id`: this attribute is immutable and accurately characterizes
64
64
  * a unique series for which the value of `build_status` can change over time.
65
65
  */
@@ -23,7 +23,7 @@ const api_1 = require("@opentelemetry/api");
23
23
  * const meter = otel.cf.getMeter();
24
24
  * const buildInfoGauge = new otel.cf.InfoGauge<ClassicBuildInfo>(
25
25
  * meter,
26
- * 'codefresh_classic_build_info',
26
+ * 'codefresh.classic.build.info',
27
27
  * 'Codefresh classic build info',
28
28
  * ['build_id'],
29
29
  * );
@@ -33,24 +33,24 @@ const api_1 = require("@opentelemetry/api");
33
33
  * build_status: 'running',
34
34
  * });
35
35
  * // Results in the following state:
36
- * // codefresh_classic_build_info{ build_id: '111', build_status: 'running' } = 1
36
+ * // codefresh.classic.build.info{ build_id: '111', build_status: 'running' } = 1
37
37
  *
38
38
  * buildInfoGauge.set({
39
39
  * build_id: '111',
40
40
  * build_status: 'success',
41
41
  * });
42
42
  * // Results in the following state:
43
- * // codefresh_classic_build_info{ build_id: '111', build_status: 'running' } = 0
44
- * // codefresh_classic_build_info{ build_id: '111', build_status: 'success' } = 1
43
+ * // codefresh.classic.build.info{ build_id: '111', build_status: 'running' } = 0
44
+ * // codefresh.classic.build.info{ build_id: '111', build_status: 'success' } = 1
45
45
  *
46
46
  * buildInfoGauge.set({
47
47
  * build_id: '222',
48
48
  * build_status: 'running',
49
49
  * });
50
50
  * // Results in the following state:
51
- * // codefresh_classic_build_info{ build_id: '111', build_status: 'running' } = 0
52
- * // codefresh_classic_build_info{ build_id: '111', build_status: 'success' } = 1
53
- * // codefresh_classic_build_info{ build_id: '222', build_status: 'running' } = 1
51
+ * // codefresh.classic.build.info{ build_id: '111', build_status: 'running' } = 0
52
+ * // codefresh.classic.build.info{ build_id: '111', build_status: 'success' } = 1
53
+ * // codefresh.classic.build.info{ build_id: '222', build_status: 'running' } = 1
54
54
  */
55
55
  class InfoGauge {
56
56
  #gauge;
@@ -63,7 +63,7 @@ class InfoGauge {
63
63
  * @param description the description of the gauge, used for documentation purposes.
64
64
  * @param immutableAttributes an array of attribute keys that should be treated as immutable
65
65
  * and will be used to identify unique series.
66
- * For example, `codefresh_classic_build_info{ build_id, build_status }` will have
66
+ * For example, `codefresh.classic.build.info{ build_id, build_status }` will have
67
67
  * immutable attribute `build_id`: this attribute is immutable and accurately characterizes
68
68
  * a unique series for which the value of `build_status` can change over time.
69
69
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@codefresh-io/cf-telemetry",
3
- "version": "3.0.1-alpha.1",
3
+ "version": "3.1.0",
4
4
  "exports": {
5
5
  "./init": {
6
6
  "import": "./dist/init.mjs",
@@ -1,2 +0,0 @@
1
- import type { Logger } from './types';
2
- export declare const init: (logger: Logger) => void;
package/dist/logs/init.js DELETED
@@ -1,11 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.init = void 0;
4
- const config_1 = require("./config");
5
- const init = (logger) => {
6
- logger = logger.child('logs');
7
- logger.info('Initializing logs');
8
- logger.debug('Logs configuration', config_1.config);
9
- };
10
- exports.init = init;
11
- //# sourceMappingURL=init.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"init.js","sourceRoot":"","sources":["../../src/logs/init.ts"],"names":[],"mappings":";;;AAAA,qCAAkC;AAG3B,MAAM,IAAI,GAAG,CAAC,MAAc,EAAQ,EAAE;IAC3C,MAAM,GAAG,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;IAC9B,MAAM,CAAC,IAAI,CAAC,mBAAmB,CAAC,CAAC;IACjC,MAAM,CAAC,KAAK,CAAC,oBAAoB,EAAE,eAAM,CAAC,CAAC;AAC7C,CAAC,CAAC;AAJW,QAAA,IAAI,QAIf"}
@@ -1,2 +0,0 @@
1
- import type { Logger } from './types';
2
- export declare const terminate: (logger: Logger) => void;
@@ -1,11 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.terminate = void 0;
4
- const logger_1 = require("./logger");
5
- const terminate = (logger) => {
6
- logger = logger.child('logs');
7
- logger.info('Flushing logs');
8
- logger_1.pinoDestination.flushSync();
9
- };
10
- exports.terminate = terminate;
11
- //# sourceMappingURL=terminate.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"terminate.js","sourceRoot":"","sources":["../../src/logs/terminate.ts"],"names":[],"mappings":";;;AAAA,qCAA2C;AAGpC,MAAM,SAAS,GAAG,CAAC,MAAc,EAAQ,EAAE;IAChD,MAAM,GAAG,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;IAC9B,MAAM,CAAC,IAAI,CAAC,eAAe,CAAC,CAAC;IAC7B,wBAAe,CAAC,SAAS,EAAE,CAAC;AAC9B,CAAC,CAAC;AAJW,QAAA,SAAS,aAIpB"}