autotel 6.2.1 → 6.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +50 -1
- package/dist/auto.cjs +1 -1
- 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.cjs +1 -1
- package/dist/event.js +1 -1
- package/dist/{functional-2AZsH_gQ.js → functional-DCBhFool.js} +1 -1
- package/dist/{functional-CogDARqC.cjs → functional-TbnG2lu7.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 +2 -2
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +2 -2
- package/dist/{init-BzVuFs5a.cjs → init-BneZ7WJ8.cjs} +444 -353
- package/dist/{init-BHp-kqLJ.d.ts → init-C1i2_2zl.d.ts} +24 -2
- package/dist/{init-BoIYyB6Q.d.cts → init-CfVWN4ND.d.cts} +24 -2
- package/dist/{init-Bu6wR-k_.js → init-Qn4gIW1i.js} +444 -353
- package/dist/instrumentation.cjs +2 -2
- package/dist/instrumentation.js +2 -2
- package/dist/messaging.cjs +1 -1
- package/dist/messaging.js +1 -1
- package/dist/semantic-helpers.cjs +1 -1
- package/dist/semantic-helpers.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.d.cts +1 -1
- package/dist/yaml-config.d.ts +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -36,6 +36,7 @@ Replace `NODE_OPTIONS` and 30+ lines of SDK boilerplate with `init()`, wrap func
|
|
|
36
36
|
- [LLM Observability with OpenLLMetry](#llm-observability-with-openllmetry)
|
|
37
37
|
- [Installation](#installation)
|
|
38
38
|
- [Usage](#usage)
|
|
39
|
+
- [Using the Vercel AI SDK?](#using-the-vercel-ai-sdk)
|
|
39
40
|
- [Sampling](#sampling)
|
|
40
41
|
- [Preset Shorthand](#preset-shorthand)
|
|
41
42
|
- [Tuned Presets](#tuned-presets)
|
|
@@ -394,6 +395,33 @@ OpenLLMetry will automatically:
|
|
|
394
395
|
|
|
395
396
|
All LLM spans will appear alongside your application traces in your observability backend.
|
|
396
397
|
|
|
398
|
+
### Using the Vercel AI SDK?
|
|
399
|
+
|
|
400
|
+
OpenLLMetry instruments provider SDKs. It does not see the AI SDK, which runs
|
|
401
|
+
its own telemetry pipeline, so `generateText`, `streamText` and `embed` produce
|
|
402
|
+
no spans through the section above.
|
|
403
|
+
|
|
404
|
+
The AI SDK's `telemetry: { functionId }` option does nothing on its own either.
|
|
405
|
+
It emits lifecycle events, and something has to be registered to listen.
|
|
406
|
+
Register [`autotel-genai`](../autotel-genai) once at startup, next to `init()`:
|
|
407
|
+
|
|
408
|
+
```typescript
|
|
409
|
+
import { registerTelemetry } from 'ai';
|
|
410
|
+
import { init } from 'autotel';
|
|
411
|
+
import { autotelTelemetry } from 'autotel-genai/observer';
|
|
412
|
+
|
|
413
|
+
init({ service: 'my-llm-app', endpoint: process.env.OTLP_ENDPOINT });
|
|
414
|
+
registerTelemetry(autotelTelemetry());
|
|
415
|
+
```
|
|
416
|
+
|
|
417
|
+
Every `generateText` / `streamText` / `embed` call now streams a canonical
|
|
418
|
+
`gen_ai.*` span tree with token usage, cost and streaming timing.
|
|
419
|
+
|
|
420
|
+
Miss that line and nothing breaks and nothing warns: the calls run, the app
|
|
421
|
+
works, and every LLM span is silently absent. If `get_llm_usage` in
|
|
422
|
+
[`autotel-mcp`](../autotel-mcp) reports zero requests while your app is plainly
|
|
423
|
+
calling a model, this is why.
|
|
424
|
+
|
|
397
425
|
**AI Workflow Patterns:** See [AI/LLM Workflow Documentation](../../docs/AI_WORKFLOWS.md) for comprehensive patterns including:
|
|
398
426
|
|
|
399
427
|
- Multi-agent workflows (orchestration and handoffs)
|
|
@@ -2586,7 +2614,28 @@ export async function handleRequest(req: Request) {
|
|
|
2586
2614
|
|
|
2587
2615
|
## Serverless & Short-lived Processes
|
|
2588
2616
|
|
|
2589
|
-
|
|
2617
|
+
A script that finishes and returns gets one flush for free. Autotel listens for
|
|
2618
|
+
`beforeExit`, so a CLI, a cron job or a CI step keeps its telemetry without
|
|
2619
|
+
calling anything:
|
|
2620
|
+
|
|
2621
|
+
```typescript
|
|
2622
|
+
init({ service: 'my-cli' });
|
|
2623
|
+
await doWork();
|
|
2624
|
+
// event loop drains -> autotel flushes -> process exits
|
|
2625
|
+
```
|
|
2626
|
+
|
|
2627
|
+
Turn it off with `flushOnExit: false` if your process manages its own exit and
|
|
2628
|
+
you would rather autotel added no listener.
|
|
2629
|
+
|
|
2630
|
+
It flushes rather than shutting down — `beforeExit` fires on any event-loop
|
|
2631
|
+
drain, so a process that goes on to do more work keeps its telemetry — and it is
|
|
2632
|
+
bounded by `processHandlers.shutdownTimeoutMs` (default 2s), after which the
|
|
2633
|
+
process exits instead of waiting on an exporter that never answers.
|
|
2634
|
+
|
|
2635
|
+
`beforeExit` does not fire on `process.exit()`, on a signal, or after an
|
|
2636
|
+
uncaught exception. For those, and for serverless (AWS Lambda, Vercel, Cloud
|
|
2637
|
+
Functions) where the runtime freezes the process between invocations rather
|
|
2638
|
+
than ending it, reach for one of these:
|
|
2590
2639
|
|
|
2591
2640
|
### Manual Flush (Recommended for Serverless)
|
|
2592
2641
|
|
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-BneZ7WJ8.cjs');
|
|
3
3
|
const require_yaml_config = require('./yaml-config.cjs');
|
|
4
4
|
let node_module = require("node:module");
|
|
5
5
|
node_module = require_rolldown_runtime.__toESM(node_module, 1);
|
package/dist/auto.js
CHANGED
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-BneZ7WJ8.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 { C as setCorrelationId, S as runWithCorrelationId, _ as CORRELATION_ID_BAGGAGE_KEY, b as getCorrelationStorage, v as generateCorrelationId, w as setCorrelationIdInBaggage, x as getOrCreateCorrelationId, y as getCorrelationId } from "./init-
|
|
1
|
+
import { C as setCorrelationId, S as runWithCorrelationId, _ as CORRELATION_ID_BAGGAGE_KEY, b as getCorrelationStorage, v as generateCorrelationId, w as setCorrelationIdInBaggage, x as getOrCreateCorrelationId, y as getCorrelationId } from "./init-Qn4gIW1i.js";
|
|
2
2
|
|
|
3
3
|
export { CORRELATION_ID_BAGGAGE_KEY, generateCorrelationId, getCorrelationId, getCorrelationStorage, getOrCreateCorrelationId, runWithCorrelationId, setCorrelationId, setCorrelationIdInBaggage };
|
package/dist/decorators.cjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
2
2
|
const require_config = require('./config.cjs');
|
|
3
|
-
const require_init = require('./init-
|
|
3
|
+
const require_init = require('./init-BneZ7WJ8.cjs');
|
|
4
4
|
let _opentelemetry_api = require("@opentelemetry/api");
|
|
5
5
|
|
|
6
6
|
//#region src/decorators.ts
|
package/dist/decorators.js
CHANGED
package/dist/event.cjs
CHANGED
package/dist/event.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { getForceFlushableProvider } from "./tracer-provider.js";
|
|
2
2
|
import { getConfig } from "./config.js";
|
|
3
3
|
import { AUTOTEL_SAMPLING_RATE, AUTOTEL_SAMPLING_TAIL_EVALUATED, AUTOTEL_SAMPLING_TAIL_KEEP, AlwaysSampler } from "./sampling.js";
|
|
4
|
-
import { D as getActiveContextWithBaggage, O as getContextStorage, T as createTraceContext, h as getEventQueue, m as runInOperationContext, r as getSdk, t as getConfig$1 } from "./init-
|
|
4
|
+
import { D as getActiveContextWithBaggage, O as getContextStorage, T as createTraceContext, h as getEventQueue, m as runInOperationContext, r as getSdk, t as getConfig$1 } from "./init-Qn4gIW1i.js";
|
|
5
5
|
import { setSpanName } from "./trace-helpers.js";
|
|
6
6
|
import { SpanStatusCode, context, propagation, trace } from "@opentelemetry/api";
|
|
7
7
|
import * as nodeFs from "node:fs";
|
|
@@ -2,7 +2,7 @@ const require_rolldown_runtime = require('./rolldown-runtime-C_NdSu1c.cjs');
|
|
|
2
2
|
const require_tracer_provider = require('./tracer-provider.cjs');
|
|
3
3
|
const require_config = require('./config.cjs');
|
|
4
4
|
const require_sampling = require('./sampling.cjs');
|
|
5
|
-
const require_init = require('./init-
|
|
5
|
+
const require_init = require('./init-BneZ7WJ8.cjs');
|
|
6
6
|
const require_trace_helpers = require('./trace-helpers.cjs');
|
|
7
7
|
let _opentelemetry_api = require("@opentelemetry/api");
|
|
8
8
|
let node_fs = require("node:fs");
|
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-TbnG2lu7.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-DCBhFool.js";
|
|
2
2
|
|
|
3
3
|
export { ctx, getActiveTraceContext, instrument, span, trace, withBaggage, withNewContext, withTracing };
|
package/dist/http.cjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
2
2
|
const require_config = require('./config.cjs');
|
|
3
|
-
const require_init = require('./init-
|
|
3
|
+
const require_init = require('./init-BneZ7WJ8.cjs');
|
|
4
4
|
let _opentelemetry_api = require("@opentelemetry/api");
|
|
5
5
|
|
|
6
6
|
//#region src/http.ts
|
package/dist/http.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { getConfig } from "./config.js";
|
|
2
|
-
import { D as getActiveContextWithBaggage } from "./init-
|
|
2
|
+
import { D as getActiveContextWithBaggage } from "./init-Qn4gIW1i.js";
|
|
3
3
|
import { SpanStatusCode, context, propagation } from "@opentelemetry/api";
|
|
4
4
|
|
|
5
5
|
//#region src/http.ts
|
package/dist/index.cjs
CHANGED
|
@@ -2,7 +2,7 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
|
2
2
|
const require_rolldown_runtime = require('./rolldown-runtime-C_NdSu1c.cjs');
|
|
3
3
|
const require_tracer_provider = require('./tracer-provider.cjs');
|
|
4
4
|
const require_sampling = require('./sampling.cjs');
|
|
5
|
-
const require_init = require('./init-
|
|
5
|
+
const require_init = require('./init-BneZ7WJ8.cjs');
|
|
6
6
|
const require_filtering_span_processor = require('./filtering-span-processor.cjs');
|
|
7
7
|
const require_span_name_normalizer = require('./span-name-normalizer.cjs');
|
|
8
8
|
const require_attribute_redacting_processor = require('./attribute-redacting-processor.cjs');
|
|
@@ -10,7 +10,7 @@ const require_canonical_log_line_processor = require('./canonical-log-line-proce
|
|
|
10
10
|
const require_structured_error = require('./structured-error-CHg7DoIQ.cjs');
|
|
11
11
|
const require_metric = require('./metric.cjs');
|
|
12
12
|
const require_trace_helpers = require('./trace-helpers.cjs');
|
|
13
|
-
const require_functional = require('./functional-
|
|
13
|
+
const require_functional = require('./functional-TbnG2lu7.cjs');
|
|
14
14
|
const require_stable_hash = require('./stable-hash-CS9BxvVQ.cjs');
|
|
15
15
|
const require_correlated_events = require('./correlated-events-kSwLo3mi.cjs');
|
|
16
16
|
const require_parse_error = require('./parse-error.cjs');
|
package/dist/index.d.cts
CHANGED
|
@@ -9,7 +9,7 @@ import { DrainPipelineOptions, PipelineDrainFn, createDrainPipeline } from "./dr
|
|
|
9
9
|
import { a as EventSubscriber, c as OutcomeStatus, i as EventSchemaMetadata, n as EventAttributes, o as EventTrackingOptions, s as FunnelStatus, t as AutotelEventContext } from "./event-subscriber-CWh8sTGh.cjs";
|
|
10
10
|
import { Event, EventsOptions, getEvents, resetEvents } from "./event.cjs";
|
|
11
11
|
import { n as FilteringSpanProcessorOptions, r as SpanFilterPredicate, t as FilteringSpanProcessor } from "./filtering-span-processor-BpDagWNa.cjs";
|
|
12
|
-
import { a as
|
|
12
|
+
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-CfVWN4ND.cjs";
|
|
13
13
|
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";
|
|
14
14
|
import "./canonical-log-line-processor-B4WgG-VS.cjs";
|
|
15
15
|
import { i as defineEvent, n as DefinedEvent, r as SchemaLike, t as DefineEventOptions } from "./define-event-CGG048HE.cjs";
|
package/dist/index.d.ts
CHANGED
|
@@ -9,7 +9,7 @@ import { DrainPipelineOptions, PipelineDrainFn, createDrainPipeline } from "./dr
|
|
|
9
9
|
import { a as EventSubscriber, c as OutcomeStatus, i as EventSchemaMetadata, n as EventAttributes, o as EventTrackingOptions, s as FunnelStatus, t as AutotelEventContext } from "./event-subscriber-CWh8sTGh.js";
|
|
10
10
|
import { Event, EventsOptions, getEvents, resetEvents } from "./event.js";
|
|
11
11
|
import { n as FilteringSpanProcessorOptions, r as SpanFilterPredicate, t as FilteringSpanProcessor } from "./filtering-span-processor-BpDagWNa.js";
|
|
12
|
-
import { a as
|
|
12
|
+
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-C1i2_2zl.js";
|
|
13
13
|
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";
|
|
14
14
|
import "./canonical-log-line-processor-CL_J7gb5.js";
|
|
15
15
|
import { i as defineEvent, n as DefinedEvent, r as SchemaLike, t as DefineEventOptions } from "./define-event-B2z1SBe7.js";
|
package/dist/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { getAutotelTracer, getAutotelTracerProvider, setAutotelTracerProvider } from "./tracer-provider.js";
|
|
2
2
|
import { AUTOTEL_SAMPLING_TAIL_EVALUATED, AUTOTEL_SAMPLING_TAIL_KEEP, AdaptiveSampler, AlwaysSampler, NeverSampler, RandomSampler, UserIdSampler, createLinkFromHeaders, extractLinksFromBatch, resolveSamplingPreset, samplingPresets } from "./sampling.js";
|
|
3
|
-
import { A as BaggageSpanProcessor, C as setCorrelationId, E as defineBaggageSchema, S as runWithCorrelationId, T as createTraceContext, _ as CORRELATION_ID_BAGGAGE_KEY, a as isInitialized, c as flush, d as getEvents, f as resetEvents, g as track, h as getEventQueue, i as init, k as createStringRedactor, l as shutdown, m as runInOperationContext, o as isLoggerLocked, p as getOperationContext, s as lockLogger, u as Event, v as generateCorrelationId, w as setCorrelationIdInBaggage, x as getOrCreateCorrelationId, y as getCorrelationId } from "./init-
|
|
3
|
+
import { A as BaggageSpanProcessor, C as setCorrelationId, E as defineBaggageSchema, S as runWithCorrelationId, T as createTraceContext, _ as CORRELATION_ID_BAGGAGE_KEY, a as isInitialized, c as flush, d as getEvents, f as resetEvents, g as track, h as getEventQueue, i as init, k as createStringRedactor, l as shutdown, m as runInOperationContext, o as isLoggerLocked, p as getOperationContext, s as lockLogger, u as Event, v as generateCorrelationId, w as setCorrelationIdInBaggage, x as getOrCreateCorrelationId, y as getCorrelationId } from "./init-Qn4gIW1i.js";
|
|
4
4
|
import { FilteringSpanProcessor } from "./filtering-span-processor.js";
|
|
5
5
|
import { NORMALIZER_PATTERNS, NORMALIZER_PRESETS, SpanNameNormalizingProcessor } from "./span-name-normalizer.js";
|
|
6
6
|
import { AttributeRedactingProcessor, REDACTOR_PATTERNS, REDACTOR_PRESETS, builtinPatterns, createAttributeRedactor, createRedactedSpan, normalizeAttributeRedactorConfig } from "./attribute-redacting-processor.js";
|
|
@@ -8,7 +8,7 @@ import { n as formatDuration } from "./canonical-log-line-processor-mKABvGP0.js"
|
|
|
8
8
|
import { a as flattenToAttributes, i as structuredErrorToJSON, n as getStructuredErrorAttributes, o as toAttributeValue, r as recordStructuredError, t as createStructuredError } from "./structured-error-9--cxBay.js";
|
|
9
9
|
import { Metric, getMetrics, resetMetrics } from "./metric.js";
|
|
10
10
|
import { createDeterministicTraceId, enrichWithTraceContext, finalizeSpan, flattenMetadata, getActiveContext, getActiveSpan, getTraceContext, getTracer, isTracing, resolveTraceUrl, runWithSpan } from "./trace-helpers.js";
|
|
11
|
-
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-
|
|
11
|
+
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-DCBhFool.js";
|
|
12
12
|
import { t as hashJson } from "./stable-hash-ChFBIhNt.js";
|
|
13
13
|
import { t as emitCorrelatedEvent } from "./correlated-events-Bzh5y-UB.js";
|
|
14
14
|
import { parseError } from "./parse-error.js";
|