@monocle-app/agent 1.0.0-beta.1 → 1.0.0-beta.2

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.
package/README.md CHANGED
@@ -121,12 +121,12 @@ export default defineConfig({
121
121
 
122
122
  ## Environment Variables
123
123
 
124
- | Variable | Description | Required |
125
- |----------|-------------|----------|
126
- | `MONOCLE_API_KEY` | Your Monocle API key | Yes |
127
- | `APP_NAME` | Service name for identification | Yes |
128
- | `APP_VERSION` | Service version (e.g., git sha, semver) | Yes |
129
- | `APP_ENV` | Environment: `development`, `staging`, or `production` | Yes |
124
+ | Variable | Description | Required |
125
+ | ----------------- | ------------------------------------------------------ | -------- |
126
+ | `MONOCLE_API_KEY` | Your Monocle API key | Yes |
127
+ | `APP_NAME` | Service name for identification | Yes |
128
+ | `APP_VERSION` | Service version (e.g., git sha, semver) | Yes |
129
+ | `APP_ENV` | Environment: `development`, `staging`, or `production` | Yes |
130
130
 
131
131
  ## License
132
132
 
package/dist/init.mjs CHANGED
@@ -1,4 +1,5 @@
1
1
  import { register } from "node:module";
2
+ import { pathToFileURL } from "node:url";
2
3
  import { join } from "node:path";
3
4
  import { createAddHookMessageChannel } from "import-in-the-middle";
4
5
 
@@ -14,8 +15,8 @@ const DEFAULT_BATCH_CONFIG = {
14
15
  maxQueueSize: 2048
15
16
  };
16
17
  async function loadConfig(path) {
17
- return await import(path).then((mod) => mod.default || mod).catch((error) => {
18
- throw new Error(`Failed to load Monocle config file at "${path}": ${error.message}`);
18
+ return await import(pathToFileURL(path).href).then((mod) => mod.default || mod).catch((error) => {
19
+ throw new Error(`Failed to load Monocle config file at "${path}"`, { cause: error });
19
20
  });
20
21
  }
21
22
  function setupHooks() {
@@ -1,6 +1,6 @@
1
1
  import { SpanStatusCode } from "@opentelemetry/api";
2
- import OtelMiddleware from "@adonisjs/otel/otel_middleware";
3
2
  import { getCurrentSpan } from "@adonisjs/otel/helpers";
3
+ import OtelMiddleware from "@adonisjs/otel/otel_middleware";
4
4
  import { OtelManager } from "@adonisjs/otel";
5
5
  import { ExceptionHandler } from "@adonisjs/core/http";
6
6
  import { configProvider } from "@adonisjs/core";
@@ -1,3 +1,5 @@
1
+ import { UserContextResult } from "@adonisjs/otel/types";
2
+
1
3
  //#region src/monocle.d.ts
2
4
  interface CaptureExceptionContext {
3
5
  user?: {
@@ -20,11 +22,7 @@ declare class Monocle {
20
22
  /**
21
23
  * Set user information on the current active span.
22
24
  */
23
- static setUser(user: {
24
- id: string;
25
- email?: string;
26
- name?: string;
27
- }): void;
25
+ static setUser(user: UserContextResult): void;
28
26
  }
29
27
  //#endregion
30
28
  export { Monocle };
@@ -1,4 +1,5 @@
1
1
  import { SpanStatusCode, trace } from "@opentelemetry/api";
2
+ import { setUser } from "@adonisjs/otel/helpers";
2
3
 
3
4
  //#region src/monocle.ts
4
5
  /**
@@ -30,11 +31,7 @@ var Monocle = class {
30
31
  * Set user information on the current active span.
31
32
  */
32
33
  static setUser(user) {
33
- const span = trace.getActiveSpan();
34
- if (!span) return;
35
- span.setAttribute("user.id", user.id);
36
- if (user.email) span.setAttribute("user.email", user.email);
37
- if (user.name) span.setAttribute("user.name", user.name);
34
+ setUser(user);
38
35
  }
39
36
  };
40
37
 
@@ -70,6 +70,12 @@ interface MonocleConfig extends Omit<OtelConfig, 'traceExporter' | 'metricExport
70
70
  * Format: mk_live_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
71
71
  */
72
72
  apiKey?: string;
73
+ /**
74
+ * Ignore OPTIONS (CORS preflight) requests.
75
+ * These requests are typically not useful for tracing.
76
+ * @default true
77
+ */
78
+ ignoreOptionsRequests?: boolean;
73
79
  /**
74
80
  * Monocle ingestion endpoint.
75
81
  * @default 'https://ingest.monocle.adonisjs.com'
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@monocle-app/agent",
3
- "version": "1.0.0-beta.1",
3
+ "version": "1.0.0-beta.2",
4
4
  "description": "Monocle agent for AdonisJS - sends telemetry to Monocle cloud",
5
5
  "keywords": [
6
6
  "adonisjs",
@@ -11,13 +11,13 @@
11
11
  ],
12
12
  "license": "ISC",
13
13
  "author": "Julien Ripouteau <julien@ripouteau.com>",
14
+ "files": [
15
+ "dist"
16
+ ],
14
17
  "type": "module",
15
18
  "main": "./dist/index.mjs",
16
19
  "module": "./dist/index.mjs",
17
20
  "types": "./dist/index.d.mts",
18
- "files": [
19
- "dist"
20
- ],
21
21
  "exports": {
22
22
  ".": {
23
23
  "dev": "./index.ts",
@@ -38,7 +38,6 @@
38
38
  "./package.json": "./package.json"
39
39
  },
40
40
  "publishConfig": {
41
- "tag": "beta",
42
41
  "access": "public",
43
42
  "exports": {
44
43
  ".": "./dist/index.mjs",
@@ -46,7 +45,8 @@
46
45
  "./monocle_middleware": "./dist/monocle_middleware.mjs",
47
46
  "./monocle_provider": "./dist/monocle_provider.mjs",
48
47
  "./package.json": "./package.json"
49
- }
48
+ },
49
+ "tag": "beta"
50
50
  },
51
51
  "scripts": {
52
52
  "build": "tsdown",
@@ -56,13 +56,15 @@
56
56
  "prepublishOnly": "pnpm run build"
57
57
  },
58
58
  "dependencies": {
59
- "@adonisjs/otel": "1.0.0",
59
+ "@adonisjs/otel": "1.1.0",
60
60
  "@opentelemetry/api": "^1.9.0",
61
+ "@opentelemetry/core": "^2.2.0",
61
62
  "@opentelemetry/exporter-metrics-otlp-http": "^0.208.0",
62
63
  "@opentelemetry/exporter-trace-otlp-http": "^0.208.0",
63
64
  "@opentelemetry/host-metrics": "^0.38.0",
64
65
  "@opentelemetry/sdk-metrics": "^2.2.0",
65
66
  "@opentelemetry/sdk-trace-base": "^2.2.0",
67
+ "@opentelemetry/semantic-conventions": "^1.38.0",
66
68
  "import-in-the-middle": "^2.0.1"
67
69
  },
68
70
  "devDependencies": {
@@ -73,5 +75,5 @@
73
75
  "peerDependencies": {
74
76
  "@adonisjs/core": "^6.2.0 || ^7.0.0"
75
77
  },
76
- "packageManager": "pnpm@10.26.1"
78
+ "packageManager": "pnpm@10.26.2"
77
79
  }