autotel 7.4.0 → 7.5.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 +17 -0
- package/dist/auto.cjs +1 -1
- package/dist/auto.js +1 -1
- package/dist/{canonical-log-line-processor-DolzdawH.cjs → canonical-log-line-processor-B-tzezhk.cjs} +24 -10
- package/dist/{canonical-log-line-processor-l0Aqe6yp.d.cts → canonical-log-line-processor-C0Z_N4oL.d.cts} +17 -3
- package/dist/{canonical-log-line-processor-hFUmS__K.js → canonical-log-line-processor-CBv-OCp4.js} +24 -10
- package/dist/{canonical-log-line-processor-cPB4Axk-.d.ts → canonical-log-line-processor-Yq4cXcD5.d.ts} +17 -3
- 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.cjs +1 -1
- package/dist/event.js +1 -1
- package/dist/{functional-C4js2vTM.js → functional-B86zszmZ.js} +1 -1
- package/dist/{functional-DHlD7V0x.cjs → functional-BOZ3me6w.cjs} +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.cjs +3 -3
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +3 -3
- package/dist/{init-CsKK9vZO.js → init-B2kv4bLO.js} +31 -12
- package/dist/{init-8GSy2bza.d.cts → init-BU7qa-Ii.d.cts} +67 -6
- package/dist/{init-DmM7dprX.cjs → init-CNUkdwke.cjs} +31 -12
- package/dist/{init-UnKrXhpq.d.ts → init-DDCgmfa4.d.ts} +67 -6
- package/dist/instrumentation.cjs +1 -1
- package/dist/instrumentation.js +1 -1
- package/dist/messaging.cjs +2 -2
- package/dist/messaging.js +2 -2
- package/dist/processors.cjs +1 -1
- package/dist/processors.d.cts +1 -1
- package/dist/processors.d.ts +1 -1
- package/dist/processors.js +1 -1
- package/dist/sampling.cjs +1 -1
- package/dist/sampling.js +1 -1
- package/dist/semantic-helpers.cjs +1 -1
- package/dist/semantic-helpers.js +1 -1
- package/dist/tail-sampling-processor.cjs +1 -1
- package/dist/tail-sampling-processor.js +1 -1
- 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.cjs +1 -1
- package/dist/yaml-config.d.cts +1 -1
- package/dist/yaml-config.d.ts +1 -1
- package/dist/yaml-config.js +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1836,6 +1836,23 @@ WHERE duration_ms > 200
|
|
|
1836
1836
|
|
|
1837
1837
|
### Configuration Options
|
|
1838
1838
|
|
|
1839
|
+
To keep canonical lines in a platform logger and send the same records to
|
|
1840
|
+
Grafana Loki over OTLP, enable both destinations. Selecting `otel: true`
|
|
1841
|
+
auto-configures log export from `endpoint`; an explicit `logs: false` or
|
|
1842
|
+
`AUTOTEL_LOGS=off` still wins.
|
|
1843
|
+
|
|
1844
|
+
```typescript
|
|
1845
|
+
init({
|
|
1846
|
+
service: 'my-app',
|
|
1847
|
+
endpoint: process.env.OTEL_EXPORTER_OTLP_ENDPOINT,
|
|
1848
|
+
canonicalLogLines: {
|
|
1849
|
+
enabled: true,
|
|
1850
|
+
logger: [pino(), auditLogger],
|
|
1851
|
+
otel: true,
|
|
1852
|
+
},
|
|
1853
|
+
});
|
|
1854
|
+
```
|
|
1855
|
+
|
|
1839
1856
|
```typescript
|
|
1840
1857
|
init({
|
|
1841
1858
|
service: 'my-app',
|
package/dist/auto.cjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
const require_rolldown_runtime = require('./rolldown-runtime-C_NdSu1c.cjs');
|
|
2
|
-
const require_init = require('./init-
|
|
2
|
+
const require_init = require('./init-CNUkdwke.cjs');
|
|
3
3
|
let node_module = require("node:module");
|
|
4
4
|
node_module = require_rolldown_runtime.__toESM(node_module, 1);
|
|
5
5
|
let import_in_the_middle = require("import-in-the-middle");
|
package/dist/auto.js
CHANGED
package/dist/{canonical-log-line-processor-DolzdawH.cjs → canonical-log-line-processor-B-tzezhk.cjs}
RENAMED
|
@@ -233,7 +233,8 @@ const SEVERITY_NUMBERS = /* @__PURE__ */ new Map([
|
|
|
233
233
|
* ```
|
|
234
234
|
*/
|
|
235
235
|
var CanonicalLogLineProcessor = class {
|
|
236
|
-
|
|
236
|
+
loggers;
|
|
237
|
+
useOtel;
|
|
237
238
|
rootSpansOnly;
|
|
238
239
|
minLevel;
|
|
239
240
|
messageFormat;
|
|
@@ -245,7 +246,8 @@ var CanonicalLogLineProcessor = class {
|
|
|
245
246
|
pretty;
|
|
246
247
|
getOTelLogger = null;
|
|
247
248
|
constructor(options = {}) {
|
|
248
|
-
this.
|
|
249
|
+
this.loggers = options.logger ? Array.isArray(options.logger) ? options.logger.filter(Boolean) : [options.logger] : [];
|
|
250
|
+
this.useOtel = options.otel ?? this.loggers.length === 0;
|
|
249
251
|
this.rootSpansOnly = options.rootSpansOnly ?? false;
|
|
250
252
|
this.minLevel = options.minLevel ?? "info";
|
|
251
253
|
this.messageFormat = options.messageFormat ?? ((span) => `[${span.name}] Request completed`);
|
|
@@ -255,7 +257,7 @@ var CanonicalLogLineProcessor = class {
|
|
|
255
257
|
this.drain = options.drain;
|
|
256
258
|
this.onDrainError = options.onDrainError;
|
|
257
259
|
this.pretty = options.pretty ?? (require_values.hasProcess() && process.env.NODE_ENV === "development");
|
|
258
|
-
if (
|
|
260
|
+
if (this.useOtel) this.getOTelLogger = () => _opentelemetry_api_logs.logs.getLogger("autotel.canonical-log-line");
|
|
259
261
|
}
|
|
260
262
|
buildKeepPredicate(keep) {
|
|
261
263
|
if (!keep || keep.length === 0) return void 0;
|
|
@@ -287,10 +289,12 @@ var CanonicalLogLineProcessor = class {
|
|
|
287
289
|
};
|
|
288
290
|
if (this.shouldEmit && !this.shouldEmit(eventContext)) return;
|
|
289
291
|
if (this.pretty) console.log(formatPrettyLogLine(eventContext));
|
|
290
|
-
if (this.
|
|
291
|
-
|
|
292
|
+
if (this.loggers.length > 0) this.emitViaLogger(level, message, canonicalLogLine);
|
|
293
|
+
if (this.getOTelLogger) try {
|
|
292
294
|
const otelLogger = this.getOTelLogger();
|
|
293
295
|
this.emitViaOTel(level, message, canonicalLogLine, otelLogger);
|
|
296
|
+
} catch (error) {
|
|
297
|
+
this.reportInternalWarning("canonical log line OTel emission failed", error);
|
|
294
298
|
}
|
|
295
299
|
if (this.drain) Promise.resolve(this.drain(eventContext)).catch((error) => {
|
|
296
300
|
if (this.onDrainError) {
|
|
@@ -328,7 +332,11 @@ var CanonicalLogLineProcessor = class {
|
|
|
328
332
|
return redacted;
|
|
329
333
|
}
|
|
330
334
|
emitViaLogger(level, message, canonicalLogLine) {
|
|
331
|
-
this.
|
|
335
|
+
for (const logger of this.loggers) try {
|
|
336
|
+
logger[level](canonicalLogLine, message);
|
|
337
|
+
} catch (error) {
|
|
338
|
+
this.reportInternalWarning("canonical log line logger emission failed", error);
|
|
339
|
+
}
|
|
332
340
|
}
|
|
333
341
|
emitViaOTel(level, message, canonicalLogLine, otelLogger) {
|
|
334
342
|
const otelAttributes = {};
|
|
@@ -364,11 +372,17 @@ var CanonicalLogLineProcessor = class {
|
|
|
364
372
|
}
|
|
365
373
|
reportInternalWarning(message, cause) {
|
|
366
374
|
const err = cause === void 0 ? "unknown error" : require_values.toError(cause).message;
|
|
367
|
-
if (this.
|
|
368
|
-
|
|
369
|
-
|
|
375
|
+
if (this.loggers.length > 0) {
|
|
376
|
+
let reported = false;
|
|
377
|
+
for (const logger of this.loggers) try {
|
|
378
|
+
logger.warn({ error: err }, `[autotel] ${message}`);
|
|
379
|
+
reported = true;
|
|
380
|
+
} catch {}
|
|
381
|
+
if (reported) return;
|
|
370
382
|
}
|
|
371
|
-
|
|
383
|
+
try {
|
|
384
|
+
console.warn(`[autotel] ${message}: ${err}`);
|
|
385
|
+
} catch {}
|
|
372
386
|
}
|
|
373
387
|
async forceFlush() {}
|
|
374
388
|
async shutdown() {}
|
|
@@ -22,8 +22,21 @@ interface KeepCondition {
|
|
|
22
22
|
path?: string;
|
|
23
23
|
}
|
|
24
24
|
interface CanonicalLogLineOptions {
|
|
25
|
-
/**
|
|
26
|
-
|
|
25
|
+
/**
|
|
26
|
+
* Logger(s) to emit canonical log lines through. Pass an array to fan out to
|
|
27
|
+
* several. When omitted, lines go to the OTel Logs API instead.
|
|
28
|
+
*/
|
|
29
|
+
logger?: Logger | Logger[];
|
|
30
|
+
/**
|
|
31
|
+
* Also emit through the OTel Logs API (and so to an OTLP logs backend such
|
|
32
|
+
* as Loki) alongside any `logger`.
|
|
33
|
+
*
|
|
34
|
+
* Defaults to true only when no `logger` is given, which is the historical
|
|
35
|
+
* either/or behaviour. Set it explicitly to have both: a console/pino logger
|
|
36
|
+
* keeps lines in the platform's own log view while OTLP carries the same
|
|
37
|
+
* lines to your backend.
|
|
38
|
+
*/
|
|
39
|
+
otel?: boolean;
|
|
27
40
|
/** Only emit canonical log lines for root spans (default: false) */
|
|
28
41
|
rootSpansOnly?: boolean;
|
|
29
42
|
/** Minimum log level for canonical log lines (default: 'info') */
|
|
@@ -116,7 +129,8 @@ interface CanonicalLogLineOptions {
|
|
|
116
129
|
* ```
|
|
117
130
|
*/
|
|
118
131
|
declare class CanonicalLogLineProcessor implements SpanProcessor {
|
|
119
|
-
private
|
|
132
|
+
private loggers;
|
|
133
|
+
private useOtel;
|
|
120
134
|
private rootSpansOnly;
|
|
121
135
|
private minLevel;
|
|
122
136
|
private messageFormat;
|
package/dist/{canonical-log-line-processor-hFUmS__K.js → canonical-log-line-processor-CBv-OCp4.js}
RENAMED
|
@@ -233,7 +233,8 @@ const SEVERITY_NUMBERS = /* @__PURE__ */ new Map([
|
|
|
233
233
|
* ```
|
|
234
234
|
*/
|
|
235
235
|
var CanonicalLogLineProcessor = class {
|
|
236
|
-
|
|
236
|
+
loggers;
|
|
237
|
+
useOtel;
|
|
237
238
|
rootSpansOnly;
|
|
238
239
|
minLevel;
|
|
239
240
|
messageFormat;
|
|
@@ -245,7 +246,8 @@ var CanonicalLogLineProcessor = class {
|
|
|
245
246
|
pretty;
|
|
246
247
|
getOTelLogger = null;
|
|
247
248
|
constructor(options = {}) {
|
|
248
|
-
this.
|
|
249
|
+
this.loggers = options.logger ? Array.isArray(options.logger) ? options.logger.filter(Boolean) : [options.logger] : [];
|
|
250
|
+
this.useOtel = options.otel ?? this.loggers.length === 0;
|
|
249
251
|
this.rootSpansOnly = options.rootSpansOnly ?? false;
|
|
250
252
|
this.minLevel = options.minLevel ?? "info";
|
|
251
253
|
this.messageFormat = options.messageFormat ?? ((span) => `[${span.name}] Request completed`);
|
|
@@ -255,7 +257,7 @@ var CanonicalLogLineProcessor = class {
|
|
|
255
257
|
this.drain = options.drain;
|
|
256
258
|
this.onDrainError = options.onDrainError;
|
|
257
259
|
this.pretty = options.pretty ?? (hasProcess() && process.env.NODE_ENV === "development");
|
|
258
|
-
if (
|
|
260
|
+
if (this.useOtel) this.getOTelLogger = () => logs.getLogger("autotel.canonical-log-line");
|
|
259
261
|
}
|
|
260
262
|
buildKeepPredicate(keep) {
|
|
261
263
|
if (!keep || keep.length === 0) return void 0;
|
|
@@ -287,10 +289,12 @@ var CanonicalLogLineProcessor = class {
|
|
|
287
289
|
};
|
|
288
290
|
if (this.shouldEmit && !this.shouldEmit(eventContext)) return;
|
|
289
291
|
if (this.pretty) console.log(formatPrettyLogLine(eventContext));
|
|
290
|
-
if (this.
|
|
291
|
-
|
|
292
|
+
if (this.loggers.length > 0) this.emitViaLogger(level, message, canonicalLogLine);
|
|
293
|
+
if (this.getOTelLogger) try {
|
|
292
294
|
const otelLogger = this.getOTelLogger();
|
|
293
295
|
this.emitViaOTel(level, message, canonicalLogLine, otelLogger);
|
|
296
|
+
} catch (error) {
|
|
297
|
+
this.reportInternalWarning("canonical log line OTel emission failed", error);
|
|
294
298
|
}
|
|
295
299
|
if (this.drain) Promise.resolve(this.drain(eventContext)).catch((error) => {
|
|
296
300
|
if (this.onDrainError) {
|
|
@@ -328,7 +332,11 @@ var CanonicalLogLineProcessor = class {
|
|
|
328
332
|
return redacted;
|
|
329
333
|
}
|
|
330
334
|
emitViaLogger(level, message, canonicalLogLine) {
|
|
331
|
-
this.
|
|
335
|
+
for (const logger of this.loggers) try {
|
|
336
|
+
logger[level](canonicalLogLine, message);
|
|
337
|
+
} catch (error) {
|
|
338
|
+
this.reportInternalWarning("canonical log line logger emission failed", error);
|
|
339
|
+
}
|
|
332
340
|
}
|
|
333
341
|
emitViaOTel(level, message, canonicalLogLine, otelLogger) {
|
|
334
342
|
const otelAttributes = {};
|
|
@@ -364,11 +372,17 @@ var CanonicalLogLineProcessor = class {
|
|
|
364
372
|
}
|
|
365
373
|
reportInternalWarning(message, cause) {
|
|
366
374
|
const err = cause === void 0 ? "unknown error" : toError(cause).message;
|
|
367
|
-
if (this.
|
|
368
|
-
|
|
369
|
-
|
|
375
|
+
if (this.loggers.length > 0) {
|
|
376
|
+
let reported = false;
|
|
377
|
+
for (const logger of this.loggers) try {
|
|
378
|
+
logger.warn({ error: err }, `[autotel] ${message}`);
|
|
379
|
+
reported = true;
|
|
380
|
+
} catch {}
|
|
381
|
+
if (reported) return;
|
|
370
382
|
}
|
|
371
|
-
|
|
383
|
+
try {
|
|
384
|
+
console.warn(`[autotel] ${message}: ${err}`);
|
|
385
|
+
} catch {}
|
|
372
386
|
}
|
|
373
387
|
async forceFlush() {}
|
|
374
388
|
async shutdown() {}
|
|
@@ -22,8 +22,21 @@ interface KeepCondition {
|
|
|
22
22
|
path?: string;
|
|
23
23
|
}
|
|
24
24
|
interface CanonicalLogLineOptions {
|
|
25
|
-
/**
|
|
26
|
-
|
|
25
|
+
/**
|
|
26
|
+
* Logger(s) to emit canonical log lines through. Pass an array to fan out to
|
|
27
|
+
* several. When omitted, lines go to the OTel Logs API instead.
|
|
28
|
+
*/
|
|
29
|
+
logger?: Logger | Logger[];
|
|
30
|
+
/**
|
|
31
|
+
* Also emit through the OTel Logs API (and so to an OTLP logs backend such
|
|
32
|
+
* as Loki) alongside any `logger`.
|
|
33
|
+
*
|
|
34
|
+
* Defaults to true only when no `logger` is given, which is the historical
|
|
35
|
+
* either/or behaviour. Set it explicitly to have both: a console/pino logger
|
|
36
|
+
* keeps lines in the platform's own log view while OTLP carries the same
|
|
37
|
+
* lines to your backend.
|
|
38
|
+
*/
|
|
39
|
+
otel?: boolean;
|
|
27
40
|
/** Only emit canonical log lines for root spans (default: false) */
|
|
28
41
|
rootSpansOnly?: boolean;
|
|
29
42
|
/** Minimum log level for canonical log lines (default: 'info') */
|
|
@@ -116,7 +129,8 @@ interface CanonicalLogLineOptions {
|
|
|
116
129
|
* ```
|
|
117
130
|
*/
|
|
118
131
|
declare class CanonicalLogLineProcessor implements SpanProcessor {
|
|
119
|
-
private
|
|
132
|
+
private loggers;
|
|
133
|
+
private useOtel;
|
|
120
134
|
private rootSpansOnly;
|
|
121
135
|
private minLevel;
|
|
122
136
|
private messageFormat;
|
package/dist/correlation-id.cjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
2
|
-
const require_init = require('./init-
|
|
2
|
+
const require_init = require('./init-CNUkdwke.cjs');
|
|
3
3
|
|
|
4
4
|
exports.CORRELATION_ID_BAGGAGE_KEY = require_init.CORRELATION_ID_BAGGAGE_KEY;
|
|
5
5
|
exports.generateCorrelationId = require_init.generateCorrelationId;
|
package/dist/correlation-id.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { $ as getCorrelationStorage, Q as getCorrelationId, X as CORRELATION_ID_BAGGAGE_KEY, Z as generateCorrelationId, et as getOrCreateCorrelationId, nt as setCorrelationId, rt as setCorrelationIdInBaggage, tt as runWithCorrelationId } from "./init-
|
|
1
|
+
import { $ as getCorrelationStorage, Q as getCorrelationId, X as CORRELATION_ID_BAGGAGE_KEY, Z as generateCorrelationId, et as getOrCreateCorrelationId, nt as setCorrelationId, rt as setCorrelationIdInBaggage, tt as runWithCorrelationId } from "./init-B2kv4bLO.js";
|
|
2
2
|
|
|
3
3
|
export { CORRELATION_ID_BAGGAGE_KEY, generateCorrelationId, getCorrelationId, getCorrelationStorage, getOrCreateCorrelationId, runWithCorrelationId, setCorrelationId, setCorrelationIdInBaggage };
|
package/dist/decorators.cjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
2
2
|
const require_values = require('./values-DApyq53y.cjs');
|
|
3
3
|
const require_config = require('./config.cjs');
|
|
4
|
-
const require_init = require('./init-
|
|
4
|
+
const require_init = require('./init-CNUkdwke.cjs');
|
|
5
5
|
let _opentelemetry_api = require("@opentelemetry/api");
|
|
6
6
|
|
|
7
7
|
//#region src/decorators.ts
|
package/dist/decorators.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { y as splitNameOrOptions } from "./values-BenyvWKz.js";
|
|
2
2
|
import { getConfig } from "./config.js";
|
|
3
|
-
import { U as createTraceContext } from "./init-
|
|
3
|
+
import { U as createTraceContext } from "./init-B2kv4bLO.js";
|
|
4
4
|
import { SpanStatusCode } from "@opentelemetry/api";
|
|
5
5
|
|
|
6
6
|
//#region src/decorators.ts
|
package/dist/event.cjs
CHANGED
package/dist/event.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { l as asString, m as isDevelopment } from "./values-BenyvWKz.js";
|
|
2
2
|
import { getForceFlushableProvider } from "./tracer-provider.js";
|
|
3
3
|
import { getConfig } from "./config.js";
|
|
4
|
-
import { C as AUTOTEL_SAMPLING_RATE, D as AlwaysSampler, G as getActiveContextWithBaggage, I as debugCaptureRequested, J as getEventQueue, K as getContextStorage, T as AUTOTEL_SAMPLING_TAIL_KEEP, U as createTraceContext, h as runInOperationContext, i as getSdk, n as getConfiguredSampler, q as hasExplicitSpanStatus, t as getConfig$1, w as AUTOTEL_SAMPLING_TAIL_EVALUATED, z as isForceKept } from "./init-
|
|
4
|
+
import { C as AUTOTEL_SAMPLING_RATE, D as AlwaysSampler, G as getActiveContextWithBaggage, I as debugCaptureRequested, J as getEventQueue, K as getContextStorage, T as AUTOTEL_SAMPLING_TAIL_KEEP, U as createTraceContext, h as runInOperationContext, i as getSdk, n as getConfiguredSampler, q as hasExplicitSpanStatus, t as getConfig$1, w as AUTOTEL_SAMPLING_TAIL_EVALUATED, z as isForceKept } from "./init-B2kv4bLO.js";
|
|
5
5
|
import { evidenceAttribute } from "./evidence.js";
|
|
6
6
|
import { setSpanName } from "./trace-helpers.js";
|
|
7
7
|
import { SpanStatusCode, context, propagation, trace } from "@opentelemetry/api";
|
|
@@ -2,7 +2,7 @@ const require_rolldown_runtime = require('./rolldown-runtime-C_NdSu1c.cjs');
|
|
|
2
2
|
const require_values = require('./values-DApyq53y.cjs');
|
|
3
3
|
const require_tracer_provider = require('./tracer-provider.cjs');
|
|
4
4
|
const require_config = require('./config.cjs');
|
|
5
|
-
const require_init = require('./init-
|
|
5
|
+
const require_init = require('./init-CNUkdwke.cjs');
|
|
6
6
|
const require_evidence = require('./evidence.cjs');
|
|
7
7
|
const require_trace_helpers = require('./trace-helpers.cjs');
|
|
8
8
|
let _opentelemetry_api = require("@opentelemetry/api");
|
package/dist/functional.cjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
2
|
-
const require_functional = require('./functional-
|
|
2
|
+
const require_functional = require('./functional-BOZ3me6w.cjs');
|
|
3
3
|
|
|
4
4
|
exports.ctx = require_functional.ctx;
|
|
5
5
|
exports.getActiveTraceContext = require_functional.getActiveTraceContext;
|
package/dist/functional.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { a as trace, c as withTracing, i as span, n as getActiveTraceContext, o as withBaggage, r as instrument, s as withNewContext, t as ctx } from "./functional-
|
|
1
|
+
import { a as trace, c as withTracing, i as span, n as getActiveTraceContext, o as withBaggage, r as instrument, s as withNewContext, t as ctx } from "./functional-B86zszmZ.js";
|
|
2
2
|
|
|
3
3
|
export { ctx, getActiveTraceContext, instrument, span, trace, withBaggage, withNewContext, withTracing };
|
package/dist/http.cjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
2
2
|
const require_values = require('./values-DApyq53y.cjs');
|
|
3
3
|
const require_config = require('./config.cjs');
|
|
4
|
-
const require_init = require('./init-
|
|
4
|
+
const require_init = require('./init-CNUkdwke.cjs');
|
|
5
5
|
let _opentelemetry_api = require("@opentelemetry/api");
|
|
6
6
|
|
|
7
7
|
//#region src/http.ts
|
package/dist/http.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { _ as readProperty, h as isFunction, i as asNumber, l as asString } from "./values-BenyvWKz.js";
|
|
2
2
|
import { getConfig } from "./config.js";
|
|
3
|
-
import { G as getActiveContextWithBaggage } from "./init-
|
|
3
|
+
import { G as getActiveContextWithBaggage } from "./init-B2kv4bLO.js";
|
|
4
4
|
import { SpanStatusCode, context, propagation } from "@opentelemetry/api";
|
|
5
5
|
|
|
6
6
|
//#region src/http.ts
|
package/dist/index.cjs
CHANGED
|
@@ -3,13 +3,13 @@ const require_rolldown_runtime = require('./rolldown-runtime-C_NdSu1c.cjs');
|
|
|
3
3
|
const require_values = require('./values-DApyq53y.cjs');
|
|
4
4
|
const require_tracer_provider = require('./tracer-provider.cjs');
|
|
5
5
|
const require_structured_error = require('./structured-error--_wXpd_C.cjs');
|
|
6
|
-
const require_init = require('./init-
|
|
6
|
+
const require_init = require('./init-CNUkdwke.cjs');
|
|
7
7
|
const require_filtering_span_processor = require('./filtering-span-processor.cjs');
|
|
8
8
|
const require_span_name_normalizer = require('./span-name-normalizer.cjs');
|
|
9
9
|
const require_attribute_redacting_processor = require('./attribute-redacting-processor.cjs');
|
|
10
|
-
const require_canonical_log_line_processor = require('./canonical-log-line-processor-
|
|
10
|
+
const require_canonical_log_line_processor = require('./canonical-log-line-processor-B-tzezhk.cjs');
|
|
11
11
|
const require_metric = require('./metric.cjs');
|
|
12
|
-
const require_functional = require('./functional-
|
|
12
|
+
const require_functional = require('./functional-BOZ3me6w.cjs');
|
|
13
13
|
const require_trace_helpers = require('./trace-helpers.cjs');
|
|
14
14
|
const require_stable_hash = require('./stable-hash-C0pOegH_.cjs');
|
|
15
15
|
const require_correlated_events = require('./correlated-events-CcuknWnU.cjs');
|
package/dist/index.d.cts
CHANGED
|
@@ -10,9 +10,9 @@ import { DrainPipelineOptions, PipelineDrainFn, createDrainPipeline } from "./dr
|
|
|
10
10
|
import { a as EventSchemaMetadata, c as FunnelStatus, l as OutcomeStatus, n as EventAttributeValue, o as EventSubscriber, r as EventAttributes, s as EventTrackingOptions, t as AutotelEventContext } from "./event-subscriber-DMACQA-1.cjs";
|
|
11
11
|
import { Event, EventsOptions, getEvents, resetEvents } from "./event.cjs";
|
|
12
12
|
import { n as FilteringSpanProcessorOptions, r as SpanFilterPredicate, t as FilteringSpanProcessor } from "./filtering-span-processor-BpDagWNa.cjs";
|
|
13
|
-
import { a as AutotelConfig, c as StringRedactor, i as lockLogger, l as createStringRedactor, n as isInitialized, r as isLoggerLocked, s as ProcessHandlersConfig, t as init } from "./init-
|
|
13
|
+
import { a as AutotelConfig, c as StringRedactor, i as lockLogger, l as createStringRedactor, n as isInitialized, r as isLoggerLocked, s as ProcessHandlersConfig, t as init } from "./init-BU7qa-Ii.cjs";
|
|
14
14
|
import { a as SpanNameNormalizerPreset, i as SpanNameNormalizerFn, n as NORMALIZER_PRESETS, o as SpanNameNormalizingProcessor, r as SpanNameNormalizerConfig, s as SpanNameNormalizingProcessorOptions, t as NORMALIZER_PATTERNS } from "./span-name-normalizer-CN1-8C76.cjs";
|
|
15
|
-
import "./canonical-log-line-processor-
|
|
15
|
+
import "./canonical-log-line-processor-C0Z_N4oL.cjs";
|
|
16
16
|
import { i as defineEvent, n as DefinedEvent, r as SchemaLike, t as DefineEventOptions } from "./define-event-BNeuKUPv.cjs";
|
|
17
17
|
import { ParsedError, parseError } from "./parse-error.cjs";
|
|
18
18
|
import { Metric, MetricsOptions, getMetrics, resetMetrics } from "./metric.cjs";
|
package/dist/index.d.ts
CHANGED
|
@@ -10,9 +10,9 @@ import { DrainPipelineOptions, PipelineDrainFn, createDrainPipeline } from "./dr
|
|
|
10
10
|
import { a as EventSchemaMetadata, c as FunnelStatus, l as OutcomeStatus, n as EventAttributeValue, o as EventSubscriber, r as EventAttributes, s as EventTrackingOptions, t as AutotelEventContext } from "./event-subscriber-DMACQA-1.js";
|
|
11
11
|
import { Event, EventsOptions, getEvents, resetEvents } from "./event.js";
|
|
12
12
|
import { n as FilteringSpanProcessorOptions, r as SpanFilterPredicate, t as FilteringSpanProcessor } from "./filtering-span-processor-BpDagWNa.js";
|
|
13
|
-
import { a as AutotelConfig, c as StringRedactor, i as lockLogger, l as createStringRedactor, n as isInitialized, r as isLoggerLocked, s as ProcessHandlersConfig, t as init } from "./init-
|
|
13
|
+
import { a as AutotelConfig, c as StringRedactor, i as lockLogger, l as createStringRedactor, n as isInitialized, r as isLoggerLocked, s as ProcessHandlersConfig, t as init } from "./init-DDCgmfa4.js";
|
|
14
14
|
import { a as SpanNameNormalizerPreset, i as SpanNameNormalizerFn, n as NORMALIZER_PRESETS, o as SpanNameNormalizingProcessor, r as SpanNameNormalizerConfig, s as SpanNameNormalizingProcessorOptions, t as NORMALIZER_PATTERNS } from "./span-name-normalizer-CN1-8C76.js";
|
|
15
|
-
import "./canonical-log-line-processor-
|
|
15
|
+
import "./canonical-log-line-processor-Yq4cXcD5.js";
|
|
16
16
|
import { i as defineEvent, n as DefinedEvent, r as SchemaLike, t as DefineEventOptions } from "./define-event-Bd8f8mST.js";
|
|
17
17
|
import { ParsedError, parseError } from "./parse-error.js";
|
|
18
18
|
import { Metric, MetricsOptions, getMetrics, resetMetrics } from "./metric.js";
|
package/dist/index.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { g as nonEmptyString, i as asNumber, l as asString, r as asFunction, s as asRecord, x as toError } from "./values-BenyvWKz.js";
|
|
2
2
|
import { getAutotelTracer, getAutotelTracerProvider, setAutotelTracerProvider } from "./tracer-provider.js";
|
|
3
3
|
import { a as flattenToAttributes, i as structuredErrorToJSON, n as getStructuredErrorAttributes, o as toAttributeValue, r as recordStructuredError, t as createStructuredError } from "./structured-error-YIuka-FE.js";
|
|
4
|
-
import { B as markForceKept, D as AlwaysSampler, E as AdaptiveSampler, F as createLinkFromHeaders, H as samplingPresets, J as getEventQueue, L as extractLinksFromBatch, M as NeverSampler, N as RandomSampler, P as UserIdSampler, Q as getCorrelationId, S as AUTOTEL_DEBUG_BAGGAGE_KEY, T as AUTOTEL_SAMPLING_TAIL_KEEP, U as createTraceContext, V as resolveSamplingPreset, W as defineBaggageSchema, X as CORRELATION_ID_BAGGAGE_KEY, Y as track, Z as generateCorrelationId, a as init, b as BaggageSpanProcessor, c as lockLogger, d as Event, et as getOrCreateCorrelationId, f as getEvents, h as runInOperationContext, l as flush, m as getOperationContext, nt as setCorrelationId, o as isInitialized, p as resetEvents, rt as setCorrelationIdInBaggage, s as isLoggerLocked, tt as runWithCorrelationId, u as shutdown, w as AUTOTEL_SAMPLING_TAIL_EVALUATED, y as createStringRedactor } from "./init-
|
|
4
|
+
import { B as markForceKept, D as AlwaysSampler, E as AdaptiveSampler, F as createLinkFromHeaders, H as samplingPresets, J as getEventQueue, L as extractLinksFromBatch, M as NeverSampler, N as RandomSampler, P as UserIdSampler, Q as getCorrelationId, S as AUTOTEL_DEBUG_BAGGAGE_KEY, T as AUTOTEL_SAMPLING_TAIL_KEEP, U as createTraceContext, V as resolveSamplingPreset, W as defineBaggageSchema, X as CORRELATION_ID_BAGGAGE_KEY, Y as track, Z as generateCorrelationId, a as init, b as BaggageSpanProcessor, c as lockLogger, d as Event, et as getOrCreateCorrelationId, f as getEvents, h as runInOperationContext, l as flush, m as getOperationContext, nt as setCorrelationId, o as isInitialized, p as resetEvents, rt as setCorrelationIdInBaggage, s as isLoggerLocked, tt as runWithCorrelationId, u as shutdown, w as AUTOTEL_SAMPLING_TAIL_EVALUATED, y as createStringRedactor } from "./init-B2kv4bLO.js";
|
|
5
5
|
import { FilteringSpanProcessor } from "./filtering-span-processor.js";
|
|
6
6
|
import { NORMALIZER_PATTERNS, NORMALIZER_PRESETS, SpanNameNormalizingProcessor } from "./span-name-normalizer.js";
|
|
7
7
|
import { AttributeRedactingProcessor, REDACTOR_PATTERNS, REDACTOR_PRESETS, builtinPatterns, createAttributeRedactor, createRedactedSpan, normalizeAttributeRedactorConfig } from "./attribute-redacting-processor.js";
|
|
8
|
-
import { n as formatDuration } from "./canonical-log-line-processor-
|
|
8
|
+
import { n as formatDuration } from "./canonical-log-line-processor-CBv-OCp4.js";
|
|
9
9
|
import { Metric, getMetrics, resetMetrics } from "./metric.js";
|
|
10
|
-
import { a as trace$2, c as withTracing, i as span, n as getActiveTraceContext, o as withBaggage, r as instrument, s as withNewContext, t as ctx } from "./functional-
|
|
10
|
+
import { a as trace$2, c as withTracing, i as span, n as getActiveTraceContext, o as withBaggage, r as instrument, s as withNewContext, t as ctx } from "./functional-B86zszmZ.js";
|
|
11
11
|
import { createDeterministicTraceId, enrichWithTraceContext, finalizeSpan, flattenMetadata, getActiveContext, getActiveSpan, getTraceContext, getTracer, isTracing, resolveTraceUrl, runWithSpan } from "./trace-helpers.js";
|
|
12
12
|
import { t as hashJson } from "./stable-hash-BkoAYVks.js";
|
|
13
13
|
import { t as emitCorrelatedEvent } from "./correlated-events-DwMMbItg.js";
|
|
@@ -8,7 +8,7 @@ import { PolicyLogRecordProcessor, policySpanFilter, setPolicies, watchPolicyFil
|
|
|
8
8
|
import { SpanNameNormalizingProcessor } from "./span-name-normalizer.js";
|
|
9
9
|
import { AttributeRedactingProcessor, REDACTOR_PRESETS, normalizeAttributeRedactorConfig } from "./attribute-redacting-processor.js";
|
|
10
10
|
import { t as PrettyConsoleExporter } from "./pretty-console-exporter-DqKl_q9z.js";
|
|
11
|
-
import { t as CanonicalLogLineProcessor } from "./canonical-log-line-processor-
|
|
11
|
+
import { t as CanonicalLogLineProcessor } from "./canonical-log-line-processor-CBv-OCp4.js";
|
|
12
12
|
import { resetMetrics } from "./metric.js";
|
|
13
13
|
import { NodeSDK } from "@opentelemetry/sdk-node";
|
|
14
14
|
import { AlwaysOffSampler, AlwaysOnSampler, BatchSpanProcessor, ConsoleSpanExporter, ParentBasedSampler, SamplingDecision, SimpleSpanProcessor, TraceIdRatioBasedSampler } from "@opentelemetry/sdk-trace-base";
|
|
@@ -3492,7 +3492,7 @@ function loadGRPCTraceExporter() {
|
|
|
3492
3492
|
OTLPTraceExporterGRPC = requireModule("@opentelemetry/exporter-trace-otlp-grpc").OTLPTraceExporter;
|
|
3493
3493
|
return OTLPTraceExporterGRPC;
|
|
3494
3494
|
} catch {
|
|
3495
|
-
throw new Error("gRPC trace exporter not found. Install @opentelemetry/exporter-trace-otlp-grpc");
|
|
3495
|
+
throw new Error("gRPC trace exporter not found. Install @opentelemetry/exporter-trace-otlp-grpc. It is an optional peer dependency, and bundlers (Vercel, Nitro, esbuild) do not follow the lazy require that loads it, so add it as a direct dependency of your application, not just of autotel.");
|
|
3496
3496
|
}
|
|
3497
3497
|
}
|
|
3498
3498
|
/**
|
|
@@ -3504,7 +3504,7 @@ function loadGRPCMetricExporter() {
|
|
|
3504
3504
|
OTLPMetricExporterGRPC = requireModule("@opentelemetry/exporter-metrics-otlp-grpc").OTLPMetricExporter;
|
|
3505
3505
|
return OTLPMetricExporterGRPC;
|
|
3506
3506
|
} catch {
|
|
3507
|
-
throw new Error("gRPC metric exporter not found. Install @opentelemetry/exporter-metrics-otlp-grpc");
|
|
3507
|
+
throw new Error("gRPC metric exporter not found. Install @opentelemetry/exporter-metrics-otlp-grpc. It is an optional peer dependency, and bundlers (Vercel, Nitro, esbuild) do not follow the lazy require that loads it, so add it as a direct dependency of your application, not just of autotel.");
|
|
3508
3508
|
}
|
|
3509
3509
|
}
|
|
3510
3510
|
/**
|
|
@@ -3516,7 +3516,7 @@ function loadProtoTraceExporter() {
|
|
|
3516
3516
|
OTLPTraceExporterPROTO = requireModule("@opentelemetry/exporter-trace-otlp-proto").OTLPTraceExporter;
|
|
3517
3517
|
return OTLPTraceExporterPROTO;
|
|
3518
3518
|
} catch {
|
|
3519
|
-
throw new Error("Protobuf trace exporter not found. Install @opentelemetry/exporter-trace-otlp-proto");
|
|
3519
|
+
throw new Error("Protobuf trace exporter not found. Install @opentelemetry/exporter-trace-otlp-proto. It is an optional peer dependency, and bundlers (Vercel, Nitro, esbuild) do not follow the lazy require that loads it, so add it as a direct dependency of your application, not just of autotel. Or drop `protocol` to use the default JSON exporter, which ships with autotel and is accepted by Grafana Cloud, Honeycomb and the other hosted OTLP gateways.");
|
|
3520
3520
|
}
|
|
3521
3521
|
}
|
|
3522
3522
|
/**
|
|
@@ -3536,7 +3536,7 @@ function createMetricExporter(protocol, config) {
|
|
|
3536
3536
|
if (!OTLPMetricExporterPROTO) try {
|
|
3537
3537
|
OTLPMetricExporterPROTO = requireModule("@opentelemetry/exporter-metrics-otlp-proto").OTLPMetricExporter;
|
|
3538
3538
|
} catch {
|
|
3539
|
-
throw new Error("Protobuf metric exporter not found. Install @opentelemetry/exporter-metrics-otlp-proto");
|
|
3539
|
+
throw new Error("Protobuf metric exporter not found. Install @opentelemetry/exporter-metrics-otlp-proto. It is an optional peer dependency, and bundlers (Vercel, Nitro, esbuild) do not follow the lazy require that loads it, so add it as a direct dependency of your application, not just of autotel. Or drop `protocol` to use the default JSON exporter, which ships with autotel and is accepted by Grafana Cloud, Honeycomb and the other hosted OTLP gateways.");
|
|
3540
3540
|
}
|
|
3541
3541
|
return new OTLPMetricExporterPROTO(config);
|
|
3542
3542
|
}
|
|
@@ -3551,7 +3551,7 @@ function loadGRPCLogExporter() {
|
|
|
3551
3551
|
OTLPLogExporterGRPC = requireModule("@opentelemetry/exporter-logs-otlp-grpc").OTLPLogExporter;
|
|
3552
3552
|
return OTLPLogExporterGRPC;
|
|
3553
3553
|
} catch {
|
|
3554
|
-
throw new Error("gRPC log exporter not found. Install @opentelemetry/exporter-logs-otlp-grpc");
|
|
3554
|
+
throw new Error("gRPC log exporter not found. Install @opentelemetry/exporter-logs-otlp-grpc. It is an optional peer dependency, and bundlers (Vercel, Nitro, esbuild) do not follow the lazy require that loads it, so add it as a direct dependency of your application, not just of autotel.");
|
|
3555
3555
|
}
|
|
3556
3556
|
}
|
|
3557
3557
|
/**
|
|
@@ -3563,7 +3563,7 @@ function createLogExporter(protocol, config) {
|
|
|
3563
3563
|
if (!OTLPLogExporterPROTO) try {
|
|
3564
3564
|
OTLPLogExporterPROTO = requireModule("@opentelemetry/exporter-logs-otlp-proto").OTLPLogExporter;
|
|
3565
3565
|
} catch {
|
|
3566
|
-
throw new Error("Protobuf log exporter not found. Install @opentelemetry/exporter-logs-otlp-proto");
|
|
3566
|
+
throw new Error("Protobuf log exporter not found. Install @opentelemetry/exporter-logs-otlp-proto. It is an optional peer dependency, and bundlers (Vercel, Nitro, esbuild) do not follow the lazy require that loads it, so add it as a direct dependency of your application, not just of autotel. Or drop `protocol` to use the default JSON exporter, which ships with autotel and is accepted by Grafana Cloud, Honeycomb and the other hosted OTLP gateways.");
|
|
3567
3567
|
}
|
|
3568
3568
|
return new OTLPLogExporterPROTO(config);
|
|
3569
3569
|
}
|
|
@@ -3861,6 +3861,20 @@ function getAutoInstrumentations(integrations, manualInstrumentationNames = /* @
|
|
|
3861
3861
|
* Replaces initInstrumentation() and separate events config.
|
|
3862
3862
|
*/
|
|
3863
3863
|
/**
|
|
3864
|
+
* Records nothing and exports nothing, so a `TracerProvider` is still
|
|
3865
|
+
* registered when there is no destination. See where it is used below.
|
|
3866
|
+
*/
|
|
3867
|
+
var NoopSpanProcessor = class {
|
|
3868
|
+
onStart() {}
|
|
3869
|
+
onEnd() {}
|
|
3870
|
+
forceFlush() {
|
|
3871
|
+
return Promise.resolve();
|
|
3872
|
+
}
|
|
3873
|
+
shutdown() {
|
|
3874
|
+
return Promise.resolve();
|
|
3875
|
+
}
|
|
3876
|
+
};
|
|
3877
|
+
/**
|
|
3864
3878
|
* Adapts an Autotel Sampler to the OTel SDK Sampler interface.
|
|
3865
3879
|
*/
|
|
3866
3880
|
function toOtelSampler(sampler) {
|
|
@@ -4007,7 +4021,10 @@ function init(cfg) {
|
|
|
4007
4021
|
const version = mergedConfig.version || detectVersion();
|
|
4008
4022
|
const environment = mergedConfig.environment || process.env.NODE_ENV || "development";
|
|
4009
4023
|
const metricsEnabled = resolveMetricsFlag(mergedConfig.metrics);
|
|
4010
|
-
const
|
|
4024
|
+
const canonicalLogger = mergedConfig.canonicalLogLines?.logger ?? mergedConfig.logger;
|
|
4025
|
+
const hasCanonicalLogger = Array.isArray(canonicalLogger) ? canonicalLogger.length > 0 : canonicalLogger !== void 0;
|
|
4026
|
+
const canonicalUsesOtel = mergedConfig.canonicalLogLines?.enabled === true && (mergedConfig.canonicalLogLines.otel ?? !hasCanonicalLogger);
|
|
4027
|
+
const logsEnabled = resolveLogsFlag(mergedConfig.logs ?? (canonicalUsesOtel ? true : "auto"));
|
|
4011
4028
|
if (devtoolsConfig.enabled && devtoolsConfig.embedded) {
|
|
4012
4029
|
const devtoolsModule = _optionalRequire("autotel-devtools");
|
|
4013
4030
|
if (devtoolsModule?.createDevtools) {
|
|
@@ -4035,12 +4052,12 @@ function init(cfg) {
|
|
|
4035
4052
|
if (mergedConfig.resource) resource = resource.merge(mergedConfig.resource);
|
|
4036
4053
|
if (mergedConfig.resourceAttributes) resource = resource.merge(resourceFromAttributes(mergedConfig.resourceAttributes));
|
|
4037
4054
|
const otlpDestinations = resolveOtlpDestinations(mergedConfig, endpoint);
|
|
4038
|
-
const configuredSpanProcessors = mergedConfig.spanProcessors
|
|
4055
|
+
const configuredSpanProcessors = mergedConfig.spanProcessors !== void 0 ? mergedConfig.spanProcessors : mergedConfig.spanProcessor ? [mergedConfig.spanProcessor] : void 0;
|
|
4039
4056
|
const configuredSpanExporters = mergedConfig.spanExporters && mergedConfig.spanExporters.length > 0 ? mergedConfig.spanExporters : mergedConfig.spanExporter ? [mergedConfig.spanExporter] : void 0;
|
|
4040
4057
|
const configuredMetricReaders = mergedConfig.metricReaders && mergedConfig.metricReaders.length > 0 ? mergedConfig.metricReaders : mergedConfig.metricReader ? [mergedConfig.metricReader] : void 0;
|
|
4041
4058
|
const configuredLogRecordProcessors = mergedConfig.logRecordProcessors && mergedConfig.logRecordProcessors.length > 0 ? mergedConfig.logRecordProcessors : mergedConfig.logRecordProcessor ? [mergedConfig.logRecordProcessor] : void 0;
|
|
4042
4059
|
let spanProcessors = [];
|
|
4043
|
-
if (configuredSpanProcessors
|
|
4060
|
+
if (configuredSpanProcessors !== void 0) spanProcessors.push(...configuredSpanProcessors);
|
|
4044
4061
|
else if (configuredSpanExporters && configuredSpanExporters.length > 0) for (const exporter of configuredSpanExporters) spanProcessors.push(new TailSamplingSpanProcessor(new BatchSpanProcessor(exporter)));
|
|
4045
4062
|
else for (const destination of otlpDestinations) {
|
|
4046
4063
|
if (!destinationSupportsSignal(destination, "traces")) continue;
|
|
@@ -4059,7 +4076,8 @@ function init(cfg) {
|
|
|
4059
4076
|
else if (debugMode === true) spanProcessors.push(new SimpleSpanProcessor(new ConsoleSpanExporter()));
|
|
4060
4077
|
if (mergedConfig.canonicalLogLines?.enabled) {
|
|
4061
4078
|
const canonicalOptions = {
|
|
4062
|
-
logger:
|
|
4079
|
+
logger: canonicalLogger,
|
|
4080
|
+
otel: mergedConfig.canonicalLogLines.otel,
|
|
4063
4081
|
rootSpansOnly: mergedConfig.canonicalLogLines.rootSpansOnly,
|
|
4064
4082
|
minLevel: mergedConfig.canonicalLogLines.minLevel,
|
|
4065
4083
|
messageFormat: mergedConfig.canonicalLogLines.messageFormat,
|
|
@@ -4148,9 +4166,10 @@ function init(cfg) {
|
|
|
4148
4166
|
sampler,
|
|
4149
4167
|
instrumentations: finalInstrumentations
|
|
4150
4168
|
};
|
|
4151
|
-
|
|
4169
|
+
sdkOptions.spanProcessors = spanProcessors.length > 0 ? spanProcessors : [new NoopSpanProcessor()];
|
|
4152
4170
|
if (metricReaders.length > 0) sdkOptions.metricReaders = metricReaders;
|
|
4153
4171
|
if (logRecordProcessors && logRecordProcessors.length > 0) sdkOptions.logRecordProcessors = logRecordProcessors;
|
|
4172
|
+
else if (!process.env.OTEL_LOGS_EXPORTER) sdkOptions.logRecordProcessors = [];
|
|
4154
4173
|
sdk = mergedConfig.sdkFactory ? mergedConfig.sdkFactory(sdkOptions) : new NodeSDK(sdkOptions);
|
|
4155
4174
|
if (!sdk) throw new Error("[autotel] sdkFactory must return a NodeSDK instance");
|
|
4156
4175
|
sdk.start();
|
|
@@ -5,7 +5,7 @@ import { o as EventSubscriber } from "./event-subscriber-DMACQA-1.cjs";
|
|
|
5
5
|
import { r as SpanFilterPredicate } from "./filtering-span-processor-BpDagWNa.cjs";
|
|
6
6
|
import { r as Policy } from "./policy-CbpP4tFH.cjs";
|
|
7
7
|
import { r as SpanNameNormalizerConfig } from "./span-name-normalizer-CN1-8C76.cjs";
|
|
8
|
-
import { t as CanonicalLogLineOptions } from "./canonical-log-line-processor-
|
|
8
|
+
import { t as CanonicalLogLineOptions } from "./canonical-log-line-processor-C0Z_N4oL.cjs";
|
|
9
9
|
import { ReadableSpan, SpanExporter, SpanProcessor } from "@opentelemetry/sdk-trace-base";
|
|
10
10
|
import { Attributes } from "@opentelemetry/api";
|
|
11
11
|
import { Resource } from "@opentelemetry/resources";
|
|
@@ -261,8 +261,31 @@ interface ProcessHandlersConfig {
|
|
|
261
261
|
*/
|
|
262
262
|
interface CanonicalLogLinesConfig {
|
|
263
263
|
enabled: boolean;
|
|
264
|
-
/**
|
|
265
|
-
|
|
264
|
+
/**
|
|
265
|
+
* Logger(s) to emit canonical log lines through. Pass an array to fan out to
|
|
266
|
+
* several. When omitted, lines go to the OTel Logs API instead.
|
|
267
|
+
*
|
|
268
|
+
* Note this falls back to the top-level `logger` on AutotelConfig, so
|
|
269
|
+
* setting that alone also diverts canonical log lines away from OTLP.
|
|
270
|
+
*/
|
|
271
|
+
logger?: Logger | Logger[];
|
|
272
|
+
/**
|
|
273
|
+
* Also emit through the OTel Logs API alongside any `logger`, so the same
|
|
274
|
+
* lines reach an OTLP logs backend (Loki, and the like).
|
|
275
|
+
*
|
|
276
|
+
* Defaults to true only when no `logger` is given. Set `otel: true` with a
|
|
277
|
+
* logger to get both: the platform's own log view keeps the lines, and OTLP
|
|
278
|
+
* carries them to your backend.
|
|
279
|
+
*
|
|
280
|
+
* @example Console and Loki at once
|
|
281
|
+
* ```typescript
|
|
282
|
+
* init({
|
|
283
|
+
* endpoint: process.env.OTEL_EXPORTER_OTLP_ENDPOINT,
|
|
284
|
+
* canonicalLogLines: { enabled: true, logger: pino(), otel: true },
|
|
285
|
+
* });
|
|
286
|
+
* ```
|
|
287
|
+
*/
|
|
288
|
+
otel?: boolean;
|
|
266
289
|
/** Only emit canonical log lines for root spans (default: false). */
|
|
267
290
|
rootSpansOnly?: boolean;
|
|
268
291
|
/** Minimum log level for canonical log lines (default: 'info'). */
|
|
@@ -468,7 +491,18 @@ interface AutotelConfig {
|
|
|
468
491
|
* Single-destination shorthand. For multi-backend OTLP fan-out, use
|
|
469
492
|
* `destinations` instead.
|
|
470
493
|
* Only used if you don't provide custom exporters/processors
|
|
471
|
-
*
|
|
494
|
+
*
|
|
495
|
+
* Falls back to the OTel spec's `OTEL_EXPORTER_OTLP_ENDPOINT`, which is the
|
|
496
|
+
* variable every vendor's docs hand you (see `env-config.ts`;
|
|
497
|
+
* `OTEL_EXPORTER_OTLP_HEADERS` and `OTEL_EXPORTER_OTLP_PROTOCOL` are read
|
|
498
|
+
* the same way).
|
|
499
|
+
*
|
|
500
|
+
* With no endpoint from either source there is NO default and no fallback
|
|
501
|
+
* to localhost: the span processor list stays empty and nothing is
|
|
502
|
+
* exported, so telemetry is off rather than aimed at a collector that is
|
|
503
|
+
* not there. Point it at a local collector explicitly when you want one.
|
|
504
|
+
*
|
|
505
|
+
* @default process.env.OTEL_EXPORTER_OTLP_ENDPOINT, else no exporter
|
|
472
506
|
*/
|
|
473
507
|
endpoint?: string;
|
|
474
508
|
/**
|
|
@@ -661,13 +695,26 @@ interface AutotelConfig {
|
|
|
661
695
|
headers?: Record<string, string> | string;
|
|
662
696
|
/**
|
|
663
697
|
* OTLP protocol to use for traces, metrics, and logs
|
|
664
|
-
* - 'http': HTTP
|
|
698
|
+
* - 'http': OTLP over HTTP with a **JSON** body (default, port 4318)
|
|
699
|
+
* - 'http/protobuf': OTLP over HTTP with a protobuf body (port 4318)
|
|
665
700
|
* - 'grpc': gRPC (uses port 4317)
|
|
666
701
|
*
|
|
702
|
+
* The default is JSON, not protobuf — `createTraceExporter` falls through to
|
|
703
|
+
* `OTLPTraceExporterHTTP`, which sends `content-type: application/json`.
|
|
704
|
+
* Grafana Cloud, Honeycomb and the other hosted OTLP gateways all accept
|
|
705
|
+
* JSON, so the default needs no extra install and is what the vendor presets
|
|
706
|
+
* in `autotel-backends` rely on.
|
|
707
|
+
*
|
|
667
708
|
* Can be overridden with OTEL_EXPORTER_OTLP_PROTOCOL env var.
|
|
668
709
|
*
|
|
669
|
-
* Note:
|
|
710
|
+
* Note: only the JSON exporters ship with autotel. 'http/protobuf' and
|
|
711
|
+
* 'grpc' need optional peer dependencies, and a bundler (Vercel, Nitro,
|
|
712
|
+
* esbuild) will not trace a lazy `require`, so they must be direct
|
|
713
|
+
* dependencies of the *application* to survive bundling:
|
|
670
714
|
* ```bash
|
|
715
|
+
* # http/protobuf
|
|
716
|
+
* pnpm add @opentelemetry/exporter-trace-otlp-proto @opentelemetry/exporter-metrics-otlp-proto
|
|
717
|
+
* # grpc
|
|
671
718
|
* pnpm add @opentelemetry/exporter-trace-otlp-grpc @opentelemetry/exporter-metrics-otlp-grpc
|
|
672
719
|
* ```
|
|
673
720
|
*
|
|
@@ -793,6 +840,20 @@ interface AutotelConfig {
|
|
|
793
840
|
* }
|
|
794
841
|
* init({ service: 'my-app', logger })
|
|
795
842
|
* ```
|
|
843
|
+
*
|
|
844
|
+
* @remarks
|
|
845
|
+
* This is also the fallback logger for canonical log lines, so setting it
|
|
846
|
+
* sends them here INSTEAD of the OTel Logs API — and therefore stops them
|
|
847
|
+
* reaching an OTLP logs backend such as Loki. On a platform whose log view
|
|
848
|
+
* reads stdout you usually want both, which is what
|
|
849
|
+
* `canonicalLogLines.otel` is for:
|
|
850
|
+
*
|
|
851
|
+
* ```typescript
|
|
852
|
+
* init({
|
|
853
|
+
* service: 'my-app',
|
|
854
|
+
* canonicalLogLines: { enabled: true, logger, otel: true },
|
|
855
|
+
* })
|
|
856
|
+
* ```
|
|
796
857
|
*/
|
|
797
858
|
logger?: Logger;
|
|
798
859
|
/**
|
|
@@ -9,7 +9,7 @@ const require_policy = require('./policy.cjs');
|
|
|
9
9
|
const require_span_name_normalizer = require('./span-name-normalizer.cjs');
|
|
10
10
|
const require_attribute_redacting_processor = require('./attribute-redacting-processor.cjs');
|
|
11
11
|
const require_pretty_console_exporter = require('./pretty-console-exporter-CMzlrRNg.cjs');
|
|
12
|
-
const require_canonical_log_line_processor = require('./canonical-log-line-processor-
|
|
12
|
+
const require_canonical_log_line_processor = require('./canonical-log-line-processor-B-tzezhk.cjs');
|
|
13
13
|
const require_metric = require('./metric.cjs');
|
|
14
14
|
let _opentelemetry_sdk_node = require("@opentelemetry/sdk-node");
|
|
15
15
|
let _opentelemetry_sdk_trace_base = require("@opentelemetry/sdk-trace-base");
|
|
@@ -3496,7 +3496,7 @@ function loadGRPCTraceExporter() {
|
|
|
3496
3496
|
OTLPTraceExporterGRPC = require_node_require.requireModule("@opentelemetry/exporter-trace-otlp-grpc").OTLPTraceExporter;
|
|
3497
3497
|
return OTLPTraceExporterGRPC;
|
|
3498
3498
|
} catch {
|
|
3499
|
-
throw new Error("gRPC trace exporter not found. Install @opentelemetry/exporter-trace-otlp-grpc");
|
|
3499
|
+
throw new Error("gRPC trace exporter not found. Install @opentelemetry/exporter-trace-otlp-grpc. It is an optional peer dependency, and bundlers (Vercel, Nitro, esbuild) do not follow the lazy require that loads it, so add it as a direct dependency of your application, not just of autotel.");
|
|
3500
3500
|
}
|
|
3501
3501
|
}
|
|
3502
3502
|
/**
|
|
@@ -3508,7 +3508,7 @@ function loadGRPCMetricExporter() {
|
|
|
3508
3508
|
OTLPMetricExporterGRPC = require_node_require.requireModule("@opentelemetry/exporter-metrics-otlp-grpc").OTLPMetricExporter;
|
|
3509
3509
|
return OTLPMetricExporterGRPC;
|
|
3510
3510
|
} catch {
|
|
3511
|
-
throw new Error("gRPC metric exporter not found. Install @opentelemetry/exporter-metrics-otlp-grpc");
|
|
3511
|
+
throw new Error("gRPC metric exporter not found. Install @opentelemetry/exporter-metrics-otlp-grpc. It is an optional peer dependency, and bundlers (Vercel, Nitro, esbuild) do not follow the lazy require that loads it, so add it as a direct dependency of your application, not just of autotel.");
|
|
3512
3512
|
}
|
|
3513
3513
|
}
|
|
3514
3514
|
/**
|
|
@@ -3520,7 +3520,7 @@ function loadProtoTraceExporter() {
|
|
|
3520
3520
|
OTLPTraceExporterPROTO = require_node_require.requireModule("@opentelemetry/exporter-trace-otlp-proto").OTLPTraceExporter;
|
|
3521
3521
|
return OTLPTraceExporterPROTO;
|
|
3522
3522
|
} catch {
|
|
3523
|
-
throw new Error("Protobuf trace exporter not found. Install @opentelemetry/exporter-trace-otlp-proto");
|
|
3523
|
+
throw new Error("Protobuf trace exporter not found. Install @opentelemetry/exporter-trace-otlp-proto. It is an optional peer dependency, and bundlers (Vercel, Nitro, esbuild) do not follow the lazy require that loads it, so add it as a direct dependency of your application, not just of autotel. Or drop `protocol` to use the default JSON exporter, which ships with autotel and is accepted by Grafana Cloud, Honeycomb and the other hosted OTLP gateways.");
|
|
3524
3524
|
}
|
|
3525
3525
|
}
|
|
3526
3526
|
/**
|
|
@@ -3540,7 +3540,7 @@ function createMetricExporter(protocol, config) {
|
|
|
3540
3540
|
if (!OTLPMetricExporterPROTO) try {
|
|
3541
3541
|
OTLPMetricExporterPROTO = require_node_require.requireModule("@opentelemetry/exporter-metrics-otlp-proto").OTLPMetricExporter;
|
|
3542
3542
|
} catch {
|
|
3543
|
-
throw new Error("Protobuf metric exporter not found. Install @opentelemetry/exporter-metrics-otlp-proto");
|
|
3543
|
+
throw new Error("Protobuf metric exporter not found. Install @opentelemetry/exporter-metrics-otlp-proto. It is an optional peer dependency, and bundlers (Vercel, Nitro, esbuild) do not follow the lazy require that loads it, so add it as a direct dependency of your application, not just of autotel. Or drop `protocol` to use the default JSON exporter, which ships with autotel and is accepted by Grafana Cloud, Honeycomb and the other hosted OTLP gateways.");
|
|
3544
3544
|
}
|
|
3545
3545
|
return new OTLPMetricExporterPROTO(config);
|
|
3546
3546
|
}
|
|
@@ -3555,7 +3555,7 @@ function loadGRPCLogExporter() {
|
|
|
3555
3555
|
OTLPLogExporterGRPC = require_node_require.requireModule("@opentelemetry/exporter-logs-otlp-grpc").OTLPLogExporter;
|
|
3556
3556
|
return OTLPLogExporterGRPC;
|
|
3557
3557
|
} catch {
|
|
3558
|
-
throw new Error("gRPC log exporter not found. Install @opentelemetry/exporter-logs-otlp-grpc");
|
|
3558
|
+
throw new Error("gRPC log exporter not found. Install @opentelemetry/exporter-logs-otlp-grpc. It is an optional peer dependency, and bundlers (Vercel, Nitro, esbuild) do not follow the lazy require that loads it, so add it as a direct dependency of your application, not just of autotel.");
|
|
3559
3559
|
}
|
|
3560
3560
|
}
|
|
3561
3561
|
/**
|
|
@@ -3567,7 +3567,7 @@ function createLogExporter(protocol, config) {
|
|
|
3567
3567
|
if (!OTLPLogExporterPROTO) try {
|
|
3568
3568
|
OTLPLogExporterPROTO = require_node_require.requireModule("@opentelemetry/exporter-logs-otlp-proto").OTLPLogExporter;
|
|
3569
3569
|
} catch {
|
|
3570
|
-
throw new Error("Protobuf log exporter not found. Install @opentelemetry/exporter-logs-otlp-proto");
|
|
3570
|
+
throw new Error("Protobuf log exporter not found. Install @opentelemetry/exporter-logs-otlp-proto. It is an optional peer dependency, and bundlers (Vercel, Nitro, esbuild) do not follow the lazy require that loads it, so add it as a direct dependency of your application, not just of autotel. Or drop `protocol` to use the default JSON exporter, which ships with autotel and is accepted by Grafana Cloud, Honeycomb and the other hosted OTLP gateways.");
|
|
3571
3571
|
}
|
|
3572
3572
|
return new OTLPLogExporterPROTO(config);
|
|
3573
3573
|
}
|
|
@@ -3865,6 +3865,20 @@ function getAutoInstrumentations(integrations, manualInstrumentationNames = /* @
|
|
|
3865
3865
|
* Replaces initInstrumentation() and separate events config.
|
|
3866
3866
|
*/
|
|
3867
3867
|
/**
|
|
3868
|
+
* Records nothing and exports nothing, so a `TracerProvider` is still
|
|
3869
|
+
* registered when there is no destination. See where it is used below.
|
|
3870
|
+
*/
|
|
3871
|
+
var NoopSpanProcessor = class {
|
|
3872
|
+
onStart() {}
|
|
3873
|
+
onEnd() {}
|
|
3874
|
+
forceFlush() {
|
|
3875
|
+
return Promise.resolve();
|
|
3876
|
+
}
|
|
3877
|
+
shutdown() {
|
|
3878
|
+
return Promise.resolve();
|
|
3879
|
+
}
|
|
3880
|
+
};
|
|
3881
|
+
/**
|
|
3868
3882
|
* Adapts an Autotel Sampler to the OTel SDK Sampler interface.
|
|
3869
3883
|
*/
|
|
3870
3884
|
function toOtelSampler(sampler) {
|
|
@@ -4011,7 +4025,10 @@ function init(cfg) {
|
|
|
4011
4025
|
const version = mergedConfig.version || detectVersion();
|
|
4012
4026
|
const environment = mergedConfig.environment || process.env.NODE_ENV || "development";
|
|
4013
4027
|
const metricsEnabled = resolveMetricsFlag(mergedConfig.metrics);
|
|
4014
|
-
const
|
|
4028
|
+
const canonicalLogger = mergedConfig.canonicalLogLines?.logger ?? mergedConfig.logger;
|
|
4029
|
+
const hasCanonicalLogger = Array.isArray(canonicalLogger) ? canonicalLogger.length > 0 : canonicalLogger !== void 0;
|
|
4030
|
+
const canonicalUsesOtel = mergedConfig.canonicalLogLines?.enabled === true && (mergedConfig.canonicalLogLines.otel ?? !hasCanonicalLogger);
|
|
4031
|
+
const logsEnabled = resolveLogsFlag(mergedConfig.logs ?? (canonicalUsesOtel ? true : "auto"));
|
|
4015
4032
|
if (devtoolsConfig.enabled && devtoolsConfig.embedded) {
|
|
4016
4033
|
const devtoolsModule = _optionalRequire("autotel-devtools");
|
|
4017
4034
|
if (devtoolsModule?.createDevtools) {
|
|
@@ -4039,12 +4056,12 @@ function init(cfg) {
|
|
|
4039
4056
|
if (mergedConfig.resource) resource = resource.merge(mergedConfig.resource);
|
|
4040
4057
|
if (mergedConfig.resourceAttributes) resource = resource.merge((0, _opentelemetry_resources.resourceFromAttributes)(mergedConfig.resourceAttributes));
|
|
4041
4058
|
const otlpDestinations = resolveOtlpDestinations(mergedConfig, endpoint);
|
|
4042
|
-
const configuredSpanProcessors = mergedConfig.spanProcessors
|
|
4059
|
+
const configuredSpanProcessors = mergedConfig.spanProcessors !== void 0 ? mergedConfig.spanProcessors : mergedConfig.spanProcessor ? [mergedConfig.spanProcessor] : void 0;
|
|
4043
4060
|
const configuredSpanExporters = mergedConfig.spanExporters && mergedConfig.spanExporters.length > 0 ? mergedConfig.spanExporters : mergedConfig.spanExporter ? [mergedConfig.spanExporter] : void 0;
|
|
4044
4061
|
const configuredMetricReaders = mergedConfig.metricReaders && mergedConfig.metricReaders.length > 0 ? mergedConfig.metricReaders : mergedConfig.metricReader ? [mergedConfig.metricReader] : void 0;
|
|
4045
4062
|
const configuredLogRecordProcessors = mergedConfig.logRecordProcessors && mergedConfig.logRecordProcessors.length > 0 ? mergedConfig.logRecordProcessors : mergedConfig.logRecordProcessor ? [mergedConfig.logRecordProcessor] : void 0;
|
|
4046
4063
|
let spanProcessors = [];
|
|
4047
|
-
if (configuredSpanProcessors
|
|
4064
|
+
if (configuredSpanProcessors !== void 0) spanProcessors.push(...configuredSpanProcessors);
|
|
4048
4065
|
else if (configuredSpanExporters && configuredSpanExporters.length > 0) for (const exporter of configuredSpanExporters) spanProcessors.push(new TailSamplingSpanProcessor(new _opentelemetry_sdk_trace_base.BatchSpanProcessor(exporter)));
|
|
4049
4066
|
else for (const destination of otlpDestinations) {
|
|
4050
4067
|
if (!destinationSupportsSignal(destination, "traces")) continue;
|
|
@@ -4063,7 +4080,8 @@ function init(cfg) {
|
|
|
4063
4080
|
else if (debugMode === true) spanProcessors.push(new _opentelemetry_sdk_trace_base.SimpleSpanProcessor(new _opentelemetry_sdk_trace_base.ConsoleSpanExporter()));
|
|
4064
4081
|
if (mergedConfig.canonicalLogLines?.enabled) {
|
|
4065
4082
|
const canonicalOptions = {
|
|
4066
|
-
logger:
|
|
4083
|
+
logger: canonicalLogger,
|
|
4084
|
+
otel: mergedConfig.canonicalLogLines.otel,
|
|
4067
4085
|
rootSpansOnly: mergedConfig.canonicalLogLines.rootSpansOnly,
|
|
4068
4086
|
minLevel: mergedConfig.canonicalLogLines.minLevel,
|
|
4069
4087
|
messageFormat: mergedConfig.canonicalLogLines.messageFormat,
|
|
@@ -4152,9 +4170,10 @@ function init(cfg) {
|
|
|
4152
4170
|
sampler,
|
|
4153
4171
|
instrumentations: finalInstrumentations
|
|
4154
4172
|
};
|
|
4155
|
-
|
|
4173
|
+
sdkOptions.spanProcessors = spanProcessors.length > 0 ? spanProcessors : [new NoopSpanProcessor()];
|
|
4156
4174
|
if (metricReaders.length > 0) sdkOptions.metricReaders = metricReaders;
|
|
4157
4175
|
if (logRecordProcessors && logRecordProcessors.length > 0) sdkOptions.logRecordProcessors = logRecordProcessors;
|
|
4176
|
+
else if (!process.env.OTEL_LOGS_EXPORTER) sdkOptions.logRecordProcessors = [];
|
|
4158
4177
|
sdk = mergedConfig.sdkFactory ? mergedConfig.sdkFactory(sdkOptions) : new _opentelemetry_sdk_node.NodeSDK(sdkOptions);
|
|
4159
4178
|
if (!sdk) throw new Error("[autotel] sdkFactory must return a NodeSDK instance");
|
|
4160
4179
|
sdk.start();
|
|
@@ -5,7 +5,7 @@ import { o as EventSubscriber } from "./event-subscriber-DMACQA-1.js";
|
|
|
5
5
|
import { r as SpanFilterPredicate } from "./filtering-span-processor-BpDagWNa.js";
|
|
6
6
|
import { r as Policy } from "./policy-CbpP4tFH.js";
|
|
7
7
|
import { r as SpanNameNormalizerConfig } from "./span-name-normalizer-CN1-8C76.js";
|
|
8
|
-
import { t as CanonicalLogLineOptions } from "./canonical-log-line-processor-
|
|
8
|
+
import { t as CanonicalLogLineOptions } from "./canonical-log-line-processor-Yq4cXcD5.js";
|
|
9
9
|
import { NodeSDK, NodeSDKConfiguration } from "@opentelemetry/sdk-node";
|
|
10
10
|
import { ReadableSpan, SpanExporter, SpanProcessor } from "@opentelemetry/sdk-trace-base";
|
|
11
11
|
import { Resource } from "@opentelemetry/resources";
|
|
@@ -261,8 +261,31 @@ interface ProcessHandlersConfig {
|
|
|
261
261
|
*/
|
|
262
262
|
interface CanonicalLogLinesConfig {
|
|
263
263
|
enabled: boolean;
|
|
264
|
-
/**
|
|
265
|
-
|
|
264
|
+
/**
|
|
265
|
+
* Logger(s) to emit canonical log lines through. Pass an array to fan out to
|
|
266
|
+
* several. When omitted, lines go to the OTel Logs API instead.
|
|
267
|
+
*
|
|
268
|
+
* Note this falls back to the top-level `logger` on AutotelConfig, so
|
|
269
|
+
* setting that alone also diverts canonical log lines away from OTLP.
|
|
270
|
+
*/
|
|
271
|
+
logger?: Logger | Logger[];
|
|
272
|
+
/**
|
|
273
|
+
* Also emit through the OTel Logs API alongside any `logger`, so the same
|
|
274
|
+
* lines reach an OTLP logs backend (Loki, and the like).
|
|
275
|
+
*
|
|
276
|
+
* Defaults to true only when no `logger` is given. Set `otel: true` with a
|
|
277
|
+
* logger to get both: the platform's own log view keeps the lines, and OTLP
|
|
278
|
+
* carries them to your backend.
|
|
279
|
+
*
|
|
280
|
+
* @example Console and Loki at once
|
|
281
|
+
* ```typescript
|
|
282
|
+
* init({
|
|
283
|
+
* endpoint: process.env.OTEL_EXPORTER_OTLP_ENDPOINT,
|
|
284
|
+
* canonicalLogLines: { enabled: true, logger: pino(), otel: true },
|
|
285
|
+
* });
|
|
286
|
+
* ```
|
|
287
|
+
*/
|
|
288
|
+
otel?: boolean;
|
|
266
289
|
/** Only emit canonical log lines for root spans (default: false). */
|
|
267
290
|
rootSpansOnly?: boolean;
|
|
268
291
|
/** Minimum log level for canonical log lines (default: 'info'). */
|
|
@@ -468,7 +491,18 @@ interface AutotelConfig {
|
|
|
468
491
|
* Single-destination shorthand. For multi-backend OTLP fan-out, use
|
|
469
492
|
* `destinations` instead.
|
|
470
493
|
* Only used if you don't provide custom exporters/processors
|
|
471
|
-
*
|
|
494
|
+
*
|
|
495
|
+
* Falls back to the OTel spec's `OTEL_EXPORTER_OTLP_ENDPOINT`, which is the
|
|
496
|
+
* variable every vendor's docs hand you (see `env-config.ts`;
|
|
497
|
+
* `OTEL_EXPORTER_OTLP_HEADERS` and `OTEL_EXPORTER_OTLP_PROTOCOL` are read
|
|
498
|
+
* the same way).
|
|
499
|
+
*
|
|
500
|
+
* With no endpoint from either source there is NO default and no fallback
|
|
501
|
+
* to localhost: the span processor list stays empty and nothing is
|
|
502
|
+
* exported, so telemetry is off rather than aimed at a collector that is
|
|
503
|
+
* not there. Point it at a local collector explicitly when you want one.
|
|
504
|
+
*
|
|
505
|
+
* @default process.env.OTEL_EXPORTER_OTLP_ENDPOINT, else no exporter
|
|
472
506
|
*/
|
|
473
507
|
endpoint?: string;
|
|
474
508
|
/**
|
|
@@ -661,13 +695,26 @@ interface AutotelConfig {
|
|
|
661
695
|
headers?: Record<string, string> | string;
|
|
662
696
|
/**
|
|
663
697
|
* OTLP protocol to use for traces, metrics, and logs
|
|
664
|
-
* - 'http': HTTP
|
|
698
|
+
* - 'http': OTLP over HTTP with a **JSON** body (default, port 4318)
|
|
699
|
+
* - 'http/protobuf': OTLP over HTTP with a protobuf body (port 4318)
|
|
665
700
|
* - 'grpc': gRPC (uses port 4317)
|
|
666
701
|
*
|
|
702
|
+
* The default is JSON, not protobuf — `createTraceExporter` falls through to
|
|
703
|
+
* `OTLPTraceExporterHTTP`, which sends `content-type: application/json`.
|
|
704
|
+
* Grafana Cloud, Honeycomb and the other hosted OTLP gateways all accept
|
|
705
|
+
* JSON, so the default needs no extra install and is what the vendor presets
|
|
706
|
+
* in `autotel-backends` rely on.
|
|
707
|
+
*
|
|
667
708
|
* Can be overridden with OTEL_EXPORTER_OTLP_PROTOCOL env var.
|
|
668
709
|
*
|
|
669
|
-
* Note:
|
|
710
|
+
* Note: only the JSON exporters ship with autotel. 'http/protobuf' and
|
|
711
|
+
* 'grpc' need optional peer dependencies, and a bundler (Vercel, Nitro,
|
|
712
|
+
* esbuild) will not trace a lazy `require`, so they must be direct
|
|
713
|
+
* dependencies of the *application* to survive bundling:
|
|
670
714
|
* ```bash
|
|
715
|
+
* # http/protobuf
|
|
716
|
+
* pnpm add @opentelemetry/exporter-trace-otlp-proto @opentelemetry/exporter-metrics-otlp-proto
|
|
717
|
+
* # grpc
|
|
671
718
|
* pnpm add @opentelemetry/exporter-trace-otlp-grpc @opentelemetry/exporter-metrics-otlp-grpc
|
|
672
719
|
* ```
|
|
673
720
|
*
|
|
@@ -793,6 +840,20 @@ interface AutotelConfig {
|
|
|
793
840
|
* }
|
|
794
841
|
* init({ service: 'my-app', logger })
|
|
795
842
|
* ```
|
|
843
|
+
*
|
|
844
|
+
* @remarks
|
|
845
|
+
* This is also the fallback logger for canonical log lines, so setting it
|
|
846
|
+
* sends them here INSTEAD of the OTel Logs API — and therefore stops them
|
|
847
|
+
* reaching an OTLP logs backend such as Loki. On a platform whose log view
|
|
848
|
+
* reads stdout you usually want both, which is what
|
|
849
|
+
* `canonicalLogLines.otel` is for:
|
|
850
|
+
*
|
|
851
|
+
* ```typescript
|
|
852
|
+
* init({
|
|
853
|
+
* service: 'my-app',
|
|
854
|
+
* canonicalLogLines: { enabled: true, logger, otel: true },
|
|
855
|
+
* })
|
|
856
|
+
* ```
|
|
796
857
|
*/
|
|
797
858
|
logger?: Logger;
|
|
798
859
|
/**
|
package/dist/instrumentation.cjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
2
|
-
const require_init = require('./init-
|
|
2
|
+
const require_init = require('./init-CNUkdwke.cjs');
|
|
3
3
|
const require_node_require = require('./node-require-EifOMikz.cjs');
|
|
4
4
|
let _opentelemetry_sdk_node = require("@opentelemetry/sdk-node");
|
|
5
5
|
let _opentelemetry_sdk_trace_base = require("@opentelemetry/sdk-trace-base");
|
package/dist/instrumentation.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { r as getLogger, x as TailSamplingSpanProcessor } from "./init-
|
|
1
|
+
import { r as getLogger, x as TailSamplingSpanProcessor } from "./init-B2kv4bLO.js";
|
|
2
2
|
import { n as safeRequire, t as requireModule } from "./node-require-DSPjaw_l.js";
|
|
3
3
|
import { NodeSDK } from "@opentelemetry/sdk-node";
|
|
4
4
|
import { BatchSpanProcessor } from "@opentelemetry/sdk-trace-base";
|
package/dist/messaging.cjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
2
2
|
const require_values = require('./values-DApyq53y.cjs');
|
|
3
|
-
const require_init = require('./init-
|
|
4
|
-
const require_functional = require('./functional-
|
|
3
|
+
const require_init = require('./init-CNUkdwke.cjs');
|
|
4
|
+
const require_functional = require('./functional-BOZ3me6w.cjs');
|
|
5
5
|
const require_correlated_events = require('./correlated-events-CcuknWnU.cjs');
|
|
6
6
|
const require_trace_factory_validation = require('./trace-factory-validation-Dc8epn87.cjs');
|
|
7
7
|
let _opentelemetry_api = require("@opentelemetry/api");
|
package/dist/messaging.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { _ as readProperty, b as toAttributeValue, c as asScalar, g as nonEmptyString, h as isFunction, s as asRecord, v as resolveValue, y as splitNameOrOptions } from "./values-BenyvWKz.js";
|
|
2
|
-
import { F as createLinkFromHeaders, L as extractLinksFromBatch } from "./init-
|
|
3
|
-
import { c as withTracing } from "./functional-
|
|
2
|
+
import { F as createLinkFromHeaders, L as extractLinksFromBatch } from "./init-B2kv4bLO.js";
|
|
3
|
+
import { c as withTracing } from "./functional-B86zszmZ.js";
|
|
4
4
|
import { t as emitCorrelatedEvent } from "./correlated-events-DwMMbItg.js";
|
|
5
5
|
import { t as assertTraceFactory } from "./trace-factory-validation-BjVAinz6.js";
|
|
6
6
|
import { SpanKind, context, propagation } from "@opentelemetry/api";
|
package/dist/processors.cjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
2
|
-
const require_canonical_log_line_processor = require('./canonical-log-line-processor-
|
|
2
|
+
const require_canonical_log_line_processor = require('./canonical-log-line-processor-B-tzezhk.cjs');
|
|
3
3
|
let _opentelemetry_sdk_trace_base = require("@opentelemetry/sdk-trace-base");
|
|
4
4
|
|
|
5
5
|
Object.defineProperty(exports, 'BatchSpanProcessor', {
|
package/dist/processors.d.cts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { n as CanonicalLogLineProcessor, t as CanonicalLogLineOptions } from "./canonical-log-line-processor-
|
|
1
|
+
import { n as CanonicalLogLineProcessor, t as CanonicalLogLineOptions } from "./canonical-log-line-processor-C0Z_N4oL.cjs";
|
|
2
2
|
import { BatchSpanProcessor, SimpleSpanProcessor } from "@opentelemetry/sdk-trace-base";
|
|
3
3
|
export { BatchSpanProcessor, type CanonicalLogLineOptions, CanonicalLogLineProcessor, SimpleSpanProcessor };
|
package/dist/processors.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { n as CanonicalLogLineProcessor, t as CanonicalLogLineOptions } from "./canonical-log-line-processor-
|
|
1
|
+
import { n as CanonicalLogLineProcessor, t as CanonicalLogLineOptions } from "./canonical-log-line-processor-Yq4cXcD5.js";
|
|
2
2
|
import { BatchSpanProcessor, SimpleSpanProcessor } from "@opentelemetry/sdk-trace-base";
|
|
3
3
|
export { BatchSpanProcessor, type CanonicalLogLineOptions, CanonicalLogLineProcessor, SimpleSpanProcessor };
|
package/dist/processors.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { t as CanonicalLogLineProcessor } from "./canonical-log-line-processor-
|
|
1
|
+
import { t as CanonicalLogLineProcessor } from "./canonical-log-line-processor-CBv-OCp4.js";
|
|
2
2
|
import { BatchSpanProcessor, SimpleSpanProcessor } from "@opentelemetry/sdk-trace-base";
|
|
3
3
|
|
|
4
4
|
export { BatchSpanProcessor, CanonicalLogLineProcessor, SimpleSpanProcessor };
|
package/dist/sampling.cjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
2
|
-
const require_init = require('./init-
|
|
2
|
+
const require_init = require('./init-CNUkdwke.cjs');
|
|
3
3
|
|
|
4
4
|
exports.AUTOTEL_DEBUG_BAGGAGE_KEY = require_init.AUTOTEL_DEBUG_BAGGAGE_KEY;
|
|
5
5
|
exports.AUTOTEL_SAMPLING_RATE = require_init.AUTOTEL_SAMPLING_RATE;
|
package/dist/sampling.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { A as FeatureFlagSampler, B as markForceKept, C as AUTOTEL_SAMPLING_RATE, D as AlwaysSampler, E as AdaptiveSampler, F as createLinkFromHeaders, H as samplingPresets, I as debugCaptureRequested, L as extractLinksFromBatch, M as NeverSampler, N as RandomSampler, O as CompositeSampler, P as UserIdSampler, R as hashUnitInterval, S as AUTOTEL_DEBUG_BAGGAGE_KEY, T as AUTOTEL_SAMPLING_TAIL_KEEP, V as resolveSamplingPreset, j as KeyTargetRateSampler, k as DeterministicSampler, w as AUTOTEL_SAMPLING_TAIL_EVALUATED, z as isForceKept } from "./init-
|
|
1
|
+
import { A as FeatureFlagSampler, B as markForceKept, C as AUTOTEL_SAMPLING_RATE, D as AlwaysSampler, E as AdaptiveSampler, F as createLinkFromHeaders, H as samplingPresets, I as debugCaptureRequested, L as extractLinksFromBatch, M as NeverSampler, N as RandomSampler, O as CompositeSampler, P as UserIdSampler, R as hashUnitInterval, S as AUTOTEL_DEBUG_BAGGAGE_KEY, T as AUTOTEL_SAMPLING_TAIL_KEEP, V as resolveSamplingPreset, j as KeyTargetRateSampler, k as DeterministicSampler, w as AUTOTEL_SAMPLING_TAIL_EVALUATED, z as isForceKept } from "./init-B2kv4bLO.js";
|
|
2
2
|
|
|
3
3
|
export { AUTOTEL_DEBUG_BAGGAGE_KEY, AUTOTEL_SAMPLING_RATE, AUTOTEL_SAMPLING_TAIL_EVALUATED, AUTOTEL_SAMPLING_TAIL_KEEP, AdaptiveSampler, AlwaysSampler, CompositeSampler, DeterministicSampler, FeatureFlagSampler, KeyTargetRateSampler, NeverSampler, RandomSampler, UserIdSampler, createLinkFromHeaders, debugCaptureRequested, extractLinksFromBatch, hashUnitInterval, isForceKept, markForceKept, resolveSamplingPreset, samplingPresets };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
2
2
|
const require_values = require('./values-DApyq53y.cjs');
|
|
3
|
-
const require_functional = require('./functional-
|
|
3
|
+
const require_functional = require('./functional-BOZ3me6w.cjs');
|
|
4
4
|
const require_trace_factory_validation = require('./trace-factory-validation-Dc8epn87.cjs');
|
|
5
5
|
let _opentelemetry_api = require("@opentelemetry/api");
|
|
6
6
|
|
package/dist/semantic-helpers.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { b as toAttributeValue, g as nonEmptyString, s as asRecord } from "./values-BenyvWKz.js";
|
|
2
|
-
import { c as withTracing } from "./functional-
|
|
2
|
+
import { c as withTracing } from "./functional-B86zszmZ.js";
|
|
3
3
|
import { t as assertTraceFactory } from "./trace-factory-validation-BjVAinz6.js";
|
|
4
4
|
import { SpanKind } from "@opentelemetry/api";
|
|
5
5
|
|
package/dist/webhook.cjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
2
2
|
const require_structured_error = require('./structured-error--_wXpd_C.cjs');
|
|
3
|
-
const require_functional = require('./functional-
|
|
3
|
+
const require_functional = require('./functional-BOZ3me6w.cjs');
|
|
4
4
|
const require_correlated_events = require('./correlated-events-CcuknWnU.cjs');
|
|
5
5
|
let _opentelemetry_api = require("@opentelemetry/api");
|
|
6
6
|
|
package/dist/webhook.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { r as recordStructuredError } from "./structured-error-YIuka-FE.js";
|
|
2
|
-
import { c as withTracing } from "./functional-
|
|
2
|
+
import { c as withTracing } from "./functional-B86zszmZ.js";
|
|
3
3
|
import { t as emitCorrelatedEvent } from "./correlated-events-DwMMbItg.js";
|
|
4
4
|
import { SpanKind, trace } from "@opentelemetry/api";
|
|
5
5
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
2
2
|
const require_values = require('./values-DApyq53y.cjs');
|
|
3
|
-
const require_functional = require('./functional-
|
|
3
|
+
const require_functional = require('./functional-BOZ3me6w.cjs');
|
|
4
4
|
const require_correlated_events = require('./correlated-events-CcuknWnU.cjs');
|
|
5
5
|
const require_business_baggage = require('./business-baggage.cjs');
|
|
6
6
|
let _opentelemetry_api = require("@opentelemetry/api");
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { h as isFunction, x as toError } from "./values-BenyvWKz.js";
|
|
2
|
-
import { c as withTracing } from "./functional-
|
|
2
|
+
import { c as withTracing } from "./functional-B86zszmZ.js";
|
|
3
3
|
import { t as emitCorrelatedEvent } from "./correlated-events-DwMMbItg.js";
|
|
4
4
|
import { createSafeBaggageSchema } from "./business-baggage.js";
|
|
5
5
|
import { SpanKind, context, propagation } from "@opentelemetry/api";
|
package/dist/workflow.cjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
2
2
|
const require_rolldown_runtime = require('./rolldown-runtime-C_NdSu1c.cjs');
|
|
3
3
|
const require_values = require('./values-DApyq53y.cjs');
|
|
4
|
-
const require_functional = require('./functional-
|
|
4
|
+
const require_functional = require('./functional-BOZ3me6w.cjs');
|
|
5
5
|
const require_trace_helpers = require('./trace-helpers.cjs');
|
|
6
6
|
const require_correlated_events = require('./correlated-events-CcuknWnU.cjs');
|
|
7
7
|
const require_trace_factory_validation = require('./trace-factory-validation-Dc8epn87.cjs');
|
package/dist/workflow.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { b as toAttributeValue, g as nonEmptyString, h as isFunction, l as asString, s as asRecord, x as toError } from "./values-BenyvWKz.js";
|
|
2
|
-
import { c as withTracing } from "./functional-
|
|
2
|
+
import { c as withTracing } from "./functional-B86zszmZ.js";
|
|
3
3
|
import { getActiveSpan } from "./trace-helpers.js";
|
|
4
4
|
import { t as emitCorrelatedEvent } from "./correlated-events-DwMMbItg.js";
|
|
5
5
|
import { t as assertTraceFactory } from "./trace-factory-validation-BjVAinz6.js";
|
package/dist/yaml-config.cjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
2
|
-
const require_init = require('./init-
|
|
2
|
+
const require_init = require('./init-CNUkdwke.cjs');
|
|
3
3
|
|
|
4
4
|
exports.hasYamlConfig = require_init.hasYamlConfig;
|
|
5
5
|
exports.loadYamlConfig = require_init.loadYamlConfig;
|
package/dist/yaml-config.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { g as SamplingPreset } from "./sampling-Er217Mge.cjs";
|
|
2
|
-
import { a as AutotelConfig, o as OtlpSignal } from "./init-
|
|
2
|
+
import { a as AutotelConfig, o as OtlpSignal } from "./init-BU7qa-Ii.cjs";
|
|
3
3
|
//#region src/yaml-config.d.ts
|
|
4
4
|
/** A value as a YAML document carries it: scalars, sequences, mappings. */
|
|
5
5
|
type YamlValue = string | number | boolean | null | YamlValue[] | YamlMapping;
|
package/dist/yaml-config.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { g as SamplingPreset } from "./sampling-DBng4Foa.js";
|
|
2
|
-
import { a as AutotelConfig, o as OtlpSignal } from "./init-
|
|
2
|
+
import { a as AutotelConfig, o as OtlpSignal } from "./init-DDCgmfa4.js";
|
|
3
3
|
//#region src/yaml-config.d.ts
|
|
4
4
|
/** A value as a YAML document carries it: scalars, sequences, mappings. */
|
|
5
5
|
type YamlValue = string | number | boolean | null | YamlValue[] | YamlMapping;
|
package/dist/yaml-config.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { _ as loadYamlConfig, g as hasYamlConfig, v as loadYamlConfigFromFile } from "./init-
|
|
1
|
+
import { _ as loadYamlConfig, g as hasYamlConfig, v as loadYamlConfigFromFile } from "./init-B2kv4bLO.js";
|
|
2
2
|
|
|
3
3
|
export { hasYamlConfig, loadYamlConfig, loadYamlConfigFromFile };
|