@codefresh-io/cf-telemetry 2.2.0-alpha.9 → 2.2.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.
@@ -0,0 +1,60 @@
1
+ /**
2
+ * Well-known Span attribute names.
3
+ */
4
+ export declare const Attribute: {
5
+ /** Gitops runtime ID. Attribute value: `string` */
6
+ readonly GitopsRuntimeId: "cf.gitops.runtime.id";
7
+ /** Gitops runtime IDs. Attribute value: `string[]` */
8
+ readonly GitopsRuntimeIds: "cf.gitops.runtime.ids";
9
+ /** Gitops runtime IDs count. Attribute value: `number` */
10
+ readonly GitopsRuntimeIdsCount: "cf.gitops.runtime.ids.count";
11
+ /** Classic build ID. Attribute value: `string` */
12
+ readonly ClassicBuildId: "cf.classic.build.id";
13
+ /** Classic build IDs. Attribute value: `string[]` */
14
+ readonly ClassicBuildIds: "cf.classic.build.ids";
15
+ /** Classic build IDs count. Attribute value: `number` */
16
+ readonly ClassicBuildIdsCount: "cf.classic.build.ids.count";
17
+ /** Classic runtime ID. Attribute value: `string` */
18
+ readonly ClassicRuntimeId: "cf.classic.runtime.id";
19
+ /** Classic runtime IDs. Attribute value: `string[]` */
20
+ readonly ClassicRuntimeIds: "cf.classic.runtime.ids";
21
+ /** Classic runtime IDs count. Attribute value: `number` */
22
+ readonly ClassicRuntimeIdsCount: "cf.classic.runtime.ids.count";
23
+ /** Classic pipeline ID. Attribute value: `string` */
24
+ readonly ClassicPipelineId: "cf.classic.pipeline.id";
25
+ /** Classic pipeline IDs. Attribute value: `string[]` */
26
+ readonly ClassicPipelineIds: "cf.classic.pipeline.ids";
27
+ /** Classic pipeline IDs count. Attribute value: `number` */
28
+ readonly ClassicPipelineIdsCount: "cf.classic.pipeline.ids.count";
29
+ /** Classic pipeline name. Attribute value: `string` */
30
+ readonly ClassicPipelineName: "cf.classic.pipeline.name";
31
+ /** Classic pipeline names. Attribute value: `string[]` */
32
+ readonly ClassicPipelineNames: "cf.classic.pipeline.names";
33
+ /** Classic pipeline names count. Attribute value: `number` */
34
+ readonly ClassicPipelineNamesCount: "cf.classic.pipeline.names.count";
35
+ /** Codefresh account ID. Attribute value: `string` */
36
+ readonly AccountId: "cf.account.id";
37
+ /** Codefresh account IDs. Attribute value: `string[]` */
38
+ readonly AccountIds: "cf.account.ids";
39
+ /** Codefresh account IDs count. Attribute value: `number` */
40
+ readonly AccountIdsCount: "cf.account.ids.count";
41
+ /** Codefresh account name. Attribute value: `string` */
42
+ readonly AccountName: "cf.account.name";
43
+ /** Codefresh account names. Attribute value: `string[]` */
44
+ readonly AccountNames: "cf.account.names";
45
+ /** Codefresh account names count. Attribute value: `number` */
46
+ readonly AccountNamesCount: "cf.account.names.count";
47
+ /** Codefresh user ID. Attribute value: `string` */
48
+ readonly UserId: "cf.user.id";
49
+ /** Codefresh user IDs. Attribute value: `string[]` */
50
+ readonly UserIds: "cf.user.ids";
51
+ /** Codefresh user IDs count. Attribute value: `number` */
52
+ readonly UserIdsCount: "cf.user.ids.count";
53
+ /** Codefresh user name. Attribute value: `string` */
54
+ readonly UserName: "cf.user.name";
55
+ /** Codefresh user names. Attribute value: `string[]` */
56
+ readonly UserNames: "cf.user.names";
57
+ /** Codefresh user names count. Attribute value: `number` */
58
+ readonly UserNamesCount: "cf.user.names.count";
59
+ };
60
+ export type Attribute = typeof Attribute[keyof typeof Attribute];
@@ -0,0 +1,81 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Attribute = void 0;
4
+ /**
5
+ * Well-known cross-product Span attribute names.
6
+ */
7
+ const CrossProductAttribute = {
8
+ /** Codefresh account ID. Attribute value: `string` */
9
+ AccountId: 'cf.account.id',
10
+ /** Codefresh account IDs. Attribute value: `string[]` */
11
+ AccountIds: 'cf.account.ids',
12
+ /** Codefresh account IDs count. Attribute value: `number` */
13
+ AccountIdsCount: 'cf.account.ids.count',
14
+ /** Codefresh account name. Attribute value: `string` */
15
+ AccountName: 'cf.account.name',
16
+ /** Codefresh account names. Attribute value: `string[]` */
17
+ AccountNames: 'cf.account.names',
18
+ /** Codefresh account names count. Attribute value: `number` */
19
+ AccountNamesCount: 'cf.account.names.count',
20
+ /** Codefresh user ID. Attribute value: `string` */
21
+ UserId: 'cf.user.id',
22
+ /** Codefresh user IDs. Attribute value: `string[]` */
23
+ UserIds: 'cf.user.ids',
24
+ /** Codefresh user IDs count. Attribute value: `number` */
25
+ UserIdsCount: 'cf.user.ids.count',
26
+ /** Codefresh user name. Attribute value: `string` */
27
+ UserName: 'cf.user.name',
28
+ /** Codefresh user names. Attribute value: `string[]` */
29
+ UserNames: 'cf.user.names',
30
+ /** Codefresh user names count. Attribute value: `number` */
31
+ UserNamesCount: 'cf.user.names.count',
32
+ };
33
+ /**
34
+ * Well-known classic Span attribute names.
35
+ */
36
+ const ClassicAttribute = {
37
+ /** Classic build ID. Attribute value: `string` */
38
+ ClassicBuildId: 'cf.classic.build.id',
39
+ /** Classic build IDs. Attribute value: `string[]` */
40
+ ClassicBuildIds: 'cf.classic.build.ids',
41
+ /** Classic build IDs count. Attribute value: `number` */
42
+ ClassicBuildIdsCount: 'cf.classic.build.ids.count',
43
+ /** Classic runtime ID. Attribute value: `string` */
44
+ ClassicRuntimeId: 'cf.classic.runtime.id',
45
+ /** Classic runtime IDs. Attribute value: `string[]` */
46
+ ClassicRuntimeIds: 'cf.classic.runtime.ids',
47
+ /** Classic runtime IDs count. Attribute value: `number` */
48
+ ClassicRuntimeIdsCount: 'cf.classic.runtime.ids.count',
49
+ /** Classic pipeline ID. Attribute value: `string` */
50
+ ClassicPipelineId: 'cf.classic.pipeline.id',
51
+ /** Classic pipeline IDs. Attribute value: `string[]` */
52
+ ClassicPipelineIds: 'cf.classic.pipeline.ids',
53
+ /** Classic pipeline IDs count. Attribute value: `number` */
54
+ ClassicPipelineIdsCount: 'cf.classic.pipeline.ids.count',
55
+ /** Classic pipeline name. Attribute value: `string` */
56
+ ClassicPipelineName: 'cf.classic.pipeline.name',
57
+ /** Classic pipeline names. Attribute value: `string[]` */
58
+ ClassicPipelineNames: 'cf.classic.pipeline.names',
59
+ /** Classic pipeline names count. Attribute value: `number` */
60
+ ClassicPipelineNamesCount: 'cf.classic.pipeline.names.count',
61
+ };
62
+ /**
63
+ * Well-known gitops Span attribute names.
64
+ */
65
+ const GitopsAttribute = {
66
+ /** Gitops runtime ID. Attribute value: `string` */
67
+ GitopsRuntimeId: 'cf.gitops.runtime.id',
68
+ /** Gitops runtime IDs. Attribute value: `string[]` */
69
+ GitopsRuntimeIds: 'cf.gitops.runtime.ids',
70
+ /** Gitops runtime IDs count. Attribute value: `number` */
71
+ GitopsRuntimeIdsCount: 'cf.gitops.runtime.ids.count',
72
+ };
73
+ /**
74
+ * Well-known Span attribute names.
75
+ */
76
+ exports.Attribute = {
77
+ ...CrossProductAttribute,
78
+ ...ClassicAttribute,
79
+ ...GitopsAttribute,
80
+ };
81
+ //# sourceMappingURL=attribute.enum.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"attribute.enum.js","sourceRoot":"","sources":["../../../src/otel/cf/attribute.enum.ts"],"names":[],"mappings":";;;AAIA;;GAEG;AACH,MAAM,qBAAqB,GAAG;IAC5B,sDAAsD;IACtD,SAAS,EAAE,eAAe;IAC1B,yDAAyD;IACzD,UAAU,EAAE,gBAAgB;IAC5B,6DAA6D;IAC7D,eAAe,EAAE,sBAAsB;IACvC,wDAAwD;IACxD,WAAW,EAAE,iBAAiB;IAC9B,2DAA2D;IAC3D,YAAY,EAAE,kBAAkB;IAChC,+DAA+D;IAC/D,iBAAiB,EAAE,wBAAwB;IAE3C,mDAAmD;IACnD,MAAM,EAAE,YAAY;IACpB,sDAAsD;IACtD,OAAO,EAAE,aAAa;IACtB,0DAA0D;IAC1D,YAAY,EAAE,mBAAmB;IACjC,qDAAqD;IACrD,QAAQ,EAAE,cAAc;IACxB,wDAAwD;IACxD,SAAS,EAAE,eAAe;IAC1B,4DAA4D;IAC5D,cAAc,EAAE,qBAAqB;CACuB,CAAC;AAE/D;;GAEG;AACH,MAAM,gBAAgB,GAAG;IACvB,kDAAkD;IAClD,cAAc,EAAE,qBAAqB;IACrC,qDAAqD;IACrD,eAAe,EAAE,sBAAsB;IACvC,yDAAyD;IACzD,oBAAoB,EAAE,4BAA4B;IAElD,oDAAoD;IACpD,gBAAgB,EAAE,uBAAuB;IACzC,uDAAuD;IACvD,iBAAiB,EAAE,wBAAwB;IAC3C,2DAA2D;IAC3D,sBAAsB,EAAE,8BAA8B;IAEtD,qDAAqD;IACrD,iBAAiB,EAAE,wBAAwB;IAC3C,wDAAwD;IACxD,kBAAkB,EAAE,yBAAyB;IAC7C,4DAA4D;IAC5D,uBAAuB,EAAE,+BAA+B;IACxD,uDAAuD;IACvD,mBAAmB,EAAE,0BAA0B;IAC/C,0DAA0D;IAC1D,oBAAoB,EAAE,2BAA2B;IACjD,8DAA8D;IAC9D,yBAAyB,EAAE,iCAAiC;CACO,CAAC;AAEtE;;GAEG;AACH,MAAM,eAAe,GAAG;IACtB,mDAAmD;IACnD,eAAe,EAAE,sBAAsB;IACvC,sDAAsD;IACtD,gBAAgB,EAAE,uBAAuB;IACzC,0DAA0D;IAC1D,qBAAqB,EAAE,6BAA6B;CACc,CAAC;AAErE;;GAEG;AACU,QAAA,SAAS,GAAG;IACvB,GAAG,qBAAqB;IACxB,GAAG,gBAAgB;IACnB,GAAG,eAAe;CAC0C,CAAC"}
@@ -0,0 +1,8 @@
1
+ import { api } from '@opentelemetry/sdk-node';
2
+ /**
3
+ * Returns a tracer from the global tracer provider.
4
+ * Tracer name and version are set to the service name and version.
5
+ *
6
+ * Utility wrapper for {@link api.trace.getTracer|api.trace.getTracer}
7
+ **/
8
+ export declare const getTracer: () => api.Tracer;
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getTracer = void 0;
4
+ const sdk_node_1 = require("@opentelemetry/sdk-node");
5
+ const global_config_1 = require("../../global-config");
6
+ /**
7
+ * Returns a tracer from the global tracer provider.
8
+ * Tracer name and version are set to the service name and version.
9
+ *
10
+ * Utility wrapper for {@link api.trace.getTracer|api.trace.getTracer}
11
+ **/
12
+ const getTracer = () => {
13
+ return sdk_node_1.api.trace.getTracer(global_config_1.globalConfig.serviceName, global_config_1.globalConfig.serviceVersion);
14
+ };
15
+ exports.getTracer = getTracer;
16
+ //# sourceMappingURL=helpers.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"helpers.js","sourceRoot":"","sources":["../../../src/otel/cf/helpers.ts"],"names":[],"mappings":";;;AAAA,sDAA8C;AAC9C,uDAAmD;AAEnD;;;;;IAKI;AACG,MAAM,SAAS,GAAG,GAAG,EAAE;IAC5B,OAAO,cAAG,CAAC,KAAK,CAAC,SAAS,CAAC,4BAAY,CAAC,WAAW,EAAE,4BAAY,CAAC,cAAc,CAAC,CAAC;AACpF,CAAC,CAAC;AAFW,QAAA,SAAS,aAEpB"}
@@ -0,0 +1,3 @@
1
+ export * from './attribute.enum';
2
+ export * from './helpers';
3
+ export * from './span.decorator';
@@ -0,0 +1,20 @@
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 __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./attribute.enum"), exports);
18
+ __exportStar(require("./helpers"), exports);
19
+ __exportStar(require("./span.decorator"), exports);
20
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/otel/cf/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,mDAAiC;AACjC,4CAA0B;AAC1B,mDAAiC"}
@@ -0,0 +1,11 @@
1
+ import { api } from '@opentelemetry/sdk-node';
2
+ /**
3
+ * Decorator wraps a class method in an active span. Both sync and async methods are supported.
4
+ *
5
+ * If an error is thrown by decorated method, span status is set to `ERROR`
6
+ * and the exception is recorded to span events.
7
+ *
8
+ * @param name The name of the span. If not provided, defaults to `<ClassName>.<methodName>`.
9
+ * @param options {@link api.SpanOptions|SpanOptions} used for span creation.
10
+ */
11
+ export declare const Span: (name?: string, options?: api.SpanOptions) => (target: Object, propertyKey: string | symbol, descriptor: TypedPropertyDescriptor<(...args: any[]) => any>) => TypedPropertyDescriptor<(...args: any[]) => any>;
@@ -1,49 +1,39 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.Attribute = exports.Span = exports.getTracer = void 0;
3
+ exports.Span = void 0;
4
4
  const sdk_node_1 = require("@opentelemetry/sdk-node");
