@monocle.sh/adonisjs-agent 1.2.3 → 1.3.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.
- package/dist/_virtual/_rolldown/runtime.mjs +28 -0
- package/dist/index.d.mts +1 -3
- package/dist/src/define_config.mjs +17 -44
- package/dist/src/exception_reporter.mjs +1 -1
- package/dist/src/http_instrumentation_config.mjs +196 -0
- package/dist/src/monocle.mjs +1 -1
- package/dist/src/types/config.d.mts +39 -3
- package/dist/src/types/main.d.mts +11 -2
- package/dist/stubs/config.stub +5 -0
- package/dist/types.d.mts +12 -3
- package/package.json +3 -3
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import "node:module";
|
|
2
|
+
//#region \0rolldown/runtime.js
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __exportAll = (all, no_symbols) => {
|
|
8
|
+
let target = {};
|
|
9
|
+
for (var name in all) __defProp(target, name, {
|
|
10
|
+
get: all[name],
|
|
11
|
+
enumerable: true
|
|
12
|
+
});
|
|
13
|
+
if (!no_symbols) __defProp(target, Symbol.toStringTag, { value: "Module" });
|
|
14
|
+
return target;
|
|
15
|
+
};
|
|
16
|
+
var __copyProps = (to, from, except, desc) => {
|
|
17
|
+
if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
|
|
18
|
+
key = keys[i];
|
|
19
|
+
if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
20
|
+
get: ((k) => from[k]).bind(null, key),
|
|
21
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
return to;
|
|
25
|
+
};
|
|
26
|
+
var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
|
|
27
|
+
//#endregion
|
|
28
|
+
export { __exportAll, __reExport };
|
package/dist/index.d.mts
CHANGED
|
@@ -1,9 +1,7 @@
|
|
|
1
|
-
import { BatchConfig, CliTracingConfig, HostMetricsConfig, MonocleConfig } from "./src/types/config.mjs";
|
|
2
1
|
import { defineConfig } from "./src/define_config.mjs";
|
|
3
|
-
import { SpanAllOptions, SpanOptions } from "./src/types/decorators.mjs";
|
|
4
2
|
import { Monocle } from "./src/monocle.mjs";
|
|
5
3
|
import { configure } from "./configure.mjs";
|
|
6
4
|
import { extractTraceContext, getCurrentSpan, handleError, injectTraceContext, otelLoggingPreset, record, recordEvent, setAttributes } from "./helpers.mjs";
|
|
7
5
|
import { span, spanAll } from "./decorators.mjs";
|
|
8
6
|
import { destinations } from "@adonisjs/otel";
|
|
9
|
-
export {
|
|
7
|
+
export { Monocle, configure, defineConfig, destinations, extractTraceContext, getCurrentSpan, handleError, injectTraceContext, otelLoggingPreset, record, recordEvent, setAttributes, span, spanAll };
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { buildHttpInstrumentationConfig } from "./http_instrumentation_config.mjs";
|
|
1
2
|
import { destinations } from "@adonisjs/otel";
|
|
2
3
|
//#region src/define_config.ts
|
|
3
4
|
const DEFAULT_BATCH_CONFIG = {
|
|
@@ -6,46 +7,17 @@ const DEFAULT_BATCH_CONFIG = {
|
|
|
6
7
|
exportTimeoutMillis: 3e4,
|
|
7
8
|
maxQueueSize: 2048
|
|
8
9
|
};
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
*/
|
|
12
|
-
function getHeader(response, name) {
|
|
13
|
-
if ("getHeader" in response && typeof response.getHeader === "function") {
|
|
14
|
-
const value = response.getHeader(name);
|
|
15
|
-
if (typeof value === "string") return value;
|
|
16
|
-
}
|
|
17
|
-
if ("headers" in response && response.headers) {
|
|
18
|
-
const value = response.headers[name];
|
|
19
|
-
if (typeof value === "string") return value;
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
/**
|
|
23
|
-
* Detects the connection type based on response headers.
|
|
24
|
-
* Returns 'sse' for Server-Sent Events, 'websocket' for WebSocket upgrades,
|
|
25
|
-
* or undefined for standard HTTP connections.
|
|
26
|
-
*/
|
|
27
|
-
function detectConnectionType(response) {
|
|
28
|
-
if (getHeader(response, "content-type")?.includes("text/event-stream")) return "sse";
|
|
29
|
-
if (getHeader(response, "upgrade")?.toLowerCase() === "websocket") return "websocket";
|
|
10
|
+
function resolveSdkVersion() {
|
|
11
|
+
return "1.3.0";
|
|
30
12
|
}
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
function createConnectionTypeHook(userHook) {
|
|
36
|
-
return (span, response) => {
|
|
37
|
-
const connectionType = detectConnectionType(response);
|
|
38
|
-
if (connectionType) span.setAttribute("http.connection_type", connectionType);
|
|
39
|
-
userHook?.(span, response);
|
|
13
|
+
function buildNodejsResourceAttributes() {
|
|
14
|
+
const attributes = {
|
|
15
|
+
"monocle.language.name": "javascript",
|
|
16
|
+
"monocle.framework.name": "adonisjs"
|
|
40
17
|
};
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
*/
|
|
45
|
-
function extractUserResponseHook(httpConfig) {
|
|
46
|
-
if (typeof httpConfig !== "object" || httpConfig === null) return;
|
|
47
|
-
if (!("responseHook" in httpConfig)) return;
|
|
48
|
-
return httpConfig.responseHook;
|
|
18
|
+
const sdkVersion = resolveSdkVersion();
|
|
19
|
+
if (sdkVersion) attributes["telemetry.sdk.version"] = sdkVersion;
|
|
20
|
+
return attributes;
|
|
49
21
|
}
|
|
50
22
|
/**
|
|
51
23
|
* Define and validate Monocle agent configuration.
|
|
@@ -66,14 +38,14 @@ function defineConfig(config) {
|
|
|
66
38
|
...isDev ? devBatchConfig : DEFAULT_BATCH_CONFIG,
|
|
67
39
|
...config.batch
|
|
68
40
|
};
|
|
69
|
-
const
|
|
70
|
-
const
|
|
41
|
+
const httpInstrumentationConfig = buildHttpInstrumentationConfig(config);
|
|
42
|
+
const resourceAttributes = {
|
|
43
|
+
...buildNodejsResourceAttributes(),
|
|
44
|
+
...config.resourceAttributes
|
|
45
|
+
};
|
|
71
46
|
const instrumentations = {
|
|
72
47
|
...config.instrumentations,
|
|
73
|
-
"@opentelemetry/instrumentation-http": {
|
|
74
|
-
...typeof httpConfig === "object" && httpConfig !== null ? httpConfig : {},
|
|
75
|
-
responseHook: createConnectionTypeHook(userResponseHook)
|
|
76
|
-
}
|
|
48
|
+
"@opentelemetry/instrumentation-http": { ...httpInstrumentationConfig }
|
|
77
49
|
};
|
|
78
50
|
const headers = { "x-monocle-env": environment };
|
|
79
51
|
if (config.apiKey) headers["x-api-key"] = config.apiKey;
|
|
@@ -91,6 +63,7 @@ function defineConfig(config) {
|
|
|
91
63
|
...config,
|
|
92
64
|
endpoint,
|
|
93
65
|
environment,
|
|
66
|
+
resourceAttributes,
|
|
94
67
|
instrumentations,
|
|
95
68
|
destinations: {
|
|
96
69
|
...config.destinations,
|
|
@@ -0,0 +1,196 @@
|
|
|
1
|
+
import { HttpBodyCapture, HttpUrlSanitizer } from "@monocle.sh/otel-utils";
|
|
2
|
+
//#region src/http_instrumentation_config.ts
|
|
3
|
+
/**
|
|
4
|
+
* Builds the effective HTTP instrumentation config used by the Adonis agent.
|
|
5
|
+
*/
|
|
6
|
+
var HttpInstrumentationConfigBuilder = class {
|
|
7
|
+
#config;
|
|
8
|
+
#httpConfig;
|
|
9
|
+
constructor(config) {
|
|
10
|
+
this.#config = config;
|
|
11
|
+
this.#httpConfig = this.#resolveHttpConfig();
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Resolves the effective HTTP config, with low-level instrumentation overrides winning.
|
|
15
|
+
*/
|
|
16
|
+
#resolveHttpConfig() {
|
|
17
|
+
const topLevelHttpConfig = this.#config.http;
|
|
18
|
+
const instrumentationHttpConfig = this.#config.instrumentations?.["@opentelemetry/instrumentation-http"];
|
|
19
|
+
if (instrumentationHttpConfig?.enabled === false) return instrumentationHttpConfig;
|
|
20
|
+
if (typeof instrumentationHttpConfig === "object" && instrumentationHttpConfig !== null) {
|
|
21
|
+
if (topLevelHttpConfig === false) return instrumentationHttpConfig;
|
|
22
|
+
if (typeof topLevelHttpConfig !== "object" || topLevelHttpConfig === null) return instrumentationHttpConfig;
|
|
23
|
+
return {
|
|
24
|
+
...topLevelHttpConfig,
|
|
25
|
+
...instrumentationHttpConfig
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
if (topLevelHttpConfig === false) return topLevelHttpConfig;
|
|
29
|
+
if (typeof topLevelHttpConfig !== "object" || topLevelHttpConfig === null) return instrumentationHttpConfig;
|
|
30
|
+
return topLevelHttpConfig;
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Reads custom URL sanitization rules from the effective config.
|
|
34
|
+
*/
|
|
35
|
+
#resolveHttpUrlConfig() {
|
|
36
|
+
if (typeof this.#httpConfig !== "object" || this.#httpConfig === null) return;
|
|
37
|
+
return this.#httpConfig.sanitizeUrls;
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Reads custom body capture rules from the effective config.
|
|
41
|
+
*/
|
|
42
|
+
#resolveHttpBodyConfig() {
|
|
43
|
+
if (typeof this.#httpConfig !== "object" || this.#httpConfig === null) return;
|
|
44
|
+
return this.#httpConfig.captureBodies;
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Determines whether HTTP instrumentation should remain enabled.
|
|
48
|
+
*/
|
|
49
|
+
#resolveEnabled() {
|
|
50
|
+
if (this.#httpConfig === false) return false;
|
|
51
|
+
if (typeof this.#httpConfig !== "object" || this.#httpConfig === null) return true;
|
|
52
|
+
if ("enabled" in this.#httpConfig && this.#httpConfig.enabled === false) return false;
|
|
53
|
+
return true;
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* Returns the object-shaped portion of the effective config for spreading into the final config.
|
|
57
|
+
*/
|
|
58
|
+
#getObjectConfig() {
|
|
59
|
+
if (typeof this.#httpConfig !== "object" || this.#httpConfig === null) return {};
|
|
60
|
+
return this.#httpConfig;
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* Extracts a user-defined request hook from the effective config.
|
|
64
|
+
*/
|
|
65
|
+
#extractUserRequestHook() {
|
|
66
|
+
if (typeof this.#httpConfig !== "object" || this.#httpConfig === null) return;
|
|
67
|
+
if (!("requestHook" in this.#httpConfig)) return;
|
|
68
|
+
return this.#httpConfig.requestHook;
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* Extracts a user-defined response hook from the effective config.
|
|
72
|
+
*/
|
|
73
|
+
#extractUserResponseHook() {
|
|
74
|
+
if (typeof this.#httpConfig !== "object" || this.#httpConfig === null) return;
|
|
75
|
+
if (!("responseHook" in this.#httpConfig)) return;
|
|
76
|
+
return this.#httpConfig.responseHook;
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* Extracts a user-defined custom-attributes hook from the effective config.
|
|
80
|
+
*/
|
|
81
|
+
#extractUserApplyCustomAttributesOnSpan() {
|
|
82
|
+
if (typeof this.#httpConfig !== "object" || this.#httpConfig === null) return;
|
|
83
|
+
if (!("applyCustomAttributesOnSpan" in this.#httpConfig)) return;
|
|
84
|
+
return this.#httpConfig.applyCustomAttributesOnSpan;
|
|
85
|
+
}
|
|
86
|
+
/**
|
|
87
|
+
* Extracts a header value from either ServerResponse or IncomingMessage.
|
|
88
|
+
*/
|
|
89
|
+
#getHeader(response, name) {
|
|
90
|
+
if ("getHeader" in response && typeof response.getHeader === "function") {
|
|
91
|
+
const value = response.getHeader(name);
|
|
92
|
+
if (typeof value === "string") return value;
|
|
93
|
+
}
|
|
94
|
+
if ("headers" in response && response.headers) {
|
|
95
|
+
const value = response.headers[name];
|
|
96
|
+
if (typeof value === "string") return value;
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
/**
|
|
100
|
+
* Detects whether the response is an SSE or websocket connection.
|
|
101
|
+
*/
|
|
102
|
+
#detectConnectionType(response) {
|
|
103
|
+
if (this.#getHeader(response, "content-type")?.includes("text/event-stream")) return "sse";
|
|
104
|
+
if (this.#getHeader(response, "upgrade")?.toLowerCase() === "websocket") return "websocket";
|
|
105
|
+
}
|
|
106
|
+
/**
|
|
107
|
+
* Builds the hook that tags long-lived HTTP connections.
|
|
108
|
+
*/
|
|
109
|
+
#createConnectionTypeHook(userHook) {
|
|
110
|
+
return (span, response) => {
|
|
111
|
+
const connectionType = this.#detectConnectionType(response);
|
|
112
|
+
if (connectionType) span.setAttribute("http.connection_type", connectionType);
|
|
113
|
+
userHook?.(span, response);
|
|
114
|
+
};
|
|
115
|
+
}
|
|
116
|
+
/**
|
|
117
|
+
* Builds the effective request hook with URL sanitization, body capture, and user hooks.
|
|
118
|
+
*/
|
|
119
|
+
#createRequestHook(options) {
|
|
120
|
+
const bodyCaptureHook = options.bodyCapture.createRequestHook();
|
|
121
|
+
if (!bodyCaptureHook && !options.userHook && !options.urlSanitizationEnabled) return;
|
|
122
|
+
return (span, request) => {
|
|
123
|
+
options.urlSanitizer.sanitizeSpanFromRequest({
|
|
124
|
+
span,
|
|
125
|
+
request
|
|
126
|
+
});
|
|
127
|
+
bodyCaptureHook?.(span, request);
|
|
128
|
+
options.userHook?.(span, request);
|
|
129
|
+
};
|
|
130
|
+
}
|
|
131
|
+
/**
|
|
132
|
+
* Builds the effective response hook with body capture and connection tagging.
|
|
133
|
+
*/
|
|
134
|
+
#createResponseHook(options) {
|
|
135
|
+
const bodyCaptureHook = options.bodyCapture.createResponseHook();
|
|
136
|
+
const connectionTypeHook = this.#createConnectionTypeHook(options.userHook);
|
|
137
|
+
if (!bodyCaptureHook && !options.userHook) return connectionTypeHook;
|
|
138
|
+
return (span, response) => {
|
|
139
|
+
bodyCaptureHook?.(span, response);
|
|
140
|
+
connectionTypeHook(span, response);
|
|
141
|
+
};
|
|
142
|
+
}
|
|
143
|
+
/**
|
|
144
|
+
* Builds the hook that flushes body capture before the span closes.
|
|
145
|
+
*/
|
|
146
|
+
#createApplyCustomAttributesOnSpan(options) {
|
|
147
|
+
return (span, request, response) => {
|
|
148
|
+
options.bodyCapture.applyCustomAttributesOnSpan({
|
|
149
|
+
span,
|
|
150
|
+
request,
|
|
151
|
+
response
|
|
152
|
+
});
|
|
153
|
+
options.userHook?.(span, request, response);
|
|
154
|
+
};
|
|
155
|
+
}
|
|
156
|
+
/**
|
|
157
|
+
* Produces the final HTTP instrumentation config consumed by Adonis OTel.
|
|
158
|
+
*/
|
|
159
|
+
build() {
|
|
160
|
+
const enabled = this.#resolveEnabled();
|
|
161
|
+
const baseConfig = this.#getObjectConfig();
|
|
162
|
+
if (!enabled) return {
|
|
163
|
+
...baseConfig,
|
|
164
|
+
enabled: false
|
|
165
|
+
};
|
|
166
|
+
const bodyCapture = new HttpBodyCapture(this.#resolveHttpBodyConfig());
|
|
167
|
+
const urlConfig = this.#resolveHttpUrlConfig();
|
|
168
|
+
const urlSanitizer = new HttpUrlSanitizer(urlConfig);
|
|
169
|
+
return {
|
|
170
|
+
...baseConfig,
|
|
171
|
+
enabled: true,
|
|
172
|
+
requestHook: this.#createRequestHook({
|
|
173
|
+
bodyCapture,
|
|
174
|
+
urlSanitizer,
|
|
175
|
+
urlSanitizationEnabled: urlConfig !== void 0,
|
|
176
|
+
userHook: this.#extractUserRequestHook()
|
|
177
|
+
}),
|
|
178
|
+
responseHook: this.#createResponseHook({
|
|
179
|
+
bodyCapture,
|
|
180
|
+
userHook: this.#extractUserResponseHook()
|
|
181
|
+
}),
|
|
182
|
+
applyCustomAttributesOnSpan: this.#createApplyCustomAttributesOnSpan({
|
|
183
|
+
bodyCapture,
|
|
184
|
+
userHook: this.#extractUserApplyCustomAttributesOnSpan()
|
|
185
|
+
})
|
|
186
|
+
};
|
|
187
|
+
}
|
|
188
|
+
};
|
|
189
|
+
/**
|
|
190
|
+
* Builds the effective HTTP instrumentation config from top-level and low-level options.
|
|
191
|
+
*/
|
|
192
|
+
function buildHttpInstrumentationConfig(config) {
|
|
193
|
+
return new HttpInstrumentationConfigBuilder(config).build();
|
|
194
|
+
}
|
|
195
|
+
//#endregion
|
|
196
|
+
export { buildHttpInstrumentationConfig };
|
package/dist/src/monocle.mjs
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { ExceptionReporter } from "./exception_reporter.mjs";
|
|
2
|
+
import { extractContextLines } from "@monocle.sh/otel-utils";
|
|
2
3
|
import { randomUUID } from "node:crypto";
|
|
3
4
|
import { trace } from "@opentelemetry/api";
|
|
4
5
|
import { SeverityNumber, logs } from "@opentelemetry/api-logs";
|
|
5
6
|
import { setUser } from "@adonisjs/otel/helpers";
|
|
6
|
-
import { extractContextLines } from "@monocle.sh/otel-utils";
|
|
7
7
|
//#region src/monocle.ts
|
|
8
8
|
const DEFAULT_CONTEXT_LINES = 7;
|
|
9
9
|
const LOGGER_NAME = "@monocle.sh/agent";
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
+
import { HttpBodyCaptureConfig, HttpUrlSanitizationConfig } from "@monocle.sh/otel-utils";
|
|
1
2
|
import { BentoCacheInstrumentationConfig } from "@bentocache/otel/types";
|
|
2
|
-
import { DestinationMap, OtelConfig } from "@adonisjs/otel/types";
|
|
3
|
+
import { DestinationMap, HttpInstrumentationConfig, InstrumentationsConfig, OtelConfig } from "@adonisjs/otel/types";
|
|
3
4
|
import { BullMQInstrumentationConfig } from "@monocle.sh/instrumentation-bullmq";
|
|
4
5
|
|
|
5
6
|
//#region src/types/config.d.ts
|
|
@@ -103,7 +104,32 @@ interface AiInstrumentationConfig {
|
|
|
103
104
|
recordOutputs?: boolean;
|
|
104
105
|
}
|
|
105
106
|
type BullMQAgentConfig = BullMQInstrumentationConfig;
|
|
106
|
-
|
|
107
|
+
/**
|
|
108
|
+
* Extended HTTP instrumentation config consumed by the Monocle agent.
|
|
109
|
+
*/
|
|
110
|
+
interface MonocleHttpInstrumentationConfig extends HttpInstrumentationConfig {
|
|
111
|
+
/**
|
|
112
|
+
* URL sanitization rules applied before HTTP spans are exported.
|
|
113
|
+
*/
|
|
114
|
+
sanitizeUrls?: false | HttpUrlSanitizationConfig;
|
|
115
|
+
/**
|
|
116
|
+
* HTTP body capture rules for request and response payloads.
|
|
117
|
+
*/
|
|
118
|
+
captureBodies?: false | HttpBodyCaptureConfig;
|
|
119
|
+
}
|
|
120
|
+
/**
|
|
121
|
+
* Instrumentation map extended with Monocle's HTTP instrumentation options.
|
|
122
|
+
*/
|
|
123
|
+
type BaseInstrumentationValue = NonNullable<InstrumentationsConfig>[string & {}];
|
|
124
|
+
type MonocleInstrumentationsConfig = Omit<NonNullable<InstrumentationsConfig>, '@opentelemetry/instrumentation-http'> & {
|
|
125
|
+
'@opentelemetry/instrumentation-http'?: MonocleHttpInstrumentationConfig | {
|
|
126
|
+
enabled: false;
|
|
127
|
+
};
|
|
128
|
+
[key: string & {}]: BaseInstrumentationValue | MonocleHttpInstrumentationConfig | {
|
|
129
|
+
enabled: false;
|
|
130
|
+
} | undefined;
|
|
131
|
+
};
|
|
132
|
+
interface MonocleConfig extends Omit<OtelConfig, 'traceExporter' | 'metricExporter' | 'instrumentations'> {
|
|
107
133
|
/**
|
|
108
134
|
* Enable local DevTools mode.
|
|
109
135
|
* Sends telemetry to Monocle DevTools (localhost:4200) with no compression.
|
|
@@ -137,6 +163,16 @@ interface MonocleConfig extends Omit<OtelConfig, 'traceExporter' | 'metricExport
|
|
|
137
163
|
* Monocle destination is always injected automatically and cannot be removed.
|
|
138
164
|
*/
|
|
139
165
|
destinations?: DestinationMap;
|
|
166
|
+
/**
|
|
167
|
+
* Instrumentation overrides and low-level escape hatches.
|
|
168
|
+
*/
|
|
169
|
+
instrumentations?: MonocleInstrumentationsConfig;
|
|
170
|
+
/**
|
|
171
|
+
* High-level HTTP tracing configuration.
|
|
172
|
+
* This is the recommended way to configure ignored URLs, URL sanitization,
|
|
173
|
+
* and HTTP body capture.
|
|
174
|
+
*/
|
|
175
|
+
http?: false | MonocleHttpInstrumentationConfig;
|
|
140
176
|
/**
|
|
141
177
|
* Host metrics configuration (CPU, Memory, Network, etc.).
|
|
142
178
|
* Set to `false` to disable, or pass config object.
|
|
@@ -197,4 +233,4 @@ interface MonocleConfig extends Omit<OtelConfig, 'traceExporter' | 'metricExport
|
|
|
197
233
|
ai?: false | AiInstrumentationConfig;
|
|
198
234
|
}
|
|
199
235
|
//#endregion
|
|
200
|
-
export { BatchConfig, CliTracingConfig, HostMetricsConfig, MonocleConfig };
|
|
236
|
+
export { AiInstrumentationConfig, BatchConfig, BullMQAgentConfig, CacheInstrumentationConfig, CliTracingConfig, HostMetricsConfig, MailInstrumentationConfig, MonocleConfig, MonocleHttpInstrumentationConfig, MonocleInstrumentationsConfig, QueueInstrumentationConfig };
|
|
@@ -1,3 +1,12 @@
|
|
|
1
|
-
import { BatchConfig, CliTracingConfig, HostMetricsConfig, MonocleConfig } from "./config.mjs";
|
|
1
|
+
import { AiInstrumentationConfig, BatchConfig, BullMQAgentConfig, CacheInstrumentationConfig, CliTracingConfig, HostMetricsConfig, MailInstrumentationConfig, MonocleConfig, MonocleHttpInstrumentationConfig, MonocleInstrumentationsConfig, QueueInstrumentationConfig } from "./config.mjs";
|
|
2
|
+
import { CaptureContext, CaptureExceptionContext, CaptureMessageContext, MessageLevel, MonocleUser } from "./monocle.mjs";
|
|
2
3
|
import { SpanAllOptions, SpanOptions } from "./decorators.mjs";
|
|
3
|
-
|
|
4
|
+
export * from "@monocle.sh/otel-utils";
|
|
5
|
+
|
|
6
|
+
//#region src/types/main.d.ts
|
|
7
|
+
declare namespace main_d_exports {
|
|
8
|
+
export { AiInstrumentationConfig, BatchConfig, BullMQAgentConfig, CacheInstrumentationConfig, CaptureContext, CaptureExceptionContext, CaptureMessageContext, CliTracingConfig, HostMetricsConfig, MailInstrumentationConfig, MessageLevel, MonocleConfig, MonocleHttpInstrumentationConfig, MonocleInstrumentationsConfig, MonocleUser, QueueInstrumentationConfig, SpanAllOptions, SpanOptions };
|
|
9
|
+
}
|
|
10
|
+
import * as import__monocle_sh_otel_utils from "@monocle.sh/otel-utils";
|
|
11
|
+
//#endregion
|
|
12
|
+
export { import__monocle_sh_otel_utils as main_d_exports };
|
package/dist/stubs/config.stub
CHANGED
|
@@ -5,6 +5,11 @@ import { defineConfig } from '@monocle.sh/adonisjs-agent'
|
|
|
5
5
|
import env from '#start/env'
|
|
6
6
|
|
|
7
7
|
export default defineConfig({
|
|
8
|
+
/**
|
|
9
|
+
* Enable Monocle Studio for local development.
|
|
10
|
+
* @see https://docs.monocle.sh/studio/overview
|
|
11
|
+
*/
|
|
12
|
+
dev: process.env.NODE_ENV === 'development',
|
|
8
13
|
apiKey: env.get('MONOCLE_API_KEY'),
|
|
9
14
|
|
|
10
15
|
serviceName: env.get('APP_NAME'),
|
package/dist/types.d.mts
CHANGED
|
@@ -1,5 +1,14 @@
|
|
|
1
|
-
import { BatchConfig, CliTracingConfig, HostMetricsConfig, MonocleConfig } from "./src/types/config.mjs";
|
|
2
|
-
import { SpanAllOptions, SpanOptions } from "./src/types/decorators.mjs";
|
|
1
|
+
import { BatchConfig, CliTracingConfig, HostMetricsConfig, MonocleConfig, MonocleHttpInstrumentationConfig, MonocleInstrumentationsConfig } from "./src/types/config.mjs";
|
|
3
2
|
import { MonocleUser } from "./src/types/monocle.mjs";
|
|
3
|
+
import { SpanAllOptions, SpanOptions } from "./src/types/decorators.mjs";
|
|
4
|
+
import { main_d_exports } from "./src/types/main.mjs";
|
|
4
5
|
import { DestinationConfig, DestinationMap, DestinationSignal, DestinationSignals, HeadersCarrier, OtelLoggingPresetOptions, OtlpDestinationConfig, OtlpDestinationOptions, UserContextResult } from "@adonisjs/otel/types";
|
|
5
|
-
|
|
6
|
+
type HttpBodyCaptureConfig = main_d_exports.HttpBodyCaptureConfig;
|
|
7
|
+
type HttpBodyCaptureSideConfig = main_d_exports.HttpBodyCaptureSideConfig;
|
|
8
|
+
type HttpBodyInfo = main_d_exports.HttpBodyInfo;
|
|
9
|
+
type HttpBodyKind = main_d_exports.HttpBodyKind;
|
|
10
|
+
type HttpBodyRedactionConfig = main_d_exports.HttpBodyRedactionConfig;
|
|
11
|
+
type HttpBodyRedactor = main_d_exports.HttpBodyRedactor;
|
|
12
|
+
type HttpUrlSanitizationConfig = main_d_exports.HttpUrlSanitizationConfig;
|
|
13
|
+
type HttpUrlSanitizerHook = main_d_exports.HttpUrlSanitizerHook;
|
|
14
|
+
export { type BatchConfig, type CliTracingConfig, type DestinationConfig, type DestinationMap, type DestinationSignal, type DestinationSignals, type HeadersCarrier, type HostMetricsConfig, type HttpBodyCaptureConfig, type HttpBodyCaptureSideConfig, type HttpBodyInfo, type HttpBodyKind, type HttpBodyRedactionConfig, type HttpBodyRedactor, type HttpUrlSanitizationConfig, type HttpUrlSanitizerHook, type MonocleConfig, type MonocleHttpInstrumentationConfig, type MonocleInstrumentationsConfig, type MonocleUser, type OtelLoggingPresetOptions, type OtlpDestinationConfig, type OtlpDestinationOptions, type SpanAllOptions, type SpanOptions, type UserContextResult };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@monocle.sh/adonisjs-agent",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.3.0",
|
|
4
4
|
"description": "Monocle agent for AdonisJS - sends telemetry to Monocle cloud",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"adonisjs",
|
|
@@ -56,8 +56,8 @@
|
|
|
56
56
|
"import-in-the-middle": "^3.0.0",
|
|
57
57
|
"@monocle.sh/instrumentation-bullmq": "^0.3.1",
|
|
58
58
|
"@monocle.sh/instrumentation-mcp": "^1.0.1",
|
|
59
|
-
"@monocle.sh/instrumentation-vercel-ai": "^1.1.
|
|
60
|
-
"@monocle.sh/otel-utils": "^1.0
|
|
59
|
+
"@monocle.sh/instrumentation-vercel-ai": "^1.1.2",
|
|
60
|
+
"@monocle.sh/otel-utils": "^1.1.0"
|
|
61
61
|
},
|
|
62
62
|
"devDependencies": {
|
|
63
63
|
"@adonisjs/core": "^7.3.0",
|