@vtvlive/interactive-apm 0.0.5 → 0.0.6

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.
@@ -1 +1 @@
1
- {"version":3,"file":"elastic-apm-init.d.ts","sourceRoot":"","sources":["../../src/init/elastic-apm-init.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAKH,MAAM,WAAW,qBAAqB;IACpC,2BAA2B;IAC3B,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,6BAA6B;IAC7B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,sCAAsC;IACtC,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,sBAAsB;IACtB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,6BAA6B;IAC7B,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,oBAAoB;IACpB,QAAQ,CAAC,EAAE,OAAO,GAAG,OAAO,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,KAAK,CAAC;CAClE;AAED;;;GAGG;AACH,wBAAgB,mBAAmB,IAAI,OAAO,CAG7C;AAED;;;;;GAKG;AACH,wBAAgB,cAAc,CAAC,OAAO,GAAE,qBAA0B,GAAG;IACnE,SAAS,IAAI,OAAO,CAAC;IACrB,gBAAgB,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG;QAAE,GAAG,IAAI,IAAI,CAAA;KAAE,GAAG,IAAI,CAAC;IACrE,SAAS,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG;QAAE,GAAG,IAAI,IAAI,CAAA;KAAE,GAAG,IAAI,CAAC;IAC9D,YAAY,CAAC,KAAK,EAAE,KAAK,GAAG,IAAI,CAAC;IACjC,kBAAkB,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;IACvC,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;CACxB,GAAG,IAAI,CA6CP;AAED;;G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,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG;QAAE,GAAG,IAAI,IAAI,CAAA;KAAE,GAAG,IAAI,CAAC;IACrE,SAAS,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG;QAAE,GAAG,IAAI,IAAI,CAAA;KAAE,GAAG,IAAI,CAAC;IAC9D,YAAY,CAAC,KAAK,EAAE,KAAK,GAAG,IAAI,CAAC;IACjC,kBAAkB,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;IACvC,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;CACxB,GAAG,IAAI,CA8CP;AAED;;GAEG;AACH,wBAAgB,mBAAmB,IAAI,OAAO,CAQ7C;AAED;;GAEG;AACH,wBAAgB,kBAAkB,IAAI;IACpC,SAAS,IAAI,OAAO,CAAC;IACrB,gBAAgB,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG;QAAE,GAAG,IAAI,IAAI,CAAA;KAAE,GAAG,IAAI,CAAC;IACrE,SAAS,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG;QAAE,GAAG,IAAI,IAAI,CAAA;KAAE,GAAG,IAAI,CAAC;IAC9D,YAAY,CAAC,KAAK,EAAE,KAAK,GAAG,IAAI,CAAC;IACjC,kBAAkB,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;IACvC,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;CACxB,GAAG,IAAI,CAWP"}
@@ -22,6 +22,7 @@ exports.isElasticApmStarted = isElasticApmStarted;
22
22
  exports.getElasticApmAgent = getElasticApmAgent;
23
23
  const apm_provider_type_1 = require("../types/apm-provider.type");
24
24
  const debug_logger_1 = require("../utils/debug-logger");
25
+ const elastic_apm_compat_1 = require("../utils/elastic-apm-compat");
25
26
  /**
26
27
  * Check if APM should use Elastic APM provider based on configuration
27
28
  * @returns true if Elastic APM should be used
@@ -67,7 +68,8 @@ function initElasticApm(options = {}) {
67
68
  logLevel: options.logLevel || "error",
68
69
  });
69
70
  if ((0, debug_logger_1.isDebugEnabled)()) {
70
- (0, debug_logger_1.infoLog)(`[ElasticAPM] Service: ${agent.getServiceName()}, Environment: ${agent.conf.environment}`);
71
+ const env = (0, elastic_apm_compat_1.getServiceEnvironment)(agent);
72
+ (0, debug_logger_1.infoLog)(`[ElasticAPM] Service: ${agent.getServiceName()}, Environment: ${env}`);
71
73
  (0, debug_logger_1.infoLog)("[ElasticAPM] Initialized");
72
74
  }
73
75
  return agent;
@@ -1 +1 @@
1
- {"version":3,"file":"elastic-apm.tracing-provider.d.ts","sourceRoot":"","sources":["../../src/providers/elastic-apm.tracing-provider.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,0CAA0C,CAAC;AAC5E,OAAO,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAS3C;;GAEG;AACH,MAAM,WAAW,eAAgB,SAAQ,KAAK;IAC5C,8BAA8B;IAC9B,QAAQ,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IAE3C,wBAAwB;IACxB,OAAO,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;IAE5B,yCAAyC;IACzC,OAAO,CAAC,EAAE,MAAM,CAAC;IAEjB,mBAAmB;IACnB,GAAG,IAAI,IAAI,CAAC;CACb;AA0BD;;;GAGG;AACH,qBAAa,yBAA0B,YAAW,gBAAgB;IAChE,OAAO,CAAC,GAAG,CAAiC;IAC5C,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAS;IACrC,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAS;gBAGnC,MAAM,GAAE;QACN,WAAW,CAAC,EAAE,MAAM,CAAC;QACrB,WAAW,CAAC,EAAE,MAAM,CAAC;QACrB,SAAS,CAAC,EAAE,MAAM,CAAC;QACnB,WAAW,CAAC,EAAE,MAAM,CAAC;QACr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;;OAEG;IACG,mBAAmB,CAAC,CAAC,EACzB,IAAI,EAAE,MAAM,EACZ,EAAE,EAAE,CAAC,IAAI,EAAE,KAAK,GAAG,IAAI,KAAK,OAAO,CAAC,CAAC,CAAC,EACtC,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAAC,GAC3C,OAAO,CAAC,CAAC,CAAC;IAsBb;;OAEG;IACH,YAAY,CAAC,KAAK,EAAE,KAAK,GAAG,IAAI;IAMhC;;OAEG;IACH,YAAY,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI;IAOvD;;OAEG;IACH,OAAO,CAAC,IAAI,CAAC,EAAE,KAAK,GAAG,IAAI,GAAG,IAAI;IAOlC;;OAEG;IACG,QAAQ,IAAI,OAAO,CAAC,IAAI,CAAC;IAgB/B;;OAEG;IACH,OAAO,CAAC,iBAAiB;IAgBzB;;OAEG;IACH,OAAO,CAAC,mBAAmB;CAe5B"}
@@ -2,6 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.ElasticApmTracingProvider = void 0;
4
4
  const debug_logger_1 = require("../utils/debug-logger");
5
+ const elastic_apm_compat_1 = require("../utils/elastic-apm-compat");
5
6
  /**
6
7
  * Elastic APM Tracing Provider Implementation
7
8
  * Sử dụng elastic-apm-node agent để gửi traces về Elastic APM server
@@ -76,7 +77,7 @@ class ElasticApmTracingProvider {
76
77
  if (!transaction) {
77
78
  const type = this.mapSpanKindToType(spanKind);
78
79
  transaction = this.apm.startTransaction(name, type);
79
- if (!transaction) {
80
+ if ((0, elastic_apm_compat_1.isTransactionNoOp)(transaction)) {
80
81
  return null;
81
82
  }
82
83
  createdTransaction = true;
@@ -0,0 +1,80 @@
1
+ /**
2
+ * Elastic APM Compatibility Layer
3
+ *
4
+ * Provides compatibility functions for working with both elastic-apm-node v3 and v4.
5
+ *
6
+ * Key differences:
7
+ * - v4: agent.getServiceEnvironment() method
8
+ * - v3: agent.conf.environment property
9
+ * - v4: startTransaction() never returns null (returns no-op Transaction instead)
10
+ * - v3: startTransaction() can return null
11
+ */
12
+ /**
13
+ * Elastic APM Agent interface for compatibility
14
+ */
15
+ interface IElasticApmAgent {
16
+ isStarted(): boolean;
17
+ start(config?: unknown): IElasticApmAgent;
18
+ startTransaction(name: string, type: string): ITransaction | null;
19
+ startSpan(name: string, type: string): ISpan | null;
20
+ captureError(error: Error): void;
21
+ setTransactionName(name: string): void;
22
+ setLabel(key: string, value: string | number): void;
23
+ flush?(): Promise<void>;
24
+ shutdown?(): Promise<void>;
25
+ getServiceName?(): string | undefined;
26
+ getServiceEnvironment?(): string;
27
+ conf?: {
28
+ environment?: string;
29
+ [key: string]: unknown;
30
+ };
31
+ }
32
+ /**
33
+ * Transaction interface for compatibility
34
+ */
35
+ interface ITransaction {
36
+ end(): void;
37
+ name?: string;
38
+ type?: string | null;
39
+ ended?: boolean;
40
+ }
41
+ /**
42
+ * Span interface for compatibility
43
+ */
44
+ interface ISpan {
45
+ end(): void;
46
+ name?: string;
47
+ ended?: boolean;
48
+ }
49
+ /**
50
+ * Get the service environment from the APM agent.
51
+ *
52
+ * In v4: uses agent.getServiceEnvironment()
53
+ * In v3: uses agent.conf.environment
54
+ *
55
+ * @param agent The Elastic APM agent instance
56
+ * @returns The environment string, or empty string if not available
57
+ */
58
+ export declare function getServiceEnvironment(agent: IElasticApmAgent | null): string;
59
+ /**
60
+ * Check if a transaction is a no-op (does nothing).
61
+ *
62
+ * In v3: transaction can be null
63
+ * In v4: transaction is never null, but can be a no-op with ended: true
64
+ *
65
+ * @param transaction The transaction to check
66
+ * @returns true if the transaction is a no-op or null
67
+ */
68
+ export declare function isTransactionNoOp(transaction: ITransaction | null | undefined): boolean;
69
+ /**
70
+ * Check if a span is a no-op (does nothing).
71
+ *
72
+ * In v3: span can be null
73
+ * In v4: span can be null or a no-op
74
+ *
75
+ * @param span The span to check
76
+ * @returns true if the span is a no-op or null
77
+ */
78
+ export declare function isSpanNoOp(span: ISpan | null | undefined): boolean;
79
+ export {};
80
+ //# sourceMappingURL=elastic-apm-compat.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"elastic-apm-compat.d.ts","sourceRoot":"","sources":["../../src/utils/elastic-apm-compat.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH;;GAEG;AACH,UAAU,gBAAgB;IACxB,SAAS,IAAI,OAAO,CAAC;IACrB,KAAK,CAAC,MAAM,CAAC,EAAE,OAAO,GAAG,gBAAgB,CAAC;IAC1C,gBAAgB,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,YAAY,GAAG,IAAI,CAAC;IAClE,SAAS,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,KAAK,GAAG,IAAI,CAAC;IACpD,YAAY,CAAC,KAAK,EAAE,KAAK,GAAG,IAAI,CAAC;IACjC,kBAAkB,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;IACvC,QAAQ,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAAC;IACpD,KAAK,CAAC,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;IACxB,QAAQ,CAAC,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;IAC3B,cAAc,CAAC,IAAI,MAAM,GAAG,SAAS,CAAC;IACtC,qBAAqB,CAAC,IAAI,MAAM,CAAC;IACjC,IAAI,CAAC,EAAE;QACL,WAAW,CAAC,EAAE,MAAM,CAAC;QACrB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;KACxB,CAAC;CACH;AAED;;GAEG;AACH,UAAU,YAAY;IACpB,GAAG,IAAI,IAAI,CAAC;IACZ,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACrB,KAAK,CAAC,EAAE,OAAO,CAAC;CACjB;AAED;;GAEG;AACH,UAAU,KAAK;IACb,GAAG,IAAI,IAAI,CAAC;IACZ,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,OAAO,CAAC;CACjB;AAED;;;;;;;;GAQG;AACH,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,gBAAgB,GAAG,IAAI,GAAG,MAAM,CAoB5E;AAED;;;;;;;;GAQG;AACH,wBAAgB,iBAAiB,CAAC,WAAW,EAAE,YAAY,GAAG,IAAI,GAAG,SAAS,GAAG,OAAO,CAavF;AAED;;;;;;;;GAQG;AACH,wBAAgB,UAAU,CAAC,IAAI,EAAE,KAAK,GAAG,IAAI,GAAG,SAAS,GAAG,OAAO,CAYlE"}
@@ -0,0 +1,85 @@
1
+ "use strict";
2
+ /**
3
+ * Elastic APM Compatibility Layer
4
+ *
5
+ * Provides compatibility functions for working with both elastic-apm-node v3 and v4.
6
+ *
7
+ * Key differences:
8
+ * - v4: agent.getServiceEnvironment() method
9
+ * - v3: agent.conf.environment property
10
+ * - v4: startTransaction() never returns null (returns no-op Transaction instead)
11
+ * - v3: startTransaction() can return null
12
+ */
13
+ Object.defineProperty(exports, "__esModule", { value: true });
14
+ exports.getServiceEnvironment = getServiceEnvironment;
15
+ exports.isTransactionNoOp = isTransactionNoOp;
16
+ exports.isSpanNoOp = isSpanNoOp;
17
+ /**
18
+ * Get the service environment from the APM agent.
19
+ *
20
+ * In v4: uses agent.getServiceEnvironment()
21
+ * In v3: uses agent.conf.environment
22
+ *
23
+ * @param agent The Elastic APM agent instance
24
+ * @returns The environment string, or empty string if not available
25
+ */
26
+ function getServiceEnvironment(agent) {
27
+ if (!agent) {
28
+ return "";
29
+ }
30
+ // Try v4 API first
31
+ if (typeof agent.getServiceEnvironment === "function") {
32
+ try {
33
+ return agent.getServiceEnvironment();
34
+ }
35
+ catch {
36
+ // Fall through to v3 API
37
+ }
38
+ }
39
+ // Try v3 API
40
+ if (agent.conf && typeof agent.conf.environment === "string") {
41
+ return agent.conf.environment;
42
+ }
43
+ return "";
44
+ }
45
+ /**
46
+ * Check if a transaction is a no-op (does nothing).
47
+ *
48
+ * In v3: transaction can be null
49
+ * In v4: transaction is never null, but can be a no-op with ended: true
50
+ *
51
+ * @param transaction The transaction to check
52
+ * @returns true if the transaction is a no-op or null
53
+ */
54
+ function isTransactionNoOp(transaction) {
55
+ // v3: null or undefined means no transaction
56
+ if (transaction === null || transaction === undefined) {
57
+ return true;
58
+ }
59
+ // v4: no-op transactions have ended: true
60
+ // Check if the transaction is already ended (indicates no-op)
61
+ if (typeof transaction === "object" && transaction.ended === true) {
62
+ return true;
63
+ }
64
+ return false;
65
+ }
66
+ /**
67
+ * Check if a span is a no-op (does nothing).
68
+ *
69
+ * In v3: span can be null
70
+ * In v4: span can be null or a no-op
71
+ *
72
+ * @param span The span to check
73
+ * @returns true if the span is a no-op or null
74
+ */
75
+ function isSpanNoOp(span) {
76
+ // v3: null or undefined means no span
77
+ if (span === null || span === undefined) {
78
+ return true;
79
+ }
80
+ // v4: no-op spans have ended: true
81
+ if (typeof span === "object" && span.ended === true) {
82
+ return true;
83
+ }
84
+ return false;
85
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vtvlive/interactive-apm",
3
- "version": "0.0.5",
3
+ "version": "0.0.6",
4
4
  "description": "APM integration package supporting both Elastic APM and OpenTelemetry with NestJS integration",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -48,7 +48,7 @@
48
48
  "@opentelemetry/sdk-node": ">=0.200.0",
49
49
  "@opentelemetry/sdk-trace-base": ">=1.0.0",
50
50
  "@opentelemetry/semantic-conventions": ">=1.0.0",
51
- "elastic-apm-node": ">=3.0.0"
51
+ "elastic-apm-node": ">=3.0.0 <5.0.0"
52
52
  },
53
53
  "peerDependenciesMeta": {
54
54
  "@nestjs/common": {