@codefresh-io/cf-telemetry 2.0.0-alpha.25 → 2.0.0-alpha.26

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.
@@ -0,0 +1,8 @@
1
+ export interface ExemplarLabels {
2
+ spanId?: string;
3
+ traceId?: string;
4
+ }
5
+ /**
6
+ * Get exemplar labels for Prometheus metrics with enabled exemplars.
7
+ */
8
+ export declare const getExemplarLabels: () => ExemplarLabels;
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getExemplarLabels = void 0;
4
+ const sdk_node_1 = require("@opentelemetry/sdk-node");
5
+ /**
6
+ * Get exemplar labels for Prometheus metrics with enabled exemplars.
7
+ */
8
+ const getExemplarLabels = () => {
9
+ const { spanId, traceId } = sdk_node_1.api.trace.getActiveSpan()?.spanContext() ?? {};
10
+ return { spanId, traceId };
11
+ };
12
+ exports.getExemplarLabels = getExemplarLabels;
13
+ //# sourceMappingURL=helpers.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"helpers.js","sourceRoot":"","sources":["../../../src/metrics/prometheus/helpers.ts"],"names":[],"mappings":";;;AAAA,sDAA8C;AAO9C;;GAEG;AACI,MAAM,iBAAiB,GAAG,GAAmB,EAAE;IACpD,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,GAAG,cAAG,CAAC,KAAK,CAAC,aAAa,EAAE,EAAE,WAAW,EAAE,IAAI,EAAE,CAAC;IAC3E,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC;AAC7B,CAAC,CAAC;AAHW,QAAA,iBAAiB,qBAG5B"}
@@ -2,3 +2,4 @@ export * from 'prom-client';
2
2
  export { register } from './client';
3
3
  export { Counter, Gauge, Histogram, Summary, } from './metrics';
4
4
  export type { CounterConfiguration, GaugeConfiguration, HistogramConfiguration, MetricConfiguration, Metric, SummaryConfiguration, } from './metrics';
5
+ export * as helpers from './helpers';
@@ -11,11 +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 });
18
- exports.Summary = exports.Histogram = exports.Gauge = exports.Counter = exports.register = void 0;
40
+ exports.helpers = exports.Summary = exports.Histogram = exports.Gauge = exports.Counter = exports.register = void 0;
19
41
  __exportStar(require("prom-client"), exports);
20
42
  var client_1 = require("./client");
21
43
  Object.defineProperty(exports, "register", { enumerable: true, get: function () { return client_1.register; } });
@@ -24,4 +46,5 @@ Object.defineProperty(exports, "Counter", { enumerable: true, get: function () {
24
46
  Object.defineProperty(exports, "Gauge", { enumerable: true, get: function () { return metrics_1.Gauge; } });
25
47
  Object.defineProperty(exports, "Histogram", { enumerable: true, get: function () { return metrics_1.Histogram; } });
26
48
  Object.defineProperty(exports, "Summary", { enumerable: true, get: function () { return metrics_1.Summary; } });
49
+ exports.helpers = __importStar(require("./helpers"));
27
50
  //# sourceMappingURL=public.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"public.js","sourceRoot":"","sources":["../../../src/metrics/prometheus/public.ts"],"names":[],"mappings":";AAAA,wBAAwB;;;;;;;;;;;;;;;;;AAExB,8CAA4B;AAC5B,mCAAoC;AAA3B,kGAAA,QAAQ,OAAA;AACjB,qCAKmB;AAJjB,kGAAA,OAAO,OAAA;AACP,gGAAA,KAAK,OAAA;AACL,oGAAA,SAAS,OAAA;AACT,kGAAA,OAAO,OAAA"}
1
+ {"version":3,"file":"public.js","sourceRoot":"","sources":["../../../src/metrics/prometheus/public.ts"],"names":[],"mappings":";AAAA,wBAAwB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAExB,8CAA4B;AAC5B,mCAAoC;AAA3B,kGAAA,QAAQ,OAAA;AACjB,qCAKmB;AAJjB,kGAAA,OAAO,OAAA;AACP,gGAAA,KAAK,OAAA;AACL,oGAAA,SAAS,OAAA;AACT,kGAAA,OAAO,OAAA;AAUT,qDAAqC"}
@@ -1 +1 @@
1
- export * as api from '@opentelemetry/api';
1
+ export * from '@opentelemetry/sdk-node';
@@ -11,29 +11,9 @@ 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
- });
19
- var __importStar = (this && this.__importStar) || (function () {
20
- var ownKeys = function(o) {
21
- ownKeys = Object.getOwnPropertyNames || function (o) {
22
- var ar = [];
23
- for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
24
- return ar;
25
- };
26
- return ownKeys(o);
27
- };
28
- return function (mod) {
29
- if (mod && mod.__esModule) return mod;
30
- var result = {};
31
- if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
32
- __setModuleDefault(result, mod);
33
- return result;
34
- };
35
- })();
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
+ };
36
17
  Object.defineProperty(exports, "__esModule", { value: true });
37
- exports.api = void 0;
38
- exports.api = __importStar(require("@opentelemetry/api"));
18
+ __exportStar(require("@opentelemetry/sdk-node"), exports);
39
19
  //# sourceMappingURL=public.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"public.js","sourceRoot":"","sources":["../../src/otel/public.ts"],"names":[],"mappings":";AAAA,wBAAwB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAExB,0DAA0C"}
1
+ {"version":3,"file":"public.js","sourceRoot":"","sources":["../../src/otel/public.ts"],"names":[],"mappings":";AAAA,wBAAwB;;;;;;;;;;;;;;;;AAExB,0DAAwC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@codefresh-io/cf-telemetry",
3
- "version": "2.0.0-alpha.25",
3
+ "version": "2.0.0-alpha.26",
4
4
  "exports": {
5
5
  "./init": {
6
6
  "import": "./dist/init.mjs",