autotel 3.7.0 → 4.1.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/README.md +26 -1
- package/dist/{attributes-ksn4HVbd.js → attributes-CmYpdqCN.js} +2 -11
- package/dist/attributes-CmYpdqCN.js.map +1 -0
- package/dist/{attributes-D3etyRVc.cjs → attributes-PZ5doLgw.cjs} +2 -11
- package/dist/attributes-PZ5doLgw.cjs.map +1 -0
- package/dist/attributes.cjs +1 -1
- package/dist/attributes.d.cts +2 -2
- package/dist/attributes.d.ts +2 -2
- package/dist/attributes.js +1 -1
- package/dist/auto.cjs +2 -2
- package/dist/auto.js +1 -1
- package/dist/correlation-id.cjs +1 -1
- package/dist/correlation-id.js +1 -1
- package/dist/decorators.cjs +1 -1
- package/dist/decorators.js +1 -1
- package/dist/{event-Dlqr4ZNL.cjs → event-BhHREDJk.cjs} +3 -3
- package/dist/{event-Dlqr4ZNL.cjs.map → event-BhHREDJk.cjs.map} +1 -1
- package/dist/{event-_58ryBjh.js → event-ByBTV9M2.js} +3 -3
- package/dist/{event-_58ryBjh.js.map → event-ByBTV9M2.js.map} +1 -1
- package/dist/event.cjs +1 -1
- package/dist/event.js +1 -1
- package/dist/{functional-BGkT8J-h.js → functional-DtI0u4vx.js} +19 -19
- package/dist/functional-DtI0u4vx.js.map +1 -0
- package/dist/{functional-C4CzoVrX.cjs → functional-zpzNLhky.cjs} +4 -4
- package/dist/{functional-C4CzoVrX.cjs.map → functional-zpzNLhky.cjs.map} +1 -1
- package/dist/functional.cjs +1 -1
- package/dist/functional.js +1 -1
- package/dist/http.cjs +1 -1
- package/dist/http.js +1 -1
- package/dist/{index-CX0aG1Uh.d.ts → index-Ck06vlW2.d.ts} +2 -32
- package/dist/index-Ck06vlW2.d.ts.map +1 -0
- package/dist/{index-DIWZFKUS.d.cts → index-eKuioqT1.d.cts} +2 -32
- package/dist/index-eKuioqT1.d.cts.map +1 -0
- package/dist/index.cjs +7 -351
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +4 -172
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.ts +4 -172
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +9 -338
- package/dist/index.js.map +1 -1
- package/dist/{init-DJQOdVlN.d.ts → init-B7u-DjxM.d.ts} +57 -2
- package/dist/init-B7u-DjxM.d.ts.map +1 -0
- package/dist/{init-DvapOXCc.cjs → init-BX7AmFRl.cjs} +40 -21
- package/dist/init-BX7AmFRl.cjs.map +1 -0
- package/dist/{init-Ch6t7MNI.js → init-D-jnNMix.js} +39 -20
- package/dist/init-D-jnNMix.js.map +1 -0
- package/dist/{init-CNp-ee80.d.cts → init-DSrRmVnz.d.cts} +57 -2
- package/dist/init-DSrRmVnz.d.cts.map +1 -0
- package/dist/instrumentation.cjs +1 -1
- package/dist/instrumentation.js +1 -1
- package/dist/logger-D3Ej3DII.js +446 -0
- package/dist/logger-D3Ej3DII.js.map +1 -0
- package/dist/logger-thMPLpOG.cjs +487 -0
- package/dist/logger-thMPLpOG.cjs.map +1 -0
- package/dist/logger.cjs +8 -236
- package/dist/logger.js +2 -204
- package/dist/messaging.cjs +1 -1
- package/dist/messaging.js +1 -1
- package/dist/{registry-DfXA3R1L.js → registry-DVSmWg6Y.js} +2 -11
- package/dist/registry-DVSmWg6Y.js.map +1 -0
- package/dist/{registry-JZg2J3RZ.cjs → registry-DYgvb62e.cjs} +1 -16
- package/dist/registry-DYgvb62e.cjs.map +1 -0
- package/dist/semantic-conventions.cjs +1 -1
- package/dist/semantic-conventions.js +1 -1
- package/dist/semantic-helpers.cjs +1 -114
- package/dist/semantic-helpers.cjs.map +1 -1
- package/dist/semantic-helpers.d.cts +1 -114
- package/dist/semantic-helpers.d.cts.map +1 -1
- package/dist/semantic-helpers.d.ts +1 -114
- package/dist/semantic-helpers.d.ts.map +1 -1
- package/dist/semantic-helpers.js +2 -114
- package/dist/semantic-helpers.js.map +1 -1
- package/dist/{track-3HY4NGV-.cjs → track-D59FfpL0.cjs} +2 -2
- package/dist/{track-3HY4NGV-.cjs.map → track-D59FfpL0.cjs.map} +1 -1
- package/dist/{track-nsKVy-pj.js → track-wc0HafS_.js} +6 -6
- package/dist/track-wc0HafS_.js.map +1 -0
- package/dist/webhook.cjs +1 -1
- package/dist/webhook.js +1 -1
- package/dist/workflow-distributed.cjs +1 -1
- package/dist/workflow-distributed.js +1 -1
- package/dist/workflow.cjs +1 -1
- package/dist/workflow.js +1 -1
- package/dist/{yaml-config-B3dQ82GR.cjs → yaml-config-Ck2uB0Dp.cjs} +2 -1
- package/dist/yaml-config-Ck2uB0Dp.cjs.map +1 -0
- package/dist/yaml-config.cjs +1 -1
- package/dist/yaml-config.d.cts +7 -1
- package/dist/yaml-config.d.cts.map +1 -1
- package/dist/yaml-config.d.ts +7 -1
- package/dist/yaml-config.d.ts.map +1 -1
- package/dist/yaml-config.js +1 -0
- package/dist/yaml-config.js.map +1 -1
- package/package.json +1 -1
- package/skills/analyze-traces/SKILL.md +14 -12
- package/skills/autotel-core/SKILL.md +2 -0
- package/skills/autotel-instrumentation/SKILL.md +25 -0
- package/skills/debug-missing-spans/SKILL.md +3 -1
- package/skills/migrate-to-autotel/SKILL.md +24 -23
- package/skills/review-otel-patterns/SKILL.md +9 -6
- package/skills/tune-sampling/SKILL.md +8 -3
- package/src/attributes/builders.ts +2 -20
- package/src/attributes/index.ts +0 -1
- package/src/attributes/registry.ts +2 -9
- package/src/attributes/types.ts +0 -8
- package/src/index.ts +4 -41
- package/src/init.customization.test.ts +71 -0
- package/src/init.ts +167 -40
- package/src/semantic-helpers.test.ts +2 -87
- package/src/semantic-helpers.ts +0 -146
- package/src/yaml-config.test.ts +36 -0
- package/src/yaml-config.ts +10 -1
- package/dist/attributes-D3etyRVc.cjs.map +0 -1
- package/dist/attributes-ksn4HVbd.js.map +0 -1
- package/dist/functional-BGkT8J-h.js.map +0 -1
- package/dist/index-CX0aG1Uh.d.ts.map +0 -1
- package/dist/index-DIWZFKUS.d.cts.map +0 -1
- package/dist/init-CNp-ee80.d.cts.map +0 -1
- package/dist/init-Ch6t7MNI.js.map +0 -1
- package/dist/init-DJQOdVlN.d.ts.map +0 -1
- package/dist/init-DvapOXCc.cjs.map +0 -1
- package/dist/logger.cjs.map +0 -1
- package/dist/logger.js.map +0 -1
- package/dist/registry-DfXA3R1L.js.map +0 -1
- package/dist/registry-JZg2J3RZ.cjs.map +0 -1
- package/dist/track-nsKVy-pj.js.map +0 -1
- package/dist/yaml-config-B3dQ82GR.cjs.map +0 -1
- package/src/gen-ai-cost.test.ts +0 -81
- package/src/gen-ai-cost.ts +0 -145
- package/src/gen-ai-events.test.ts +0 -135
- package/src/gen-ai-events.ts +0 -208
- package/src/gen-ai-metrics.test.ts +0 -96
- package/src/gen-ai-metrics.ts +0 -128
package/dist/logger.cjs
CHANGED
|
@@ -1,238 +1,10 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
2
|
+
const require_logger = require('./logger-thMPLpOG.cjs');
|
|
2
3
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
* **BYOL (Bring Your Own Logger):** Pass Pino or Bunyan to `init()` for
|
|
11
|
-
* automatic instrumentation with trace context and OTLP log export.
|
|
12
|
-
*
|
|
13
|
-
* ## Logger Signature
|
|
14
|
-
*
|
|
15
|
-
* Autotel v2.10+ uses **Pino's signature**: `logger.info({ metadata }, 'message')`.
|
|
16
|
-
*
|
|
17
|
-
* ### Backward Compatibility
|
|
18
|
-
*
|
|
19
|
-
* The built-in logger auto-detects legacy Winston-style calls and swaps arguments:
|
|
20
|
-
* ```typescript
|
|
21
|
-
* // Legacy (auto-detected and handled)
|
|
22
|
-
* logger.info('User created', { userId: '123' });
|
|
23
|
-
* // → Internally treated as: logger.info({ userId: '123' }, 'User created')
|
|
24
|
-
* // → Logs warning in development, works silently in production
|
|
25
|
-
* ```
|
|
26
|
-
*
|
|
27
|
-
* ### Recommended Usage
|
|
28
|
-
*
|
|
29
|
-
* ```typescript
|
|
30
|
-
* // ✅ Pino-style (preferred)
|
|
31
|
-
* logger.info({ userId: '123' }, 'User created');
|
|
32
|
-
*
|
|
33
|
-
* // ✅ Simple message (no metadata)
|
|
34
|
-
* logger.info('Server started');
|
|
35
|
-
* ```
|
|
36
|
-
*
|
|
37
|
-
* **Note:** If you BYOL (bring your own logger), it must use Pino signature.
|
|
38
|
-
* Winston and other `(message, meta)` loggers are NOT compatible.
|
|
39
|
-
* For Winston, use `@opentelemetry/instrumentation-winston` instead.
|
|
40
|
-
*
|
|
41
|
-
* @example Zero-config (uses built-in logger)
|
|
42
|
-
* ```typescript
|
|
43
|
-
* import { init } from 'autotel';
|
|
44
|
-
*
|
|
45
|
-
* init({ service: 'my-app' });
|
|
46
|
-
* // Internal logs: {"level":"info","service":"my-app","msg":"...","traceId":"..."}
|
|
47
|
-
* ```
|
|
48
|
-
*
|
|
49
|
-
* @example Using built-in logger directly
|
|
50
|
-
* ```typescript
|
|
51
|
-
* import { createBuiltinLogger, runWithLogLevel } from 'autotel/logger';
|
|
52
|
-
*
|
|
53
|
-
* const log = createBuiltinLogger('my-service');
|
|
54
|
-
*
|
|
55
|
-
* // Simple message (no metadata)
|
|
56
|
-
* log.info('Server started');
|
|
57
|
-
*
|
|
58
|
-
* // With metadata (Pino-style: object first, message second)
|
|
59
|
-
* log.info({ userId: '123' }, 'User created');
|
|
60
|
-
* // Output: {"level":"info","service":"my-service","msg":"User created","userId":"123","traceId":"..."}
|
|
61
|
-
*
|
|
62
|
-
* // Dynamic log level per-request
|
|
63
|
-
* runWithLogLevel('debug', () => {
|
|
64
|
-
* log.debug('Debug info for this request only');
|
|
65
|
-
* });
|
|
66
|
-
* ```
|
|
67
|
-
*
|
|
68
|
-
* @example Using Pino (recommended for production, auto-instrumented)
|
|
69
|
-
* ```typescript
|
|
70
|
-
* import pino from 'pino'; // npm install pino
|
|
71
|
-
* import { init } from 'autotel';
|
|
72
|
-
*
|
|
73
|
-
* const logger = pino({ level: 'info' });
|
|
74
|
-
* init({ service: 'my-app', logger });
|
|
75
|
-
*
|
|
76
|
-
* // Logs automatically include traceId/spanId and export via OTLP!
|
|
77
|
-
* logger.info({ userId: '123' }, 'User created');
|
|
78
|
-
* ```
|
|
79
|
-
*
|
|
80
|
-
* @example Using Bunyan (auto-instrumented, same signature as Pino)
|
|
81
|
-
* ```typescript
|
|
82
|
-
* import bunyan from 'bunyan'; // npm install bunyan @opentelemetry/instrumentation-bunyan
|
|
83
|
-
* import { init } from 'autotel';
|
|
84
|
-
* import { BunyanInstrumentation } from '@opentelemetry/instrumentation-bunyan';
|
|
85
|
-
*
|
|
86
|
-
* const logger = bunyan.createLogger({ name: 'my-app' });
|
|
87
|
-
* init({
|
|
88
|
-
* service: 'my-app',
|
|
89
|
-
* logger,
|
|
90
|
-
* instrumentations: [new BunyanInstrumentation()]
|
|
91
|
-
* });
|
|
92
|
-
* ```
|
|
93
|
-
*
|
|
94
|
-
* @example Custom logger (MUST use Pino-compatible signature)
|
|
95
|
-
* ```typescript
|
|
96
|
-
* // ⚠️ Your custom logger MUST accept (object, message?) signature
|
|
97
|
-
* const logger = {
|
|
98
|
-
* info: (extra, msg) => console.log(msg || '', extra),
|
|
99
|
-
* warn: (extra, msg) => console.warn(msg || '', extra),
|
|
100
|
-
* error: (extra, msg) => console.error(msg || '', extra),
|
|
101
|
-
* debug: (extra, msg) => console.debug(msg || '', extra),
|
|
102
|
-
* };
|
|
103
|
-
* init({ service: 'my-app', logger });
|
|
104
|
-
* ```
|
|
105
|
-
*
|
|
106
|
-
* @example BYOL helper: inject trace context into any logger
|
|
107
|
-
* ```typescript
|
|
108
|
-
* import bunyan from 'bunyan';
|
|
109
|
-
* import { getTraceContext } from 'autotel/logger';
|
|
110
|
-
*
|
|
111
|
-
* const bunyanLogger = bunyan.createLogger({ name: 'myapp' });
|
|
112
|
-
* const ctx = getTraceContext();
|
|
113
|
-
* bunyanLogger.info({ ...ctx, userId: '123' }, 'Creating user');
|
|
114
|
-
* ```
|
|
115
|
-
*/
|
|
116
|
-
/**
|
|
117
|
-
* Log level constants
|
|
118
|
-
*/
|
|
119
|
-
const LOG_LEVEL = {
|
|
120
|
-
DEBUG: "debug",
|
|
121
|
-
INFO: "info",
|
|
122
|
-
WARN: "warn",
|
|
123
|
-
ERROR: "error"
|
|
124
|
-
};
|
|
125
|
-
/**
|
|
126
|
-
* TS5+ Standard Decorator for logging and tracing operations
|
|
127
|
-
* Uses TC39 Stage 3 decorator syntax
|
|
128
|
-
*
|
|
129
|
-
* This is the traditional per-method decorator approach.
|
|
130
|
-
* For zero-boilerplate solution, see @Instrumented class decorator.
|
|
131
|
-
*
|
|
132
|
-
* @example
|
|
133
|
-
* // Simple usage (Pino-style: object first, message second)
|
|
134
|
-
* class OrderService {
|
|
135
|
-
* constructor(private readonly deps: { log: Logger }) {}
|
|
136
|
-
*
|
|
137
|
-
* @LoggedOperation('order.create')
|
|
138
|
-
* async createOrder(data: CreateOrderData) {
|
|
139
|
-
* // ✅ Correct Pino-style logging
|
|
140
|
-
* this.deps.log.info({ orderId: data.id }, 'Creating order');
|
|
141
|
-
* }
|
|
142
|
-
* }
|
|
143
|
-
*
|
|
144
|
-
* // Advanced usage (future-proof for options)
|
|
145
|
-
* @LoggedOperation({ operationName: 'order.create' })
|
|
146
|
-
* async createOrder(data: CreateOrderData) { }
|
|
147
|
-
*/
|
|
148
|
-
function LoggedOperation(operationNameOrOptions) {
|
|
149
|
-
const operationName = typeof operationNameOrOptions === "string" ? operationNameOrOptions : operationNameOrOptions.operationName;
|
|
150
|
-
return function(originalMethod, context) {
|
|
151
|
-
const methodName = String(context.name);
|
|
152
|
-
return async function(...args) {
|
|
153
|
-
const log = this.deps?.log;
|
|
154
|
-
const startTime = performance.now();
|
|
155
|
-
return getConfig().tracer.startActiveSpan(operationName, async (span) => {
|
|
156
|
-
try {
|
|
157
|
-
log?.info({
|
|
158
|
-
operation: operationName,
|
|
159
|
-
method: methodName,
|
|
160
|
-
args
|
|
161
|
-
}, "Operation started");
|
|
162
|
-
const result = await originalMethod.apply(this, args);
|
|
163
|
-
const duration = performance.now() - startTime;
|
|
164
|
-
log?.info({
|
|
165
|
-
operation: operationName,
|
|
166
|
-
method: methodName,
|
|
167
|
-
duration
|
|
168
|
-
}, "Operation completed");
|
|
169
|
-
span.setStatus({ code: SpanStatusCode.OK });
|
|
170
|
-
span.setAttributes({
|
|
171
|
-
"operation.name": operationName,
|
|
172
|
-
"operation.method": methodName,
|
|
173
|
-
"operation.duration": duration,
|
|
174
|
-
"operation.success": true
|
|
175
|
-
});
|
|
176
|
-
return result;
|
|
177
|
-
} catch (error) {
|
|
178
|
-
const duration = performance.now() - startTime;
|
|
179
|
-
log?.error({
|
|
180
|
-
err: error instanceof Error ? error : void 0,
|
|
181
|
-
operation: operationName,
|
|
182
|
-
method: methodName,
|
|
183
|
-
duration
|
|
184
|
-
}, "Operation failed");
|
|
185
|
-
span.setStatus({
|
|
186
|
-
code: SpanStatusCode.ERROR,
|
|
187
|
-
message: error instanceof Error ? error.message : "Unknown error"
|
|
188
|
-
});
|
|
189
|
-
span.setAttributes({
|
|
190
|
-
"operation.name": operationName,
|
|
191
|
-
"operation.method": methodName,
|
|
192
|
-
"operation.duration": duration,
|
|
193
|
-
"operation.success": false,
|
|
194
|
-
"error.type": error instanceof Error ? error.constructor.name : "Unknown"
|
|
195
|
-
});
|
|
196
|
-
throw error;
|
|
197
|
-
} finally {
|
|
198
|
-
span.end();
|
|
199
|
-
}
|
|
200
|
-
});
|
|
201
|
-
};
|
|
202
|
-
};
|
|
203
|
-
}
|
|
204
|
-
|
|
205
|
-
//#endregion
|
|
206
|
-
exports.LOG_LEVEL = LOG_LEVEL;
|
|
207
|
-
exports.LoggedOperation = LoggedOperation;
|
|
208
|
-
Object.defineProperty(exports, 'autotelLogger', {
|
|
209
|
-
enumerable: true,
|
|
210
|
-
get: function () {
|
|
211
|
-
return autotelLogger;
|
|
212
|
-
}
|
|
213
|
-
});
|
|
214
|
-
Object.defineProperty(exports, 'createBuiltinLogger', {
|
|
215
|
-
enumerable: true,
|
|
216
|
-
get: function () {
|
|
217
|
-
return createBuiltinLogger;
|
|
218
|
-
}
|
|
219
|
-
});
|
|
220
|
-
Object.defineProperty(exports, 'getActiveLogLevel', {
|
|
221
|
-
enumerable: true,
|
|
222
|
-
get: function () {
|
|
223
|
-
return getActiveLogLevel;
|
|
224
|
-
}
|
|
225
|
-
});
|
|
226
|
-
Object.defineProperty(exports, 'getTraceContext', {
|
|
227
|
-
enumerable: true,
|
|
228
|
-
get: function () {
|
|
229
|
-
return getTraceContext;
|
|
230
|
-
}
|
|
231
|
-
});
|
|
232
|
-
Object.defineProperty(exports, 'runWithLogLevel', {
|
|
233
|
-
enumerable: true,
|
|
234
|
-
get: function () {
|
|
235
|
-
return runWithLogLevel;
|
|
236
|
-
}
|
|
237
|
-
});
|
|
238
|
-
//# sourceMappingURL=logger.cjs.map
|
|
4
|
+
exports.LOG_LEVEL = require_logger.LOG_LEVEL;
|
|
5
|
+
exports.LoggedOperation = require_logger.LoggedOperation;
|
|
6
|
+
exports.autotelLogger = require_logger.autotelLogger;
|
|
7
|
+
exports.createBuiltinLogger = require_logger.createBuiltinLogger;
|
|
8
|
+
exports.getActiveLogLevel = require_logger.getActiveLogLevel;
|
|
9
|
+
exports.getTraceContext = require_logger.getTraceContext;
|
|
10
|
+
exports.runWithLogLevel = require_logger.runWithLogLevel;
|
package/dist/logger.js
CHANGED
|
@@ -1,205 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
/**
|
|
3
|
-
* Logger types and utilities for autotel
|
|
4
|
-
*
|
|
5
|
-
* **Zero-Config Option:** Don't provide a logger to `init()` and autotel uses
|
|
6
|
-
* a built-in structured JSON logger with automatic trace context injection.
|
|
7
|
-
*
|
|
8
|
-
* **BYOL (Bring Your Own Logger):** Pass Pino or Bunyan to `init()` for
|
|
9
|
-
* automatic instrumentation with trace context and OTLP log export.
|
|
10
|
-
*
|
|
11
|
-
* ## Logger Signature
|
|
12
|
-
*
|
|
13
|
-
* Autotel v2.10+ uses **Pino's signature**: `logger.info({ metadata }, 'message')`.
|
|
14
|
-
*
|
|
15
|
-
* ### Backward Compatibility
|
|
16
|
-
*
|
|
17
|
-
* The built-in logger auto-detects legacy Winston-style calls and swaps arguments:
|
|
18
|
-
* ```typescript
|
|
19
|
-
* // Legacy (auto-detected and handled)
|
|
20
|
-
* logger.info('User created', { userId: '123' });
|
|
21
|
-
* // → Internally treated as: logger.info({ userId: '123' }, 'User created')
|
|
22
|
-
* // → Logs warning in development, works silently in production
|
|
23
|
-
* ```
|
|
24
|
-
*
|
|
25
|
-
* ### Recommended Usage
|
|
26
|
-
*
|
|
27
|
-
* ```typescript
|
|
28
|
-
* // ✅ Pino-style (preferred)
|
|
29
|
-
* logger.info({ userId: '123' }, 'User created');
|
|
30
|
-
*
|
|
31
|
-
* // ✅ Simple message (no metadata)
|
|
32
|
-
* logger.info('Server started');
|
|
33
|
-
* ```
|
|
34
|
-
*
|
|
35
|
-
* **Note:** If you BYOL (bring your own logger), it must use Pino signature.
|
|
36
|
-
* Winston and other `(message, meta)` loggers are NOT compatible.
|
|
37
|
-
* For Winston, use `@opentelemetry/instrumentation-winston` instead.
|
|
38
|
-
*
|
|
39
|
-
* @example Zero-config (uses built-in logger)
|
|
40
|
-
* ```typescript
|
|
41
|
-
* import { init } from 'autotel';
|
|
42
|
-
*
|
|
43
|
-
* init({ service: 'my-app' });
|
|
44
|
-
* // Internal logs: {"level":"info","service":"my-app","msg":"...","traceId":"..."}
|
|
45
|
-
* ```
|
|
46
|
-
*
|
|
47
|
-
* @example Using built-in logger directly
|
|
48
|
-
* ```typescript
|
|
49
|
-
* import { createBuiltinLogger, runWithLogLevel } from 'autotel/logger';
|
|
50
|
-
*
|
|
51
|
-
* const log = createBuiltinLogger('my-service');
|
|
52
|
-
*
|
|
53
|
-
* // Simple message (no metadata)
|
|
54
|
-
* log.info('Server started');
|
|
55
|
-
*
|
|
56
|
-
* // With metadata (Pino-style: object first, message second)
|
|
57
|
-
* log.info({ userId: '123' }, 'User created');
|
|
58
|
-
* // Output: {"level":"info","service":"my-service","msg":"User created","userId":"123","traceId":"..."}
|
|
59
|
-
*
|
|
60
|
-
* // Dynamic log level per-request
|
|
61
|
-
* runWithLogLevel('debug', () => {
|
|
62
|
-
* log.debug('Debug info for this request only');
|
|
63
|
-
* });
|
|
64
|
-
* ```
|
|
65
|
-
*
|
|
66
|
-
* @example Using Pino (recommended for production, auto-instrumented)
|
|
67
|
-
* ```typescript
|
|
68
|
-
* import pino from 'pino'; // npm install pino
|
|
69
|
-
* import { init } from 'autotel';
|
|
70
|
-
*
|
|
71
|
-
* const logger = pino({ level: 'info' });
|
|
72
|
-
* init({ service: 'my-app', logger });
|
|
73
|
-
*
|
|
74
|
-
* // Logs automatically include traceId/spanId and export via OTLP!
|
|
75
|
-
* logger.info({ userId: '123' }, 'User created');
|
|
76
|
-
* ```
|
|
77
|
-
*
|
|
78
|
-
* @example Using Bunyan (auto-instrumented, same signature as Pino)
|
|
79
|
-
* ```typescript
|
|
80
|
-
* import bunyan from 'bunyan'; // npm install bunyan @opentelemetry/instrumentation-bunyan
|
|
81
|
-
* import { init } from 'autotel';
|
|
82
|
-
* import { BunyanInstrumentation } from '@opentelemetry/instrumentation-bunyan';
|
|
83
|
-
*
|
|
84
|
-
* const logger = bunyan.createLogger({ name: 'my-app' });
|
|
85
|
-
* init({
|
|
86
|
-
* service: 'my-app',
|
|
87
|
-
* logger,
|
|
88
|
-
* instrumentations: [new BunyanInstrumentation()]
|
|
89
|
-
* });
|
|
90
|
-
* ```
|
|
91
|
-
*
|
|
92
|
-
* @example Custom logger (MUST use Pino-compatible signature)
|
|
93
|
-
* ```typescript
|
|
94
|
-
* // ⚠️ Your custom logger MUST accept (object, message?) signature
|
|
95
|
-
* const logger = {
|
|
96
|
-
* info: (extra, msg) => console.log(msg || '', extra),
|
|
97
|
-
* warn: (extra, msg) => console.warn(msg || '', extra),
|
|
98
|
-
* error: (extra, msg) => console.error(msg || '', extra),
|
|
99
|
-
* debug: (extra, msg) => console.debug(msg || '', extra),
|
|
100
|
-
* };
|
|
101
|
-
* init({ service: 'my-app', logger });
|
|
102
|
-
* ```
|
|
103
|
-
*
|
|
104
|
-
* @example BYOL helper: inject trace context into any logger
|
|
105
|
-
* ```typescript
|
|
106
|
-
* import bunyan from 'bunyan';
|
|
107
|
-
* import { getTraceContext } from 'autotel/logger';
|
|
108
|
-
*
|
|
109
|
-
* const bunyanLogger = bunyan.createLogger({ name: 'myapp' });
|
|
110
|
-
* const ctx = getTraceContext();
|
|
111
|
-
* bunyanLogger.info({ ...ctx, userId: '123' }, 'Creating user');
|
|
112
|
-
* ```
|
|
113
|
-
*/
|
|
114
|
-
/**
|
|
115
|
-
* Log level constants
|
|
116
|
-
*/
|
|
117
|
-
const LOG_LEVEL = {
|
|
118
|
-
DEBUG: "debug",
|
|
119
|
-
INFO: "info",
|
|
120
|
-
WARN: "warn",
|
|
121
|
-
ERROR: "error"
|
|
122
|
-
};
|
|
123
|
-
/**
|
|
124
|
-
* TS5+ Standard Decorator for logging and tracing operations
|
|
125
|
-
* Uses TC39 Stage 3 decorator syntax
|
|
126
|
-
*
|
|
127
|
-
* This is the traditional per-method decorator approach.
|
|
128
|
-
* For zero-boilerplate solution, see @Instrumented class decorator.
|
|
129
|
-
*
|
|
130
|
-
* @example
|
|
131
|
-
* // Simple usage (Pino-style: object first, message second)
|
|
132
|
-
* class OrderService {
|
|
133
|
-
* constructor(private readonly deps: { log: Logger }) {}
|
|
134
|
-
*
|
|
135
|
-
* @LoggedOperation('order.create')
|
|
136
|
-
* async createOrder(data: CreateOrderData) {
|
|
137
|
-
* // ✅ Correct Pino-style logging
|
|
138
|
-
* this.deps.log.info({ orderId: data.id }, 'Creating order');
|
|
139
|
-
* }
|
|
140
|
-
* }
|
|
141
|
-
*
|
|
142
|
-
* // Advanced usage (future-proof for options)
|
|
143
|
-
* @LoggedOperation({ operationName: 'order.create' })
|
|
144
|
-
* async createOrder(data: CreateOrderData) { }
|
|
145
|
-
*/
|
|
146
|
-
function LoggedOperation(operationNameOrOptions) {
|
|
147
|
-
const operationName = typeof operationNameOrOptions === "string" ? operationNameOrOptions : operationNameOrOptions.operationName;
|
|
148
|
-
return function(originalMethod, context) {
|
|
149
|
-
const methodName = String(context.name);
|
|
150
|
-
return async function(...args) {
|
|
151
|
-
const log = this.deps?.log;
|
|
152
|
-
const startTime = performance.now();
|
|
153
|
-
return getConfig().tracer.startActiveSpan(operationName, async (span) => {
|
|
154
|
-
try {
|
|
155
|
-
log?.info({
|
|
156
|
-
operation: operationName,
|
|
157
|
-
method: methodName,
|
|
158
|
-
args
|
|
159
|
-
}, "Operation started");
|
|
160
|
-
const result = await originalMethod.apply(this, args);
|
|
161
|
-
const duration = performance.now() - startTime;
|
|
162
|
-
log?.info({
|
|
163
|
-
operation: operationName,
|
|
164
|
-
method: methodName,
|
|
165
|
-
duration
|
|
166
|
-
}, "Operation completed");
|
|
167
|
-
span.setStatus({ code: SpanStatusCode.OK });
|
|
168
|
-
span.setAttributes({
|
|
169
|
-
"operation.name": operationName,
|
|
170
|
-
"operation.method": methodName,
|
|
171
|
-
"operation.duration": duration,
|
|
172
|
-
"operation.success": true
|
|
173
|
-
});
|
|
174
|
-
return result;
|
|
175
|
-
} catch (error) {
|
|
176
|
-
const duration = performance.now() - startTime;
|
|
177
|
-
log?.error({
|
|
178
|
-
err: error instanceof Error ? error : void 0,
|
|
179
|
-
operation: operationName,
|
|
180
|
-
method: methodName,
|
|
181
|
-
duration
|
|
182
|
-
}, "Operation failed");
|
|
183
|
-
span.setStatus({
|
|
184
|
-
code: SpanStatusCode.ERROR,
|
|
185
|
-
message: error instanceof Error ? error.message : "Unknown error"
|
|
186
|
-
});
|
|
187
|
-
span.setAttributes({
|
|
188
|
-
"operation.name": operationName,
|
|
189
|
-
"operation.method": methodName,
|
|
190
|
-
"operation.duration": duration,
|
|
191
|
-
"operation.success": false,
|
|
192
|
-
"error.type": error instanceof Error ? error.constructor.name : "Unknown"
|
|
193
|
-
});
|
|
194
|
-
throw error;
|
|
195
|
-
} finally {
|
|
196
|
-
span.end();
|
|
197
|
-
}
|
|
198
|
-
});
|
|
199
|
-
};
|
|
200
|
-
};
|
|
201
|
-
}
|
|
1
|
+
import { a as getActiveLogLevel, i as createBuiltinLogger, n as LoggedOperation, o as getTraceContext, r as autotelLogger, s as runWithLogLevel, t as LOG_LEVEL } from "./logger-D3Ej3DII.js";
|
|
202
2
|
|
|
203
|
-
|
|
204
|
-
export { LOG_LEVEL, LoggedOperation, autotelLogger, createBuiltinLogger, getActiveLogLevel, getTraceContext, runWithLogLevel };
|
|
205
|
-
//# sourceMappingURL=logger.js.map
|
|
3
|
+
export { LOG_LEVEL, LoggedOperation, autotelLogger, createBuiltinLogger, getActiveLogLevel, getTraceContext, runWithLogLevel };
|
package/dist/messaging.cjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
2
2
|
const require_sampling = require('./sampling.cjs');
|
|
3
|
-
const require_functional = require('./functional-
|
|
3
|
+
const require_functional = require('./functional-zpzNLhky.cjs');
|
|
4
4
|
const require_correlated_events = require('./correlated-events-kSwLo3mi.cjs');
|
|
5
5
|
let _opentelemetry_api = require("@opentelemetry/api");
|
|
6
6
|
|
package/dist/messaging.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { createLinkFromHeaders, extractLinksFromBatch } from "./sampling.js";
|
|
2
|
-
import { a as trace$1 } from "./functional-
|
|
2
|
+
import { a as trace$1 } from "./functional-DtI0u4vx.js";
|
|
3
3
|
import { t as emitCorrelatedEvent } from "./correlated-events-Bzh5y-UB.js";
|
|
4
4
|
import { SpanKind, context, propagation } from "@opentelemetry/api";
|
|
5
5
|
|
|
@@ -136,15 +136,6 @@ const MessagingAttributes = {
|
|
|
136
136
|
batchMessageCount: "messaging.batch.message_count",
|
|
137
137
|
consumerGroup: "messaging.consumer.group"
|
|
138
138
|
};
|
|
139
|
-
const GenAIAttributes = {
|
|
140
|
-
system: "gen.ai.system",
|
|
141
|
-
requestModel: "gen.ai.request.model",
|
|
142
|
-
responseModel: "gen.ai.response.model",
|
|
143
|
-
operationName: "gen.ai.operation.name",
|
|
144
|
-
usagePromptTokens: "gen.ai.usage.prompt_tokens",
|
|
145
|
-
usageCompletionTokens: "gen.ai.usage.completion_tokens",
|
|
146
|
-
provider: "gen.ai.provider"
|
|
147
|
-
};
|
|
148
139
|
const RPCAttributes = {
|
|
149
140
|
system: "rpc.system",
|
|
150
141
|
service: "rpc.service",
|
|
@@ -180,5 +171,5 @@ const TLSAttributes = {
|
|
|
180
171
|
};
|
|
181
172
|
|
|
182
173
|
//#endregion
|
|
183
|
-
export {
|
|
184
|
-
//# sourceMappingURL=registry-
|
|
174
|
+
export { URLAttributes as C, ThreadAttributes as S, RPCAttributes as _, DeviceAttributes as a, SessionAttributes as b, FaaSAttributes as c, HTTPAttributes as d, K8sAttributes as f, ProcessAttributes as g, OTelAttributes as h, DBAttributes as i, FeatureFlagAttributes as l, NetworkAttributes as m, CodeAttributes as n, ErrorAttributes as o, MessagingAttributes as p, ContainerAttributes as r, ExceptionAttributes as s, CloudAttributes as t, GraphQLAttributes as u, ServerAddressAttributes as v, UserAttributes as w, TLSAttributes as x, ServiceAttributes as y };
|
|
175
|
+
//# sourceMappingURL=registry-DVSmWg6Y.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"registry-DVSmWg6Y.js","names":[],"sources":["../src/attributes/registry.ts"],"sourcesContent":["/**\n * OpenTelemetry attribute registry\n * Central source of truth for attribute keys, types, and metadata\n */\n\nexport const UserAttributes = {\n id: 'user.id' as const,\n email: 'user.email' as const,\n name: 'user.name' as const,\n fullName: 'user.full_name' as const,\n hash: 'user.hash' as const,\n roles: 'user.roles' as const,\n} as const;\n\nexport const SessionAttributes = {\n id: 'session.id' as const,\n previousId: 'session.previous_id' as const,\n} as const;\n\nexport const DeviceAttributes = {\n id: 'device.id' as const,\n manufacturer: 'device.manufacturer' as const,\n modelIdentifier: 'device.model.identifier' as const,\n modelName: 'device.model.name' as const,\n} as const;\n\nexport const HTTPAttributes = {\n connectionState: 'http.connection.state' as const,\n requestMethod: 'http.request.method' as const,\n requestMethodOriginal: 'http.request.method_original' as const,\n requestResendCount: 'http.request.resend_count' as const,\n requestSize: 'http.request.size' as const,\n requestBodySize: 'http.request.body.size' as const,\n responseSize: 'http.response.size' as const,\n responseBodySize: 'http.response.body.size' as const,\n responseStatusCode: 'http.response.status_code' as const,\n route: 'http.route' as const,\n} as const;\n\nexport const DBAttributes = {\n clientConnectionPoolName: 'db.client.connection.pool.name' as const,\n clientConnectionState: 'db.client.connection.state' as const,\n collectionName: 'db.collection.name' as const,\n namespace: 'db.namespace' as const,\n operationBatchSize: 'db.operation.batch.size' as const,\n operationName: 'db.operation.name' as const,\n querySummary: 'db.query.summary' as const,\n queryText: 'db.query.text' as const,\n responseReturnedRows: 'db.response.returned_rows' as const,\n responseStatusCode: 'db.response.status_code' as const,\n systemName: 'db.system.name' as const,\n statement: 'db.statement' as const,\n} as const;\n\nexport const ServiceAttributes = {\n name: 'service.name' as const,\n instance: 'service.instance.id' as const,\n version: 'service.version' as const,\n} as const;\n\nexport const NetworkAttributes = {\n peerAddress: 'network.peer.address' as const,\n peerPort: 'network.peer.port' as const,\n transport: 'network.transport' as const,\n type: 'network.type' as const,\n protocolName: 'network.protocol.name' as const,\n protocolVersion: 'network.protocol.version' as const,\n} as const;\n\nexport const ServerAddressAttributes = {\n address: 'server.address' as const,\n port: 'server.port' as const,\n socketAddress: 'server.socket.address' as const,\n} as const;\n\nexport const URLAttributes = {\n scheme: 'url.scheme' as const,\n full: 'url.full' as const,\n path: 'url.path' as const,\n query: 'url.query' as const,\n fragment: 'url.fragment' as const,\n} as const;\n\nexport const ErrorAttributes = {\n type: 'error.type' as const,\n message: 'error.message' as const,\n stackTrace: 'error.stack' as const,\n code: 'error.code' as const,\n} as const;\n\nexport const ExceptionAttributes = {\n escaped: 'exception.escaped' as const,\n message: 'exception.message' as const,\n stackTrace: 'exception.stacktrace' as const,\n type: 'exception.type' as const,\n moduleName: 'exception.module' as const,\n} as const;\n\nexport const ProcessAttributes = {\n pid: 'process.pid' as const,\n executablePath: 'process.executable.path' as const,\n command: 'process.command' as const,\n owner: 'process.owner' as const,\n commandArgs: 'process.command_args' as const,\n} as const;\n\nexport const ThreadAttributes = {\n id: 'thread.id' as const,\n name: 'thread.name' as const,\n} as const;\n\nexport const ContainerAttributes = {\n id: 'container.id' as const,\n name: 'container.name' as const,\n image: 'container.image.name' as const,\n tag: 'container.image.tag' as const,\n} as const;\n\nexport const K8sAttributes = {\n podName: 'k8s.pod.name' as const,\n namespaceName: 'k8s.namespace.name' as const,\n deploymentName: 'k8s.deployment.name' as const,\n state: 'k8s.state.name' as const,\n} as const;\n\nexport const CloudAttributes = {\n provider: 'cloud.provider' as const,\n accountId: 'cloud.account.id' as const,\n region: 'cloud.region' as const,\n availabilityZone: 'cloud.availability_zone' as const,\n platform: 'cloud.platform' as const,\n} as const;\n\nexport const FaaSAttributes = {\n name: 'faas.name' as const,\n version: 'faas.version' as const,\n instance: 'faas.instance' as const,\n execution: 'faas.execution' as const,\n coldstart: 'faas.coldstart' as const,\n} as const;\n\nexport const FeatureFlagAttributes = {\n key: 'feature.flag.key' as const,\n provider: 'feature.flag.provider_name' as const,\n variant: 'feature.flag.variant.name' as const,\n} as const;\n\nexport const MessagingAttributes = {\n system: 'messaging.system' as const,\n destination: 'messaging.destination.name' as const,\n operation: 'messaging.operation' as const,\n messageId: 'messaging.message.id' as const,\n conversationId: 'messaging.conversation_id' as const,\n batchMessageCount: 'messaging.batch.message_count' as const,\n consumerGroup: 'messaging.consumer.group' as const,\n} as const;\n\n// GenAI attribute registry moved to the `autotel-genai` package, which uses the\n// canonical `gen_ai.*` namespace (these legacy `gen.ai.*` keys were non-spec).\n\nexport const RPCAttributes = {\n system: 'rpc.system' as const,\n service: 'rpc.service' as const,\n method: 'rpc.method' as const,\n grpcStatusCode: 'rpc.grpc.status_code' as const,\n} as const;\n\nexport const GraphQLAttributes = {\n document: 'graphql.document' as const,\n operationName: 'graphql.operation.name' as const,\n operationType: 'graphql.operation.type' as const,\n} as const;\n\nexport const PeerAttributes = {\n service: 'peer.service' as const,\n} as const;\n\nexport const ClientAttributes = {\n address: 'client.address' as const,\n port: 'client.port' as const,\n socketAddress: 'client.socket.address' as const,\n} as const;\n\nexport const DeploymentAttributes = {\n environment: 'deployment.environment' as const,\n id: 'deployment.environment.id' as const,\n} as const;\n\nexport const OTelAttributes = {\n libraryName: 'otel.library.name' as const,\n libraryVersion: 'otel.library.version' as const,\n statusCode: 'otel.status_code' as const,\n} as const;\n\nexport const CodeAttributes = {\n namespace: 'code.namespace' as const,\n filepath: 'code.filepath' as const,\n function: 'code.function' as const,\n class: 'code.class' as const,\n method: 'code.method' as const,\n column: 'code.column' as const,\n lineNumber: 'code.lineno' as const,\n repository: 'code.repository' as const,\n revision: 'code.revision' as const,\n} as const;\n\nexport const TLSAttributes = {\n protocolVersion: 'tls.protocol.version' as const,\n cipher: 'tls.cipher' as const,\n curveName: 'tls.curve.name' as const,\n resumed: 'tls.resumed' as const,\n} as const;\n\nexport const BrowserAttributes = {\n platform: 'browser.platform' as const,\n language: 'browser.language' as const,\n brand: 'browser.brand' as const,\n mobile: 'browser.mobile' as const,\n} as const;\n\nexport const AndroidAttributes = {\n appVersion: 'android.app.version' as const,\n package: 'android.package' as const,\n activityName: 'android.activity.name' as const,\n} as const;\n\nexport const IOSAttributes = {\n deviceModel: 'ios.device.model' as const,\n version: 'ios.version' as const,\n} as const;\n\nexport const GeoAttributes = {\n cityName: 'geo.city.name' as const,\n countryCode: 'geo.country.name' as const,\n continentCode: 'geo.continent.code' as const,\n} as const;\n\nexport const UserAgentAttributes = {\n original: 'user_agent.original' as const,\n} as const;\n\nexport const AWSAttributes = {\n ecsClusterArn: 'aws.ecs.cluster.arn' as const,\n ecsContainerArn: 'aws.ecs.container.arn' as const,\n logGroupName: 'aws.log.group.name' as const,\n requestId: 'aws.requestId' as const,\n} as const;\n\nexport const AzureAttributes = {\n subscriptionId: 'azure.subscription.id' as const,\n tenantId: 'azure.tenant.id' as const,\n} as const;\n\nexport const GCPAttributes = {\n project: 'gcp.project.id' as const,\n instanceName: 'gcp.instance.name' as const,\n zone: 'gcp.zone' as const,\n} as const;\n\nexport const CassandraAttributes = {\n consistencyLevel: 'cassandra.consistency.level' as const,\n coordinatorId: 'cassandra.coordinator.id' as const,\n dataCenter: 'cassandra.coordinator.dc' as const,\n pageSize: 'cassandra.page.size' as const,\n} as const;\n\nexport const ElasticsearchAttributes = {\n clusterName: 'elasticsearch.cluster.name' as const,\n nodeId: 'elasticsearch.node.name' as const,\n} as const;\n\nexport const MongoDBAttributes = {\n collectionName: 'mongodb.collection.name' as const,\n} as const;\n\nexport const RedisAttributes = {\n databaseIndex: 'redis.database.index' as const,\n} as const;\n\nexport const MSSQLAttributes = {\n instanceName: 'mssql.instance.name' as const,\n} as const;\n\nexport const PostgreSQLAttributes = {\n databaseName: 'postgresql.database.name' as const,\n} as const;\n\nexport const AWSLambdaAttributes = {\n requestId: 'aws.lambda.invoked_arn' as const,\n requestFunction: 'aws.lambda.invoked_function_arn' as const,\n} as const;\n\nexport const OpenAIAttributes = {\n requestId: 'openai.request.id' as const,\n responseModel: 'openai.response.model' as const,\n responseOrganization: 'openai.response.organization' as const,\n} as const;\n\nexport const AzureAIAAttributes = {\n resource: 'azure.ai.inference.resource' as const,\n deploymentId: 'azure.ai.inference.deployment.id' as const,\n} as const;\n\nexport const AWSBedrockAttributes = {\n requestId: 'aws.bedrock.requestId' as const,\n responseModel: 'aws.bedrock.responseModel' as const,\n} as const;\n\nexport const TestAttributes = {\n framework: 'test.framework' as const,\n name: 'test.name' as const,\n} as const;\n\nexport const ArtifactAttributes = {\n type: 'artifact.type' as const,\n id: 'artifact.id' as const,\n checksum: 'artifact.checksum' as const,\n} as const;\n\nexport const CICDAttributes = {\n pipelineName: 'ci.pipeline.name' as const,\n pipelineRunId: 'ci.pipeline.run.id' as const,\n} as const;\n"],"mappings":";;;;;AAKA,MAAa,iBAAiB;CAC5B,IAAI;CACJ,OAAO;CACP,MAAM;CACN,UAAU;CACV,MAAM;CACN,OAAO;AACT;AAEA,MAAa,oBAAoB;CAC/B,IAAI;CACJ,YAAY;AACd;AAEA,MAAa,mBAAmB;CAC9B,IAAI;CACJ,cAAc;CACd,iBAAiB;CACjB,WAAW;AACb;AAEA,MAAa,iBAAiB;CAC5B,iBAAiB;CACjB,eAAe;CACf,uBAAuB;CACvB,oBAAoB;CACpB,aAAa;CACb,iBAAiB;CACjB,cAAc;CACd,kBAAkB;CAClB,oBAAoB;CACpB,OAAO;AACT;AAEA,MAAa,eAAe;CAC1B,0BAA0B;CAC1B,uBAAuB;CACvB,gBAAgB;CAChB,WAAW;CACX,oBAAoB;CACpB,eAAe;CACf,cAAc;CACd,WAAW;CACX,sBAAsB;CACtB,oBAAoB;CACpB,YAAY;CACZ,WAAW;AACb;AAEA,MAAa,oBAAoB;CAC/B,MAAM;CACN,UAAU;CACV,SAAS;AACX;AAEA,MAAa,oBAAoB;CAC/B,aAAa;CACb,UAAU;CACV,WAAW;CACX,MAAM;CACN,cAAc;CACd,iBAAiB;AACnB;AAEA,MAAa,0BAA0B;CACrC,SAAS;CACT,MAAM;CACN,eAAe;AACjB;AAEA,MAAa,gBAAgB;CAC3B,QAAQ;CACR,MAAM;CACN,MAAM;CACN,OAAO;CACP,UAAU;AACZ;AAEA,MAAa,kBAAkB;CAC7B,MAAM;CACN,SAAS;CACT,YAAY;CACZ,MAAM;AACR;AAEA,MAAa,sBAAsB;CACjC,SAAS;CACT,SAAS;CACT,YAAY;CACZ,MAAM;CACN,YAAY;AACd;AAEA,MAAa,oBAAoB;CAC/B,KAAK;CACL,gBAAgB;CAChB,SAAS;CACT,OAAO;CACP,aAAa;AACf;AAEA,MAAa,mBAAmB;CAC9B,IAAI;CACJ,MAAM;AACR;AAEA,MAAa,sBAAsB;CACjC,IAAI;CACJ,MAAM;CACN,OAAO;CACP,KAAK;AACP;AAEA,MAAa,gBAAgB;CAC3B,SAAS;CACT,eAAe;CACf,gBAAgB;CAChB,OAAO;AACT;AAEA,MAAa,kBAAkB;CAC7B,UAAU;CACV,WAAW;CACX,QAAQ;CACR,kBAAkB;CAClB,UAAU;AACZ;AAEA,MAAa,iBAAiB;CAC5B,MAAM;CACN,SAAS;CACT,UAAU;CACV,WAAW;CACX,WAAW;AACb;AAEA,MAAa,wBAAwB;CACnC,KAAK;CACL,UAAU;CACV,SAAS;AACX;AAEA,MAAa,sBAAsB;CACjC,QAAQ;CACR,aAAa;CACb,WAAW;CACX,WAAW;CACX,gBAAgB;CAChB,mBAAmB;CACnB,eAAe;AACjB;AAKA,MAAa,gBAAgB;CAC3B,QAAQ;CACR,SAAS;CACT,QAAQ;CACR,gBAAgB;AAClB;AAEA,MAAa,oBAAoB;CAC/B,UAAU;CACV,eAAe;CACf,eAAe;AACjB;AAiBA,MAAa,iBAAiB;CAC5B,aAAa;CACb,gBAAgB;CAChB,YAAY;AACd;AAEA,MAAa,iBAAiB;CAC5B,WAAW;CACX,UAAU;CACV,UAAU;CACV,OAAO;CACP,QAAQ;CACR,QAAQ;CACR,YAAY;CACZ,YAAY;CACZ,UAAU;AACZ;AAEA,MAAa,gBAAgB;CAC3B,iBAAiB;CACjB,QAAQ;CACR,WAAW;CACX,SAAS;AACX"}
|
|
@@ -137,15 +137,6 @@ const MessagingAttributes = {
|
|
|
137
137
|
batchMessageCount: "messaging.batch.message_count",
|
|
138
138
|
consumerGroup: "messaging.consumer.group"
|
|
139
139
|
};
|
|
140
|
-
const GenAIAttributes = {
|
|
141
|
-
system: "gen.ai.system",
|
|
142
|
-
requestModel: "gen.ai.request.model",
|
|
143
|
-
responseModel: "gen.ai.response.model",
|
|
144
|
-
operationName: "gen.ai.operation.name",
|
|
145
|
-
usagePromptTokens: "gen.ai.usage.prompt_tokens",
|
|
146
|
-
usageCompletionTokens: "gen.ai.usage.completion_tokens",
|
|
147
|
-
provider: "gen.ai.provider"
|
|
148
|
-
};
|
|
149
140
|
const RPCAttributes = {
|
|
150
141
|
system: "rpc.system",
|
|
151
142
|
service: "rpc.service",
|
|
@@ -235,12 +226,6 @@ Object.defineProperty(exports, 'FeatureFlagAttributes', {
|
|
|
235
226
|
return FeatureFlagAttributes;
|
|
236
227
|
}
|
|
237
228
|
});
|
|
238
|
-
Object.defineProperty(exports, 'GenAIAttributes', {
|
|
239
|
-
enumerable: true,
|
|
240
|
-
get: function () {
|
|
241
|
-
return GenAIAttributes;
|
|
242
|
-
}
|
|
243
|
-
});
|
|
244
229
|
Object.defineProperty(exports, 'GraphQLAttributes', {
|
|
245
230
|
enumerable: true,
|
|
246
231
|
get: function () {
|
|
@@ -331,4 +316,4 @@ Object.defineProperty(exports, 'UserAttributes', {
|
|
|
331
316
|
return UserAttributes;
|
|
332
317
|
}
|
|
333
318
|
});
|
|
334
|
-
//# sourceMappingURL=registry-
|
|
319
|
+
//# sourceMappingURL=registry-DYgvb62e.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"registry-DYgvb62e.cjs","names":[],"sources":["../src/attributes/registry.ts"],"sourcesContent":["/**\n * OpenTelemetry attribute registry\n * Central source of truth for attribute keys, types, and metadata\n */\n\nexport const UserAttributes = {\n id: 'user.id' as const,\n email: 'user.email' as const,\n name: 'user.name' as const,\n fullName: 'user.full_name' as const,\n hash: 'user.hash' as const,\n roles: 'user.roles' as const,\n} as const;\n\nexport const SessionAttributes = {\n id: 'session.id' as const,\n previousId: 'session.previous_id' as const,\n} as const;\n\nexport const DeviceAttributes = {\n id: 'device.id' as const,\n manufacturer: 'device.manufacturer' as const,\n modelIdentifier: 'device.model.identifier' as const,\n modelName: 'device.model.name' as const,\n} as const;\n\nexport const HTTPAttributes = {\n connectionState: 'http.connection.state' as const,\n requestMethod: 'http.request.method' as const,\n requestMethodOriginal: 'http.request.method_original' as const,\n requestResendCount: 'http.request.resend_count' as const,\n requestSize: 'http.request.size' as const,\n requestBodySize: 'http.request.body.size' as const,\n responseSize: 'http.response.size' as const,\n responseBodySize: 'http.response.body.size' as const,\n responseStatusCode: 'http.response.status_code' as const,\n route: 'http.route' as const,\n} as const;\n\nexport const DBAttributes = {\n clientConnectionPoolName: 'db.client.connection.pool.name' as const,\n clientConnectionState: 'db.client.connection.state' as const,\n collectionName: 'db.collection.name' as const,\n namespace: 'db.namespace' as const,\n operationBatchSize: 'db.operation.batch.size' as const,\n operationName: 'db.operation.name' as const,\n querySummary: 'db.query.summary' as const,\n queryText: 'db.query.text' as const,\n responseReturnedRows: 'db.response.returned_rows' as const,\n responseStatusCode: 'db.response.status_code' as const,\n systemName: 'db.system.name' as const,\n statement: 'db.statement' as const,\n} as const;\n\nexport const ServiceAttributes = {\n name: 'service.name' as const,\n instance: 'service.instance.id' as const,\n version: 'service.version' as const,\n} as const;\n\nexport const NetworkAttributes = {\n peerAddress: 'network.peer.address' as const,\n peerPort: 'network.peer.port' as const,\n transport: 'network.transport' as const,\n type: 'network.type' as const,\n protocolName: 'network.protocol.name' as const,\n protocolVersion: 'network.protocol.version' as const,\n} as const;\n\nexport const ServerAddressAttributes = {\n address: 'server.address' as const,\n port: 'server.port' as const,\n socketAddress: 'server.socket.address' as const,\n} as const;\n\nexport const URLAttributes = {\n scheme: 'url.scheme' as const,\n full: 'url.full' as const,\n path: 'url.path' as const,\n query: 'url.query' as const,\n fragment: 'url.fragment' as const,\n} as const;\n\nexport const ErrorAttributes = {\n type: 'error.type' as const,\n message: 'error.message' as const,\n stackTrace: 'error.stack' as const,\n code: 'error.code' as const,\n} as const;\n\nexport const ExceptionAttributes = {\n escaped: 'exception.escaped' as const,\n message: 'exception.message' as const,\n stackTrace: 'exception.stacktrace' as const,\n type: 'exception.type' as const,\n moduleName: 'exception.module' as const,\n} as const;\n\nexport const ProcessAttributes = {\n pid: 'process.pid' as const,\n executablePath: 'process.executable.path' as const,\n command: 'process.command' as const,\n owner: 'process.owner' as const,\n commandArgs: 'process.command_args' as const,\n} as const;\n\nexport const ThreadAttributes = {\n id: 'thread.id' as const,\n name: 'thread.name' as const,\n} as const;\n\nexport const ContainerAttributes = {\n id: 'container.id' as const,\n name: 'container.name' as const,\n image: 'container.image.name' as const,\n tag: 'container.image.tag' as const,\n} as const;\n\nexport const K8sAttributes = {\n podName: 'k8s.pod.name' as const,\n namespaceName: 'k8s.namespace.name' as const,\n deploymentName: 'k8s.deployment.name' as const,\n state: 'k8s.state.name' as const,\n} as const;\n\nexport const CloudAttributes = {\n provider: 'cloud.provider' as const,\n accountId: 'cloud.account.id' as const,\n region: 'cloud.region' as const,\n availabilityZone: 'cloud.availability_zone' as const,\n platform: 'cloud.platform' as const,\n} as const;\n\nexport const FaaSAttributes = {\n name: 'faas.name' as const,\n version: 'faas.version' as const,\n instance: 'faas.instance' as const,\n execution: 'faas.execution' as const,\n coldstart: 'faas.coldstart' as const,\n} as const;\n\nexport const FeatureFlagAttributes = {\n key: 'feature.flag.key' as const,\n provider: 'feature.flag.provider_name' as const,\n variant: 'feature.flag.variant.name' as const,\n} as const;\n\nexport const MessagingAttributes = {\n system: 'messaging.system' as const,\n destination: 'messaging.destination.name' as const,\n operation: 'messaging.operation' as const,\n messageId: 'messaging.message.id' as const,\n conversationId: 'messaging.conversation_id' as const,\n batchMessageCount: 'messaging.batch.message_count' as const,\n consumerGroup: 'messaging.consumer.group' as const,\n} as const;\n\n// GenAI attribute registry moved to the `autotel-genai` package, which uses the\n// canonical `gen_ai.*` namespace (these legacy `gen.ai.*` keys were non-spec).\n\nexport const RPCAttributes = {\n system: 'rpc.system' as const,\n service: 'rpc.service' as const,\n method: 'rpc.method' as const,\n grpcStatusCode: 'rpc.grpc.status_code' as const,\n} as const;\n\nexport const GraphQLAttributes = {\n document: 'graphql.document' as const,\n operationName: 'graphql.operation.name' as const,\n operationType: 'graphql.operation.type' as const,\n} as const;\n\nexport const PeerAttributes = {\n service: 'peer.service' as const,\n} as const;\n\nexport const ClientAttributes = {\n address: 'client.address' as const,\n port: 'client.port' as const,\n socketAddress: 'client.socket.address' as const,\n} as const;\n\nexport const DeploymentAttributes = {\n environment: 'deployment.environment' as const,\n id: 'deployment.environment.id' as const,\n} as const;\n\nexport const OTelAttributes = {\n libraryName: 'otel.library.name' as const,\n libraryVersion: 'otel.library.version' as const,\n statusCode: 'otel.status_code' as const,\n} as const;\n\nexport const CodeAttributes = {\n namespace: 'code.namespace' as const,\n filepath: 'code.filepath' as const,\n function: 'code.function' as const,\n class: 'code.class' as const,\n method: 'code.method' as const,\n column: 'code.column' as const,\n lineNumber: 'code.lineno' as const,\n repository: 'code.repository' as const,\n revision: 'code.revision' as const,\n} as const;\n\nexport const TLSAttributes = {\n protocolVersion: 'tls.protocol.version' as const,\n cipher: 'tls.cipher' as const,\n curveName: 'tls.curve.name' as const,\n resumed: 'tls.resumed' as const,\n} as const;\n\nexport const BrowserAttributes = {\n platform: 'browser.platform' as const,\n language: 'browser.language' as const,\n brand: 'browser.brand' as const,\n mobile: 'browser.mobile' as const,\n} as const;\n\nexport const AndroidAttributes = {\n appVersion: 'android.app.version' as const,\n package: 'android.package' as const,\n activityName: 'android.activity.name' as const,\n} as const;\n\nexport const IOSAttributes = {\n deviceModel: 'ios.device.model' as const,\n version: 'ios.version' as const,\n} as const;\n\nexport const GeoAttributes = {\n cityName: 'geo.city.name' as const,\n countryCode: 'geo.country.name' as const,\n continentCode: 'geo.continent.code' as const,\n} as const;\n\nexport const UserAgentAttributes = {\n original: 'user_agent.original' as const,\n} as const;\n\nexport const AWSAttributes = {\n ecsClusterArn: 'aws.ecs.cluster.arn' as const,\n ecsContainerArn: 'aws.ecs.container.arn' as const,\n logGroupName: 'aws.log.group.name' as const,\n requestId: 'aws.requestId' as const,\n} as const;\n\nexport const AzureAttributes = {\n subscriptionId: 'azure.subscription.id' as const,\n tenantId: 'azure.tenant.id' as const,\n} as const;\n\nexport const GCPAttributes = {\n project: 'gcp.project.id' as const,\n instanceName: 'gcp.instance.name' as const,\n zone: 'gcp.zone' as const,\n} as const;\n\nexport const CassandraAttributes = {\n consistencyLevel: 'cassandra.consistency.level' as const,\n coordinatorId: 'cassandra.coordinator.id' as const,\n dataCenter: 'cassandra.coordinator.dc' as const,\n pageSize: 'cassandra.page.size' as const,\n} as const;\n\nexport const ElasticsearchAttributes = {\n clusterName: 'elasticsearch.cluster.name' as const,\n nodeId: 'elasticsearch.node.name' as const,\n} as const;\n\nexport const MongoDBAttributes = {\n collectionName: 'mongodb.collection.name' as const,\n} as const;\n\nexport const RedisAttributes = {\n databaseIndex: 'redis.database.index' as const,\n} as const;\n\nexport const MSSQLAttributes = {\n instanceName: 'mssql.instance.name' as const,\n} as const;\n\nexport const PostgreSQLAttributes = {\n databaseName: 'postgresql.database.name' as const,\n} as const;\n\nexport const AWSLambdaAttributes = {\n requestId: 'aws.lambda.invoked_arn' as const,\n requestFunction: 'aws.lambda.invoked_function_arn' as const,\n} as const;\n\nexport const OpenAIAttributes = {\n requestId: 'openai.request.id' as const,\n responseModel: 'openai.response.model' as const,\n responseOrganization: 'openai.response.organization' as const,\n} as const;\n\nexport const AzureAIAAttributes = {\n resource: 'azure.ai.inference.resource' as const,\n deploymentId: 'azure.ai.inference.deployment.id' as const,\n} as const;\n\nexport const AWSBedrockAttributes = {\n requestId: 'aws.bedrock.requestId' as const,\n responseModel: 'aws.bedrock.responseModel' as const,\n} as const;\n\nexport const TestAttributes = {\n framework: 'test.framework' as const,\n name: 'test.name' as const,\n} as const;\n\nexport const ArtifactAttributes = {\n type: 'artifact.type' as const,\n id: 'artifact.id' as const,\n checksum: 'artifact.checksum' as const,\n} as const;\n\nexport const CICDAttributes = {\n pipelineName: 'ci.pipeline.name' as const,\n pipelineRunId: 'ci.pipeline.run.id' as const,\n} as const;\n"],"mappings":";;;;;;AAKA,MAAa,iBAAiB;CAC5B,IAAI;CACJ,OAAO;CACP,MAAM;CACN,UAAU;CACV,MAAM;CACN,OAAO;AACT;AAEA,MAAa,oBAAoB;CAC/B,IAAI;CACJ,YAAY;AACd;AAEA,MAAa,mBAAmB;CAC9B,IAAI;CACJ,cAAc;CACd,iBAAiB;CACjB,WAAW;AACb;AAEA,MAAa,iBAAiB;CAC5B,iBAAiB;CACjB,eAAe;CACf,uBAAuB;CACvB,oBAAoB;CACpB,aAAa;CACb,iBAAiB;CACjB,cAAc;CACd,kBAAkB;CAClB,oBAAoB;CACpB,OAAO;AACT;AAEA,MAAa,eAAe;CAC1B,0BAA0B;CAC1B,uBAAuB;CACvB,gBAAgB;CAChB,WAAW;CACX,oBAAoB;CACpB,eAAe;CACf,cAAc;CACd,WAAW;CACX,sBAAsB;CACtB,oBAAoB;CACpB,YAAY;CACZ,WAAW;AACb;AAEA,MAAa,oBAAoB;CAC/B,MAAM;CACN,UAAU;CACV,SAAS;AACX;AAEA,MAAa,oBAAoB;CAC/B,aAAa;CACb,UAAU;CACV,WAAW;CACX,MAAM;CACN,cAAc;CACd,iBAAiB;AACnB;AAEA,MAAa,0BAA0B;CACrC,SAAS;CACT,MAAM;CACN,eAAe;AACjB;AAEA,MAAa,gBAAgB;CAC3B,QAAQ;CACR,MAAM;CACN,MAAM;CACN,OAAO;CACP,UAAU;AACZ;AAEA,MAAa,kBAAkB;CAC7B,MAAM;CACN,SAAS;CACT,YAAY;CACZ,MAAM;AACR;AAEA,MAAa,sBAAsB;CACjC,SAAS;CACT,SAAS;CACT,YAAY;CACZ,MAAM;CACN,YAAY;AACd;AAEA,MAAa,oBAAoB;CAC/B,KAAK;CACL,gBAAgB;CAChB,SAAS;CACT,OAAO;CACP,aAAa;AACf;AAEA,MAAa,mBAAmB;CAC9B,IAAI;CACJ,MAAM;AACR;AAEA,MAAa,sBAAsB;CACjC,IAAI;CACJ,MAAM;CACN,OAAO;CACP,KAAK;AACP;AAEA,MAAa,gBAAgB;CAC3B,SAAS;CACT,eAAe;CACf,gBAAgB;CAChB,OAAO;AACT;AAEA,MAAa,kBAAkB;CAC7B,UAAU;CACV,WAAW;CACX,QAAQ;CACR,kBAAkB;CAClB,UAAU;AACZ;AAEA,MAAa,iBAAiB;CAC5B,MAAM;CACN,SAAS;CACT,UAAU;CACV,WAAW;CACX,WAAW;AACb;AAEA,MAAa,wBAAwB;CACnC,KAAK;CACL,UAAU;CACV,SAAS;AACX;AAEA,MAAa,sBAAsB;CACjC,QAAQ;CACR,aAAa;CACb,WAAW;CACX,WAAW;CACX,gBAAgB;CAChB,mBAAmB;CACnB,eAAe;AACjB;AAKA,MAAa,gBAAgB;CAC3B,QAAQ;CACR,SAAS;CACT,QAAQ;CACR,gBAAgB;AAClB;AAEA,MAAa,oBAAoB;CAC/B,UAAU;CACV,eAAe;CACf,eAAe;AACjB;AAiBA,MAAa,iBAAiB;CAC5B,aAAa;CACb,gBAAgB;CAChB,YAAY;AACd;AAEA,MAAa,iBAAiB;CAC5B,WAAW;CACX,UAAU;CACV,UAAU;CACV,OAAO;CACP,QAAQ;CACR,QAAQ;CACR,YAAY;CACZ,YAAY;CACZ,UAAU;AACZ;AAEA,MAAa,gBAAgB;CAC3B,iBAAiB;CACjB,QAAQ;CACR,WAAW;CACX,SAAS;AACX"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
2
|
-
const require_registry = require('./registry-
|
|
2
|
+
const require_registry = require('./registry-DYgvb62e.cjs');
|
|
3
3
|
|
|
4
4
|
//#region src/semantic-conventions.ts
|
|
5
5
|
function httpRequestHeaderAttribute(name) {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { C as URLAttributes, d as HTTPAttributes, y as ServiceAttributes } from "./registry-DVSmWg6Y.js";
|
|
2
2
|
|
|
3
3
|
//#region src/semantic-conventions.ts
|
|
4
4
|
function httpRequestHeaderAttribute(name) {
|