@monocle.sh/adonisjs-agent 1.4.0 → 1.4.1

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.
@@ -10,9 +10,21 @@ import { configProvider } from "@adonisjs/core";
10
10
  * option from @adonis/otel so we can remove this file in the future.
11
11
  */
12
12
  var OtelProvider = class {
13
+ #hasLoggedShutdownError = false;
13
14
  constructor(app) {
14
15
  this.app = app;
15
16
  }
17
+ #getShutdownErrorMessage(error) {
18
+ if (error instanceof Error && error.message) return error.message;
19
+ return String(error);
20
+ }
21
+ #logShutdownError(error) {
22
+ if (this.#hasLoggedShutdownError) return;
23
+ this.#hasLoggedShutdownError = true;
24
+ const message = this.#getShutdownErrorMessage(error);
25
+ const hint = message.toLowerCase().includes("unauthorized") ? " Check your Monocle API key or subscription." : "";
26
+ console.warn(`[monocle] Failed to flush telemetry during shutdown: ${message}. Your app continued normally, but telemetry was not sent.${hint}`);
27
+ }
16
28
  /**
17
29
  * Hook into ExceptionHandler to record exceptions as LogRecords.
18
30
  *
@@ -58,7 +70,7 @@ var OtelProvider = class {
58
70
  * Gracefully flush pending spans
59
71
  */
60
72
  async shutdown() {
61
- await OtelManager.getInstance()?.shutdown();
73
+ await OtelManager.getInstance()?.shutdown().catch((error) => this.#logShutdownError(error));
62
74
  }
63
75
  };
64
76
  //#endregion
@@ -10,7 +10,7 @@ const DEFAULT_BATCH_CONFIG = {
10
10
  maxQueueSize: 2048
11
11
  };
12
12
  function resolveSdkVersion() {
13
- return "1.4.0";
13
+ return "1.4.1";
14
14
  }
15
15
  function buildNodejsResourceAttributes() {
16
16
  const attributes = {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@monocle.sh/adonisjs-agent",
3
- "version": "1.4.0",
3
+ "version": "1.4.1",
4
4
  "description": "Monocle agent for AdonisJS - sends telemetry to Monocle cloud",
5
5
  "keywords": [
6
6
  "adonisjs",
@@ -56,11 +56,11 @@
56
56
  "@sindresorhus/is": "^7.2.0",
57
57
  "error-stack-parser-es": "^1.0.5",
58
58
  "import-in-the-middle": "^3.0.1",
59
- "@monocle.sh/instrumentation-bullmq": "^0.4.0",
60
- "@monocle.sh/instrumentation-mastra": "^0.2.0",
61
- "@monocle.sh/instrumentation-mcp": "^1.0.1",
62
- "@monocle.sh/instrumentation-vercel-ai": "^1.1.3",
63
- "@monocle.sh/otel-utils": "^1.2.0"
59
+ "@monocle.sh/instrumentation-bullmq": "^0.4.1",
60
+ "@monocle.sh/instrumentation-mcp": "^1.0.2",
61
+ "@monocle.sh/instrumentation-mastra": "^0.2.1",
62
+ "@monocle.sh/instrumentation-vercel-ai": "^1.1.4",
63
+ "@monocle.sh/otel-utils": "^1.3.0"
64
64
  },
65
65
  "devDependencies": {
66
66
  "@adonisjs/core": "^7.3.2",