@vtvlive/interactive-apm 0.0.11 → 0.0.12

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":"opentelemetry-init.d.ts","sourceRoot":"","sources":["../../src/init/opentelemetry-init.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAGH,OAAO,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAC;AAgE7D,MAAM,WAAW,wBAAwB;IACvC,2BAA2B;IAC3B,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,wBAAwB;IACxB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,sCAAsC;IACtC,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,mEAAmE;IACnE,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,mHAAmH;IACnH,WAAW,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACrC,sBAAsB;IACtB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,6BAA6B;IAC7B,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,4CAA4C;IAC5C,qBAAqB,CAAC,EAAE,OAAO,CAAC;IAChC,kCAAkC;IAClC,yBAAyB,CAAC,EAAE,OAAO,CAAC;IACpC,qCAAqC;IACrC,4BAA4B,CAAC,EAAE,OAAO,CAAC;IACvC,8DAA8D;IAC9D,aAAa,CAAC,EAAE,aAAa,GAAG,MAAM,CAAC;CACxC;AAED;;;GAGG;AACH,wBAAgB,sBAAsB,IAAI,OAAO,CAGhD;AAwCD;;;;;GAKG;AACH,wBAAsB,iBAAiB,CAAC,OAAO,GAAE,wBAA6B,GAAG,OAAO,CAAC;IACvF,KAAK,IAAI,IAAI,CAAC;IACd,QAAQ,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;IAC1B,KAAK,CAAC,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;CACzB,CAAC,CAuND"}
1
+ {"version":3,"file":"opentelemetry-init.d.ts","sourceRoot":"","sources":["../../src/init/opentelemetry-init.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAGH,OAAO,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAC;AAgE7D,MAAM,WAAW,wBAAwB;IACvC,2BAA2B;IAC3B,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,wBAAwB;IACxB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,sCAAsC;IACtC,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,mEAAmE;IACnE,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,mHAAmH;IACnH,WAAW,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACrC,sBAAsB;IACtB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,6BAA6B;IAC7B,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,4CAA4C;IAC5C,qBAAqB,CAAC,EAAE,OAAO,CAAC;IAChC,kCAAkC;IAClC,yBAAyB,CAAC,EAAE,OAAO,CAAC;IACpC,qCAAqC;IACrC,4BAA4B,CAAC,EAAE,OAAO,CAAC;IACvC,8DAA8D;IAC9D,aAAa,CAAC,EAAE,aAAa,GAAG,MAAM,CAAC;CACxC;AAED;;;GAGG;AACH,wBAAgB,sBAAsB,IAAI,OAAO,CAGhD;AAwCD;;;;;GAKG;AACH,wBAAsB,iBAAiB,CAAC,OAAO,GAAE,wBAA6B,GAAG,OAAO,CAAC;IACvF,KAAK,IAAI,IAAI,CAAC;IACd,QAAQ,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;IAC1B,KAAK,CAAC,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;CACzB,CAAC,CAyND"}
@@ -163,7 +163,12 @@ async function initOpenTelemetry(options = {}) {
163
163
  const { NodeSDK } = (await Promise.resolve().then(() => __importStar(require("@opentelemetry/sdk-node"))));
164
164
  // @ts-ignore - Optional peer dependency
165
165
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
166
- const { resourceFromAttributes } = (await Promise.resolve().then(() => __importStar(require("@opentelemetry/resources"))));
166
+ const resourceMod = (await Promise.resolve().then(() => __importStar(require("@opentelemetry/resources"))));
167
+ // Compat: resourceFromAttributes was introduced in v1.9.0; older versions use `new Resource(attrs)`
168
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
169
+ const buildResource = (attrs) => typeof resourceMod.resourceFromAttributes === "function"
170
+ ? resourceMod.resourceFromAttributes(attrs)
171
+ : new resourceMod.Resource(attrs);
167
172
  const serviceName = options.serviceName || process.env.ELASTIC_APM_SERVICE_NAME || "interactive-backend";
168
173
  const environment = options.environment || process.env.ELASTIC_APM_ENVIRONMENT || "development";
169
174
  // Determine transport type (HTTP, gRPC, or PROTO)
@@ -259,20 +264,16 @@ async function initOpenTelemetry(options = {}) {
259
264
  const { ExpressInstrumentation } = await Promise.resolve().then(() => __importStar(require("@opentelemetry/instrumentation-express")));
260
265
  instrumentations.push(new ExpressInstrumentation());
261
266
  }
262
- console.log("[DEBUG] About to load Redis instrumentation...");
263
267
  try {
264
268
  const { IORedisInstrumentation } = await Promise.resolve().then(() => __importStar(require("@opentelemetry/instrumentation-ioredis")));
265
- console.log("[DEBUG] Redis import successful");
266
269
  instrumentations.push(new IORedisInstrumentation());
267
- console.log("[DEBUG] Redis instrumentation added");
268
270
  (0, debug_logger_1.infoLog)("[OpenTelemetry] Redis instrumentation enabled");
269
271
  }
270
- catch (err) {
271
- console.error("[DEBUG] Redis instrumentation failed:", err);
272
+ catch {
272
273
  (0, debug_logger_1.infoLog)("[OpenTelemetry] Redis instrumentation not available");
273
274
  }
274
275
  // Resource attributes
275
- const sdkResource = resourceFromAttributes({
276
+ const sdkResource = buildResource({
276
277
  "service.name": serviceName,
277
278
  "deployment.environment": environment,
278
279
  "service.version": options.serviceVersion || process.env.npm_package_version || "1.0.0",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vtvlive/interactive-apm",
3
- "version": "0.0.11",
3
+ "version": "0.0.12",
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",