5
- const global_config_1 = require("../global-config");
6
- /**
7
- * Returns a tracer from the global tracer provider.
8
- * Tracer name and version are set to the service name and version.
9
- *
10
- * Utility wrapper for {@link api.trace.getTracer|api.trace.getTracer}
11
- **/
12
- const getTracer = () => {
13
- return sdk_node_1.api.trace.getTracer(global_config_1.globalConfig.serviceName, global_config_1.globalConfig.serviceVersion);
14
- };
15
- exports.getTracer = getTracer;
5
+ const helpers_1 = require("./helpers");
16
6
  /**
17
7
  * Decorator wraps a class method in an active span. Both sync and async methods are supported.
8
+ *
18
9
  * If an error is thrown by decorated method, span status is set to `ERROR`
19
10
  * and the exception is recorded to span events.
20
11
  *
21
- * The span name is set to the `<ClassName> <methodName>`.
22
- *
23
- * @param kind {@link api.SpanKind|SpanKind}. Default is `SpanKind.INTERNAL`.
12
+ * @param name The name of the span. If not provided, defaults to `<ClassName>.<methodName>`.
13
+ * @param options {@link api.SpanOptions|SpanOptions} used for span creation.
24
14
  */
25
- const Span = (kind = sdk_node_1.api.SpanKind.INTERNAL) => {
15
+ const Span = (name, options = {}) => {
26
16
  // eslint-disable-next-line @typescript-eslint/no-wrapper-object-types, @typescript-eslint/no-explicit-any
27
17
  return (target, propertyKey, descriptor) => {
28
18
  const originalMethod = descriptor.value;
29
19
  descriptor.value = function (...args) {
30
- return (0, exports.getTracer)().startActiveSpan(`${target.constructor.name} ${String(propertyKey)}`, { kind }, (span) => {
20
+ name ??= this === target
21
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
22
+ ? `${target?.name ?? '<anonymous>'}.${String(propertyKey)} static`
23
+ : `${this?.constructor?.name ?? '<anonymous>'}.${String(propertyKey)}`;
24
+ return (0, helpers_1.getTracer)().startActiveSpan(name, options, (span) => {
31
25
  try {
32
26
  const result = originalMethod.apply(this, args);
33
- /**
34
- * It is crucial to check for thenables instead of Promises,
35
- * because multiple libs (like mongoose) use a custom Promise implementation.
36
- */
37
- if (typeof result?.then === 'function') {
27
+ if (result instanceof Promise) {
38
28
  return result
39
29
  .then((res) => {
40
- // Async success handling
30
+ // Promise success handling
41
31
  span.setStatus({ code: sdk_node_1.api.SpanStatusCode.OK });
42
32
  span.end();
43
33
  return res;
44
34
  })
45
35
  .catch((exception) => {
46
- // Async error handling
36
+ // Promise error handling
47
37
  if (exception instanceof Error) {
48
38
  span.recordException(exception);
49
39
  span.setStatus({
@@ -58,6 +48,36 @@ const Span = (kind = sdk_node_1.api.SpanKind.INTERNAL) => {
58
48
  throw exception;
59
49
  });
60
50
  }
51
+ // TODO: Revise this logic to support thenables
52
+ /**
53
+ * It is crucial to check for thenables,
54
+ * because multiple libs (like mongoose) use a custom Promise implementation.
55
+ */
56
+ // if (typeof result?.then === 'function') {
57
+ // return result
58
+ // .then(
59
+ // // Thenable success handling
60
+ // (res: unknown) => {
61
+ // span.setStatus({ code: api.SpanStatusCode.OK });
62
+ // span.end();
63
+ // // TODO: ...
64
+ // },
65
+ // // Thenable error handling
66
+ // (exception: unknown) => {
67
+ // if (exception instanceof Error) {
68
+ // span.recordException(exception);
69
+ // span.setStatus({
70
+ // code: api.SpanStatusCode.ERROR,
71
+ // message: exception.message,
72
+ // });
73
+ // } else {
74
+ // span.setStatus({ code: api.SpanStatusCode.ERROR });
75
+ // }
76
+ // span.end();
77
+ // // TODO: ...
78
+ // },
79
+ // );
80
+ // }
61
81
  // Sync success handling
62
82
  span.setStatus({ code: sdk_node_1.api.SpanStatusCode.OK });
63
83
  span.end();
@@ -84,33 +104,4 @@ const Span = (kind = sdk_node_1.api.SpanKind.INTERNAL) => {
84
104
  };
85
105
  };
86
106
  exports.Span = Span;
87
- /**
88
- * Well-known Span attribute names.
89
- */
90
- exports.Attribute = {
91
- /** Codefresh account ID. Attribute value: `string` */
92
- AccountId: 'cf.account.id',
93
- /** Codefresh account IDs. Attribute value: `string[]` */
94
- AccountIds: 'cf.account.ids',
95
- /** Codefresh account IDs count. Attribute value: `number` */
96
- AccountIdsCount: 'cf.account.ids.count',
97
- /** Codefresh account name. Attribute value: `string` */
98
- AccountName: 'cf.account.name',
99
- /** Codefresh account names. Attribute value: `string[]` */
100
- AccountNames: 'cf.account.names',
101
- /** Codefresh account names count. Attribute value: `number` */
102
- AccountNamesCount: 'cf.account.names.count',
103
- /** Codefresh user ID. Attribute value: `string` */
104
- UserId: 'cf.user.id',
105
- /** Codefresh user IDs. Attribute value: `string[]` */
106
- UserIds: 'cf.user.ids',
107
- /** Codefresh user IDs count. Attribute value: `number` */
108
- UserIdsCount: 'cf.user.ids.count',
109
- /** Codefresh user name. Attribute value: `string` */
110
- UserName: 'cf.user.name',
111
- /** Codefresh user names. Attribute value: `string[]` */
112
- UserNames: 'cf.user.names',
113
- /** Codefresh user names count. Attribute value: `number` */
114
- UserNamesCount: 'cf.user.names.count',
115
- };
116
- //# sourceMappingURL=cf-helpers.js.map
107
+ //# sourceMappingURL=span.decorator.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"span.decorator.js","sourceRoot":"","sources":["../../../src/otel/cf/span.decorator.ts"],"names":[],"mappings":";;;AAAA,sDAA8C;AAC9C,uCAAsC;AAEtC;;;;;;;;GAQG;AACI,MAAM,IAAI,GAAG,CAAC,IAAa,EAAE,UAA2B,EAAE,EAAE,EAAE;IACnE,0GAA0G;IAC1G,OAAO,CAAC,MAAc,EAAE,WAA4B,EAAE,UAA4D,EAAE,EAAE;QACpH,MAAM,cAAc,GAAG,UAAU,CAAC,KAAM,CAAC;QAEzC,UAAU,CAAC,KAAK,GAAG,UAAU,GAAG,IAAe;YAC7C,IAAI,KAAK,IAAI,KAAK,MAAM;gBACtB,8DAA8D;gBAC9D,CAAC,CAAC,GAAI,MAAc,EAAE,IAAI,IAAI,aAAa,IAAI,MAAM,CAAC,WAAW,CAAC,SAAS;gBAC3E,CAAC,CAAC,GAAG,IAAI,EAAE,WAAW,EAAE,IAAI,IAAI,aAAa,IAAI,MAAM,CAAC,WAAW,CAAC,EAAE,CAAC;YAEzE,OAAO,IAAA,mBAAS,GAAE,CAAC,eAAe,CAChC,IAAI,EACJ,OAAO,EACP,CAAC,IAAI,EAAE,EAAE;gBACP,IAAI,CAAC;oBACH,MAAM,MAAM,GAAG,cAAc,CAAC,KAAK,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;oBAEhD,IAAI,MAAM,YAAY,OAAO,EAAE,CAAC;wBAC9B,OAAO,MAAM;6BACV,IAAI,CAAC,CAAC,GAAY,EAAE,EAAE;4BACrB,2BAA2B;4BAC3B,IAAI,CAAC,SAAS,CAAC,EAAE,IAAI,EAAE,cAAG,CAAC,cAAc,CAAC,EAAE,EAAE,CAAC,CAAC;4BAChD,IAAI,CAAC,GAAG,EAAE,CAAC;4BACX,OAAO,GAAG,CAAC;wBACb,CAAC,CAAC;6BACD,KAAK,CAAC,CAAC,SAAkB,EAAE,EAAE;4BAC5B,yBAAyB;4BACz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AC;4BACb,IAAI,EAAE,cAAG,CAAC,cAAc,CAAC,KAAK;4BAC9B,OAAO,EAAE,SAAS,CAAC,OAAO;yBAC3B,CAAC,CAAC;oBACL,CAAC;yBAAM,CAAC;wBACN,IAAI,CAAC,SAAS,CAAC,EAAE,IAAI,EAAE,cAAG,CAAC,cAAc,CAAC,KAAK,EAAE,CAAC,CAAC;oBACrD,CAAC;oBACD,IAAI,CAAC,GAAG,EAAE,CAAC;oBACX,MAAM,SAAS,CAAC;gBAClB,CAAC;YACH,CAAC,CACF,CAAC;QACJ,CAAC,CAAC;QACF,OAAO,UAAU,CAAC;IACpB,CAAC,CAAC;AACJ,CAAC,CAAC;AAhGW,QAAA,IAAI,QAgGf"}
@@ -1,3 +1,3 @@
1
1
  export * from '@opentelemetry/sdk-node';
2
2
  /** Codefresh-developed utils for OTel */
3
- export * as cf from './cf-helpers';
3
+ export * as cf from './cf';
@@ -40,5 +40,5 @@ Object.defineProperty(exports, "__esModule", { value: true });
40
40
  exports.cf = void 0;
41
41
  __exportStar(require("@opentelemetry/sdk-node"), exports);
42
42
  /** Codefresh-developed utils for OTel */
43
- exports.cf = __importStar(require("./cf-helpers"));
43
+ exports.cf = __importStar(require("./cf"));
44
44
  //# sourceMappingURL=public.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"public.js","sourceRoot":"","sources":["../../src/otel/public.ts"],"names":[],"mappings":";AAAA,wBAAwB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAExB,0DAAwC;AAExC,yCAAyC;AACzC,mDAAmC"}
1
+ {"version":3,"file":"public.js","sourceRoot":"","sources":["../../src/otel/public.ts"],"names":[],"mappings":";AAAA,wBAAwB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAExB,0DAAwC;AAExC,yCAAyC;AACzC,2CAA2B"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@codefresh-io/cf-telemetry",
3
- "version": "2.2.0-alpha.9",
3
+ "version": "2.2.0",
4
4
  "exports": {
5
5
  "./init": {
6
6
  "import": "./dist/init.mjs",
@@ -1,48 +0,0 @@
1
- import { api } from '@opentelemetry/sdk-node';
2
- /**
3
- * Returns a tracer from the global tracer provider.
4
- * Tracer name and version are set to the service name and version.
5
- *
6
- * Utility wrapper for {@link api.trace.getTracer|api.trace.getTracer}
7
- **/
8
- export declare const getTracer: () => api.Tracer;
9
- /**
10
- * Decorator wraps a class method in an active span. Both sync and async methods are supported.
11
- * If an error is thrown by decorated method, span status is set to `ERROR`
12
- * and the exception is recorded to span events.
13
- *
14
- * The span name is set to the `<ClassName> <methodName>`.
15
- *
16
- * @param kind {@link api.SpanKind|SpanKind}. Default is `SpanKind.INTERNAL`.
17
- */
18
- export declare const Span: (kind?: api.SpanKind) => (target: Object, propertyKey: string | symbol, descriptor: TypedPropertyDescriptor<(...args: any[]) => any>) => TypedPropertyDescriptor<(...args: any[]) => any>;
19
- /**
20
- * Well-known Span attribute names.
21
- */
22
- export declare const Attribute: {
23
- /** Codefresh account ID. Attribute value: `string` */
24
- readonly AccountId: "cf.account.id";
25
- /** Codefresh account IDs. Attribute value: `string[]` */
26
- readonly AccountIds: "cf.account.ids";
27
- /** Codefresh account IDs count. Attribute value: `number` */
28
- readonly AccountIdsCount: "cf.account.ids.count";
29
- /** Codefresh account name. Attribute value: `string` */
30
- readonly AccountName: "cf.account.name";
31
- /** Codefresh account names. Attribute value: `string[]` */
32
- readonly AccountNames: "cf.account.names";
33
- /** Codefresh account names count. Attribute value: `number` */
34
- readonly AccountNamesCount: "cf.account.names.count";
35
- /** Codefresh user ID. Attribute value: `string` */
36
- readonly UserId: "cf.user.id";
37
- /** Codefresh user IDs. Attribute value: `string[]` */
38
- readonly UserIds: "cf.user.ids";
39
- /** Codefresh user IDs count. Attribute value: `number` */
40
- readonly UserIdsCount: "cf.user.ids.count";
41
- /** Codefresh user name. Attribute value: `string` */
42
- readonly UserName: "cf.user.name";
43
- /** Codefresh user names. Attribute value: `string[]` */
44
- readonly UserNames: "cf.user.names";
45
- /** Codefresh user names count. Attribute value: `number` */
46
- readonly UserNamesCount: "cf.user.names.count";
47
- };
48
- export type Attribute = typeof Attribute[keyof typeof Attribute];
@@ -1 +0,0 @@
1
- {"version":3,"file":"cf-helpers.js","sourceRoot":"","sources":["../../src/otel/cf-helpers.ts"],"names":[],"mappings":";;;AAAA,sDAA8C;AAC9C,oDAAgD;AAEhD;;;;;IAKI;AACG,MAAM,SAAS,GAAG,GAAG,EAAE;IAC5B,OAAO,cAAG,CAAC,KAAK,CAAC,SAAS,CAAC,4BAAY,CAAC,WAAW,EAAE,4BAAY,CAAC,cAAc,CAAC,CAAC;AACpF,CAAC,CAAC;AAFW,QAAA,SAAS,aAEpB;AAEF;;;;;;;;GAQG;AACI,MAAM,IAAI,GAAG,CAAC,OAAqB,cAAG,CAAC,QAAQ,CAAC,QAAQ,EAAE,EAAE;IACjE,0GAA0G;IAC1G,OAAO,CAAC,MAAc,EAAE,WAA4B,EAAE,UAA4D,EAAE,EAAE;QACpH,MAAM,cAAc,GAAG,UAAU,CAAC,KAAM,CAAC;QACzC,UAAU,CAAC,KAAK,GAAG,UAAU,GAAG,IAAe;YAC7C,OAAO,IAAA,iBAAS,GAAE,CAAC,eAAe,CAChC,GAAG,MAAM,CAAC,WAAW,CAAC,IAAI,IAAI,MAAM,CAAC,WAAW,CAAC,EAAE,EACnD,EAAE,IAAI,EAAE,EACR,CAAC,IAAI,EAAE,EAAE;gBACP,IAAI,CAAC;oBACH,MAAM,MAAM,GAAG,cAAc,CAAC,KAAK,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;oBAChD;;;uBAGG;oBACH,IAAI,OAAO,MAAM,EAAE,IAAI,KAAK,UAAU,EAAE,CAAC;wBACvC,OAAO,MAAM;6BACV,IAAI,CAAC,CAAC,GAAY,EAAE,EAAE;4BACrB,yBAAyB;4BACzB,IAAI,CAAC,SAAS,CAAC,EAAE,IAAI,EAAE,cAAG,CAAC,cAAc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