autotel 3.7.0 → 4.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (132) hide show
  1. package/README.md +26 -1
  2. package/dist/{attributes-ksn4HVbd.js → attributes-CmYpdqCN.js} +2 -11
  3. package/dist/attributes-CmYpdqCN.js.map +1 -0
  4. package/dist/{attributes-D3etyRVc.cjs → attributes-PZ5doLgw.cjs} +2 -11
  5. package/dist/attributes-PZ5doLgw.cjs.map +1 -0
  6. package/dist/attributes.cjs +1 -1
  7. package/dist/attributes.d.cts +2 -2
  8. package/dist/attributes.d.ts +2 -2
  9. package/dist/attributes.js +1 -1
  10. package/dist/auto.cjs +2 -2
  11. package/dist/auto.js +1 -1
  12. package/dist/correlation-id.cjs +1 -1
  13. package/dist/correlation-id.js +1 -1
  14. package/dist/decorators.cjs +1 -1
  15. package/dist/decorators.js +1 -1
  16. package/dist/{event-Dlqr4ZNL.cjs → event-BhHREDJk.cjs} +3 -3
  17. package/dist/{event-Dlqr4ZNL.cjs.map → event-BhHREDJk.cjs.map} +1 -1
  18. package/dist/{event-_58ryBjh.js → event-ByBTV9M2.js} +3 -3
  19. package/dist/{event-_58ryBjh.js.map → event-ByBTV9M2.js.map} +1 -1
  20. package/dist/event.cjs +1 -1
  21. package/dist/event.js +1 -1
  22. package/dist/{functional-BGkT8J-h.js → functional-DtI0u4vx.js} +19 -19
  23. package/dist/functional-DtI0u4vx.js.map +1 -0
  24. package/dist/{functional-C4CzoVrX.cjs → functional-zpzNLhky.cjs} +4 -4
  25. package/dist/{functional-C4CzoVrX.cjs.map → functional-zpzNLhky.cjs.map} +1 -1
  26. package/dist/functional.cjs +1 -1
  27. package/dist/functional.js +1 -1
  28. package/dist/http.cjs +1 -1
  29. package/dist/http.js +1 -1
  30. package/dist/{index-CX0aG1Uh.d.ts → index-Ck06vlW2.d.ts} +2 -32
  31. package/dist/index-Ck06vlW2.d.ts.map +1 -0
  32. package/dist/{index-DIWZFKUS.d.cts → index-eKuioqT1.d.cts} +2 -32
  33. package/dist/index-eKuioqT1.d.cts.map +1 -0
  34. package/dist/index.cjs +7 -351
  35. package/dist/index.cjs.map +1 -1
  36. package/dist/index.d.cts +4 -172
  37. package/dist/index.d.cts.map +1 -1
  38. package/dist/index.d.ts +4 -172
  39. package/dist/index.d.ts.map +1 -1
  40. package/dist/index.js +9 -338
  41. package/dist/index.js.map +1 -1
  42. package/dist/{init-DJQOdVlN.d.ts → init-B7u-DjxM.d.ts} +57 -2
  43. package/dist/init-B7u-DjxM.d.ts.map +1 -0
  44. package/dist/{init-DvapOXCc.cjs → init-BX7AmFRl.cjs} +40 -21
  45. package/dist/init-BX7AmFRl.cjs.map +1 -0
  46. package/dist/{init-Ch6t7MNI.js → init-D-jnNMix.js} +39 -20
  47. package/dist/init-D-jnNMix.js.map +1 -0
  48. package/dist/{init-CNp-ee80.d.cts → init-DSrRmVnz.d.cts} +57 -2
  49. package/dist/init-DSrRmVnz.d.cts.map +1 -0
  50. package/dist/instrumentation.cjs +1 -1
  51. package/dist/instrumentation.js +1 -1
  52. package/dist/logger-D3Ej3DII.js +446 -0
  53. package/dist/logger-D3Ej3DII.js.map +1 -0
  54. package/dist/logger-thMPLpOG.cjs +487 -0
  55. package/dist/logger-thMPLpOG.cjs.map +1 -0
  56. package/dist/logger.cjs +8 -236
  57. package/dist/logger.js +2 -204
  58. package/dist/messaging.cjs +1 -1
  59. package/dist/messaging.js +1 -1
  60. package/dist/{registry-DfXA3R1L.js → registry-DVSmWg6Y.js} +2 -11
  61. package/dist/registry-DVSmWg6Y.js.map +1 -0
  62. package/dist/{registry-JZg2J3RZ.cjs → registry-DYgvb62e.cjs} +1 -16
  63. package/dist/registry-DYgvb62e.cjs.map +1 -0
  64. package/dist/semantic-conventions.cjs +1 -1
  65. package/dist/semantic-conventions.js +1 -1
  66. package/dist/semantic-helpers.cjs +1 -114
  67. package/dist/semantic-helpers.cjs.map +1 -1
  68. package/dist/semantic-helpers.d.cts +1 -114
  69. package/dist/semantic-helpers.d.cts.map +1 -1
  70. package/dist/semantic-helpers.d.ts +1 -114
  71. package/dist/semantic-helpers.d.ts.map +1 -1
  72. package/dist/semantic-helpers.js +2 -114
  73. package/dist/semantic-helpers.js.map +1 -1
  74. package/dist/{track-3HY4NGV-.cjs → track-D59FfpL0.cjs} +2 -2
  75. package/dist/{track-3HY4NGV-.cjs.map → track-D59FfpL0.cjs.map} +1 -1
  76. package/dist/{track-nsKVy-pj.js → track-wc0HafS_.js} +6 -6
  77. package/dist/track-wc0HafS_.js.map +1 -0
  78. package/dist/webhook.cjs +1 -1
  79. package/dist/webhook.js +1 -1
  80. package/dist/workflow-distributed.cjs +1 -1
  81. package/dist/workflow-distributed.js +1 -1
  82. package/dist/workflow.cjs +1 -1
  83. package/dist/workflow.js +1 -1
  84. package/dist/{yaml-config-B3dQ82GR.cjs → yaml-config-Ck2uB0Dp.cjs} +2 -1
  85. package/dist/yaml-config-Ck2uB0Dp.cjs.map +1 -0
  86. package/dist/yaml-config.cjs +1 -1
  87. package/dist/yaml-config.d.cts +7 -1
  88. package/dist/yaml-config.d.cts.map +1 -1
  89. package/dist/yaml-config.d.ts +7 -1
  90. package/dist/yaml-config.d.ts.map +1 -1
  91. package/dist/yaml-config.js +1 -0
  92. package/dist/yaml-config.js.map +1 -1
  93. package/package.json +1 -1
  94. package/skills/analyze-traces/SKILL.md +14 -12
  95. package/skills/autotel-core/SKILL.md +2 -0
  96. package/skills/autotel-instrumentation/SKILL.md +25 -0
  97. package/skills/debug-missing-spans/SKILL.md +3 -1
  98. package/skills/migrate-to-autotel/SKILL.md +24 -23
  99. package/skills/review-otel-patterns/SKILL.md +9 -6
  100. package/skills/tune-sampling/SKILL.md +8 -3
  101. package/src/attributes/builders.ts +2 -20
  102. package/src/attributes/index.ts +0 -1
  103. package/src/attributes/registry.ts +2 -9
  104. package/src/attributes/types.ts +0 -8
  105. package/src/index.ts +4 -41
  106. package/src/init.customization.test.ts +71 -0
  107. package/src/init.ts +167 -40
  108. package/src/semantic-helpers.test.ts +2 -87
  109. package/src/semantic-helpers.ts +0 -146
  110. package/src/yaml-config.test.ts +36 -0
  111. package/src/yaml-config.ts +10 -1
  112. package/dist/attributes-D3etyRVc.cjs.map +0 -1
  113. package/dist/attributes-ksn4HVbd.js.map +0 -1
  114. package/dist/functional-BGkT8J-h.js.map +0 -1
  115. package/dist/index-CX0aG1Uh.d.ts.map +0 -1
  116. package/dist/index-DIWZFKUS.d.cts.map +0 -1
  117. package/dist/init-CNp-ee80.d.cts.map +0 -1
  118. package/dist/init-Ch6t7MNI.js.map +0 -1
  119. package/dist/init-DJQOdVlN.d.ts.map +0 -1
  120. package/dist/init-DvapOXCc.cjs.map +0 -1
  121. package/dist/logger.cjs.map +0 -1
  122. package/dist/logger.js.map +0 -1
  123. package/dist/registry-DfXA3R1L.js.map +0 -1
  124. package/dist/registry-JZg2J3RZ.cjs.map +0 -1
  125. package/dist/track-nsKVy-pj.js.map +0 -1
  126. package/dist/yaml-config-B3dQ82GR.cjs.map +0 -1
  127. package/src/gen-ai-cost.test.ts +0 -81
  128. package/src/gen-ai-cost.ts +0 -145
  129. package/src/gen-ai-events.test.ts +0 -135
  130. package/src/gen-ai-events.ts +0 -208
  131. package/src/gen-ai-metrics.test.ts +0 -96
  132. package/src/gen-ai-metrics.ts +0 -128
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { a as AttributeRedactorPreset, c as REDACTOR_PATTERNS, d as builtinPatterns, f as createAttributeRedactor, i as AttributeRedactorFn, l as REDACTOR_PRESETS, m as normalizeAttributeRedactorConfig, n as AttributeRedactingProcessorOptions, o as BuiltinPatternName, p as createRedactedSpan, r as AttributeRedactorConfig, s as MaskFn, t as AttributeRedactingProcessor, u as ValuePatternConfig } from "./attribute-redacting-processor-DtTS9xxh.js";
2
- import { A as ExceptionAttrs, B as OTelAttrs, C as CloudAttrs, D as DeploymentAttrs, E as DBAttrs, F as HTTPClientAttrs, G as ServiceAttrs, H as ProcessAttrs, I as HTTPServerAttrs, J as ThreadAttrs, K as SessionAttrs, L as K8sAttrs, M as FeatureFlagAttrs, N as GenAIAttrs, O as DeviceAttrs, P as GraphQLAttrs, R as MessagingAttrs, S as ClientAttrs, T as ContainerAttrs, U as RPCAttrs, V as PeerAttrs, W as ServerAddressAttrs, X as UserAttrs, Y as URLAttrs, _ as autoRedactPII, a as httpClient, b as validateAttribute, c as mergeServiceResource, d as setError, f as setException, g as AttributePolicy, h as AttributeGuardrails, i as dbClient, j as FaaSAttrs, k as ErrorAttrs, l as request, m as setUser, n as safeSetAttributes, o as httpServer, p as setSession, q as TLSAttrs, s as identify, t as mergeAttrs, u as setDevice, w as CodeAttrs, x as attrs, z as NetworkAttrs } from "./index-CX0aG1Uh.js";
2
+ import { A as ExceptionAttrs, B as PeerAttrs, C as CloudAttrs, D as DeploymentAttrs, E as DBAttrs, F as HTTPServerAttrs, G as SessionAttrs, H as RPCAttrs, I as K8sAttrs, J as URLAttrs, K as TLSAttrs, L as MessagingAttrs, M as FeatureFlagAttrs, N as GraphQLAttrs, O as DeviceAttrs, P as HTTPClientAttrs, R as NetworkAttrs, S as ClientAttrs, T as ContainerAttrs, U as ServerAddressAttrs, V as ProcessAttrs, W as ServiceAttrs, Y as UserAttrs, _ as autoRedactPII, a as httpClient, b as validateAttribute, c as mergeServiceResource, d as setError, f as setException, g as AttributePolicy, h as AttributeGuardrails, i as dbClient, j as FaaSAttrs, k as ErrorAttrs, l as request, m as setUser, n as safeSetAttributes, o as httpServer, p as setSession, q as ThreadAttrs, s as identify, t as mergeAttrs, u as setDevice, w as CodeAttrs, x as attrs, z as OTelAttrs } from "./index-Ck06vlW2.js";
3
3
  import { n as TraceContext$1, r as defineBaggageSchema, t as AttributeValue$2 } from "./trace-context-Cijqoi6e.js";
4
4
  import { BaggageError, BaggageFieldDefinition, BaggageFieldType, BusinessBaggage, BusinessBaggageValues, SafeBaggageOptions, SafeBaggageSchema, createSafeBaggageSchema } from "./business-baggage.js";
5
5
  import { CORRELATION_ID_BAGGAGE_KEY, generateCorrelationId, getCorrelationId, getOrCreateCorrelationId, runWithCorrelationId, setCorrelationId, setCorrelationIdInBaggage } from "./correlation-id.js";
@@ -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-D1XLkPzi.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-B8R8B7Uk.js";
12
- import { a as lockLogger, i as isLoggerLocked, n as init, o as StringRedactor, r as isInitialized, s as createStringRedactor, t as AutotelConfig } from "./init-DJQOdVlN.js";
12
+ import { a as isLoggerLocked, c as createStringRedactor, i as isInitialized, o as lockLogger, r as init, s as StringRedactor, t as AutotelConfig } from "./init-B7u-DjxM.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-8ZOGJuwv.js";
14
14
  import { i as defineEvent, n as DefinedEvent, r as SchemaLike, t as DefineEventOptions } from "./define-event-CreknLm3.js";
15
15
  import { ParsedError, parseError } from "./parse-error.js";
@@ -17,13 +17,12 @@ import { Metric, MetricsOptions, getMetrics, resetMetrics } from "./metric.js";
17
17
  import { createCounter, createHistogram, createObservableGauge, createUpDownCounter, getMeter } from "./metric-helpers.js";
18
18
  import { TraceContext, createDeterministicTraceId, enrichWithTraceContext, finalizeSpan, flattenMetadata, getActiveContext, getActiveSpan, getTraceContext, getTracer, isTracing, resolveTraceUrl, runWithSpan } from "./trace-helpers.js";
19
19
  import { getAutotelTracer, getAutotelTracerProvider, setAutotelTracerProvider } from "./tracer-provider.js";
20
- import { DBConfig, HTTPConfig, LLMConfig, MessagingConfig, traceDB, traceHTTP, traceLLM, traceMessaging } from "./semantic-helpers.js";
20
+ import { DBConfig, HTTPConfig, MessagingConfig, traceDB, traceHTTP, traceMessaging } from "./semantic-helpers.js";
21
21
  import { a as URLAttributes, i as ServiceAttributes, n as httpResponseHeaderAttribute, r as HTTPAttributes, t as httpRequestHeaderAttribute } from "./semantic-conventions-FhSxv-bK.js";
22
22
  import { ConsumerConfig, ConsumerContext, LagMetricsConfig, MessagingOperation, MessagingSystem, ProducerConfig, ProducerContext, traceConsumer, traceProducer } from "./messaging.js";
23
23
  import { StepConfig, StepContext, StepStatus, WorkflowConfig, WorkflowContext, WorkflowStatus, getCurrentWorkflowContext, isInWorkflow, traceStep, traceWorkflow } from "./workflow.js";
24
24
  import { ReadableSpan, SpanProcessor } from "@opentelemetry/sdk-trace-base";
25
25
  import { AttributeValue, Attributes, Baggage, BaggageEntry, Context, Context as Context$1, Exception, HrTime, Link, Link as SpanLink, ROOT_CONTEXT, Span, Span as Span$2, SpanAttributes, SpanContext, SpanKind, SpanStatusCode, TextMapGetter, TextMapSetter, TimeInput, TraceFlags, TraceState, Tracer, TracerProvider, context, propagation, trace as otelTrace, trace as trace$1 } from "@opentelemetry/api";
26
- import { ViewOptions } from "@opentelemetry/sdk-metrics";
27
26
 
28
27
  //#region src/baggage-span-processor.d.ts
29
28
  interface BaggageSpanProcessorOptions {
@@ -635,172 +634,5 @@ declare function defineEnricher<TEvent extends Record<string, unknown>, TValue e
635
634
  */
636
635
  declare function formatDuration(ms: number): string;
637
636
  //#endregion
638
- //#region src/gen-ai-metrics.d.ts
639
- /**
640
- * Duration buckets for LLM operations, in **seconds**. Covers fast
641
- * completions (50ms) through long-running reasoning jobs (5 min).
642
- *
643
- * Aligns with the OTel GenAI semantic conventions' published advice for
644
- * `gen_ai.client.operation.duration`.
645
- */
646
- declare const GEN_AI_DURATION_BUCKETS_SECONDS: readonly number[];
647
- /**
648
- * Token-count buckets for prompt, completion, and total token histograms.
649
- * Ranges from tiny prompts to million-token context windows.
650
- *
651
- * Aligns with the OTel GenAI semantic conventions' published advice for
652
- * `gen_ai.client.token.usage`.
653
- */
654
- declare const GEN_AI_TOKEN_USAGE_BUCKETS: readonly number[];
655
- /**
656
- * USD cost buckets. Sub-cent resolution at the low end (fractions of a
657
- * cent per small call) up to tens of dollars (batch jobs, Opus/o1 runs).
658
- */
659
- declare const GEN_AI_COST_USD_BUCKETS: readonly number[];
660
- /**
661
- * Instrument-level advice object for `createHistogram(name, advice)`.
662
- * Use when you control the instrument creation (e.g. custom business
663
- * LLM metrics); `genAiMetricViews()` is better when the metric comes
664
- * from a third-party plugin.
665
- */
666
- declare function llmHistogramAdvice(kind: 'duration' | 'tokens' | 'cost'): {
667
- advice: {
668
- explicitBucketBoundaries: number[];
669
- };
670
- };
671
- /**
672
- * Returns `View`s that re-bucket the standard OTel GenAI histograms. Pass
673
- * the result to your `MeterProvider`'s `views` option.
674
- *
675
- * Matches instrument names emitted by:
676
- * - OpenTelemetry GenAI autoinstrumentation
677
- * - OpenInference / OpenLLMetry (traceloop)
678
- * - Arize Phoenix, LangSmith, etc. that follow the OTel spec
679
- *
680
- * Add more instrument patterns via the `extra` argument if you emit
681
- * custom LLM metrics.
682
- */
683
- declare function genAiMetricViews(extra?: {
684
- instrumentName: string;
685
- kind: 'duration' | 'tokens' | 'cost';
686
- }[]): ViewOptions[];
687
- //#endregion
688
- //#region src/gen-ai-events.d.ts
689
- /** Attributes expected on a `gen_ai.prompt.sent` event. */
690
- interface PromptSentEvent {
691
- /** Model the caller intends to invoke (may differ from response model). */
692
- model?: string;
693
- /** Estimated input token count, when known before the call. */
694
- promptTokens?: number;
695
- /** Number of messages in a chat request (system + user + assistant). */
696
- messageCount?: number;
697
- /** Free-form operation kind — `chat` / `completion` / `embedding`. */
698
- operation?: string;
699
- }
700
- /** Attributes expected on a `gen_ai.response.received` event. */
701
- interface ResponseReceivedEvent {
702
- /** Model the provider actually served (may be more specific than requested). */
703
- model?: string;
704
- promptTokens?: number;
705
- completionTokens?: number;
706
- totalTokens?: number;
707
- /** `stop`, `length`, `content_filter`, `tool_calls`, etc. */
708
- finishReasons?: string[];
709
- }
710
- /** Attributes expected on a `gen_ai.retry` event. */
711
- interface RetryEvent {
712
- attempt: number;
713
- /** `rate_limit` | `timeout` | `provider_error` | custom label. */
714
- reason?: string;
715
- /** How long we'll wait before the next attempt. */
716
- delayMs?: number;
717
- /** HTTP status that triggered the retry, when applicable. */
718
- statusCode?: number;
719
- }
720
- /** Attributes expected on a `gen_ai.tool.call` event. */
721
- interface ToolCallEvent {
722
- toolName: string;
723
- /** Call identifier so responses can be correlated back to calls. */
724
- toolCallId?: string;
725
- /** Pre-serialised tool arguments; omit if sensitive. */
726
- arguments?: string;
727
- }
728
- /** Attributes expected on a `gen_ai.stream.first_token` event. */
729
- interface StreamFirstTokenEvent {
730
- /** Tokens streamed so far, if the caller tracks that. */
731
- tokensSoFar?: number;
732
- }
733
- /**
734
- * Record that a prompt was dispatched to the provider. Typically called
735
- * before `await provider.chat.completions.create(...)`.
736
- */
737
- declare function recordPromptSent(ctx: TraceContext$1, event?: PromptSentEvent): void;
738
- /**
739
- * Record a successful provider response. Call after the response arrives
740
- * (for non-streaming) or after the stream completes.
741
- */
742
- declare function recordResponseReceived(ctx: TraceContext$1, event?: ResponseReceivedEvent): void;
743
- /**
744
- * Record a retry attempt on an LLM call. Call *before* sleeping for
745
- * `delayMs` so the event timestamp accurately marks when the retry
746
- * decision was made.
747
- */
748
- declare function recordRetry(ctx: TraceContext$1, event: RetryEvent): void;
749
- /**
750
- * Record a tool / function call made in the course of an agent step.
751
- * Emits an event rather than a child span because many frameworks fire
752
- * several tool calls within a single provider response.
753
- */
754
- declare function recordToolCall(ctx: TraceContext$1, event: ToolCallEvent): void;
755
- /**
756
- * Record the time-to-first-token for a streaming response. Pair with
757
- * `recordResponseReceived` at the end so the span carries both the TTFT
758
- * marker and the final usage numbers.
759
- */
760
- declare function recordStreamFirstToken(ctx: TraceContext$1, event?: StreamFirstTokenEvent): void;
761
- //#endregion
762
- //#region src/gen-ai-cost.d.ts
763
- /** Span attribute key autotel sets for an estimated call cost. */
764
- declare const GEN_AI_COST_ATTRIBUTE = "gen_ai.usage.cost.usd";
765
- /** Pricing for a single model, in USD per 1,000,000 tokens. */
766
- interface ModelPricing {
767
- /** USD per 1M input (prompt) tokens. */
768
- inputPer1M: number;
769
- /** USD per 1M output (completion) tokens. */
770
- outputPer1M: number;
771
- /** USD per 1M cached input tokens. Defaults to {@link ModelPricing.inputPer1M}. */
772
- cachedInputPer1M?: number;
773
- }
774
- /** Token counts for a single LLM call. */
775
- interface TokenUsage {
776
- inputTokens?: number;
777
- outputTokens?: number;
778
- /** Cached input tokens, billed at {@link ModelPricing.cachedInputPer1M}. */
779
- cachedInputTokens?: number;
780
- }
781
- interface EstimateCostOptions {
782
- /** Override or extend {@link MODEL_PRICING}. Keys are matched first. */
783
- pricing?: Record<string, ModelPricing>;
784
- }
785
- /**
786
- * Approximate public list prices (USD per 1M tokens) at the time of writing.
787
- * Prices change; treat these as convenience defaults, not a billing source of
788
- * truth. Override per call via `options.pricing` or mutate this table at init.
789
- * Matching is exact first, then by longest key prefix, so versioned model ids
790
- * (`claude-sonnet-4-6-20251101`) resolve to a base entry (`claude-sonnet-4-6`).
791
- */
792
- declare const MODEL_PRICING: Record<string, ModelPricing>;
793
- /**
794
- * Estimate the USD cost of an LLM call. Returns `undefined` when the model has
795
- * no known pricing (supply one via `options.pricing`).
796
- */
797
- declare function estimateLLMCost(model: string, usage: TokenUsage, options?: EstimateCostOptions): number | undefined;
798
- /**
799
- * Estimate cost and record it on `ctx` as the `gen_ai.usage.cost.usd` span
800
- * attribute. Returns the estimated cost, or `undefined` when the model is
801
- * unknown (in which case no attribute is set).
802
- */
803
- declare function recordLLMCost(ctx: Pick<TraceContext$1, 'setAttribute'>, model: string, usage: TokenUsage, options?: EstimateCostOptions): number | undefined;
804
- //#endregion
805
- export { AUTOTEL_SAMPLING_TAIL_EVALUATED, AUTOTEL_SAMPLING_TAIL_KEEP, AdaptiveSampler, AlwaysSampler, type AttributeGuardrails, type AttributePolicy, AttributeRedactingProcessor, type AttributeRedactingProcessorOptions, type AttributeRedactorConfig, type AttributeRedactorFn, type AttributeRedactorPreset, type AttributeValue, type Attributes, type AuditAction, type AuditCatalog, type AuditCatalogEntry, type AuditDescriptor, type AuditSeverity, type AutotelConfig, type Baggage, type BaggageEntry, type BaggageError, type BaggageFieldDefinition, type BaggageFieldType, BaggageSpanProcessor, type BaggageSpanProcessorOptions, type BuiltinPatternName, BusinessBaggage, type BusinessBaggageValues, CORRELATION_ID_BAGGAGE_KEY, type ClientAttrs, type CloudAttrs, type CodeAttrs, type ConsumerConfig, type ConsumerContext, type ContainerAttrs, type Context, type DBAttrs, type DBConfig, type DefineEventOptions, type DefinedEvent, type DeploymentAttrs, type DeviceAttrs, type DrainOptions, type DrainPipelineOptions, type EnrichContext, type EnricherDefinition, type EnricherOptions, type ErrorAttrs, type ErrorBuildOptions, type ErrorBuilder, type ErrorCatalog, type ErrorCatalogEntry, type EstimateCostOptions, Event, type EventAttributes, type EventSubscriber, type EventsOptions, type Exception, type ExceptionAttrs, type FaaSAttrs, type FeatureFlagAttrs, FilteringSpanProcessor, type FilteringSpanProcessorOptions, type ForkLifecycle, type ForkOptions, type FunnelStatus, GEN_AI_COST_ATTRIBUTE, GEN_AI_COST_USD_BUCKETS, GEN_AI_DURATION_BUCKETS_SECONDS, GEN_AI_TOKEN_USAGE_BUCKETS, type GenAIAttrs, type GraphQLAttrs, HTTPAttributes, type HTTPClientAttrs, type HTTPConfig, type HTTPServerAttrs, type HrTime, type HttpDrainOptions, type HttpDrainRequest, type InstrumentOptions, type K8sAttrs, type LLMConfig, type LagMetricsConfig, type Link, MODEL_PRICING, type MaskFn, type MessagingAttrs, type MessagingConfig, type MessagingOperation, type MessagingSystem, Metric, type MetricsOptions, type ModelPricing, NORMALIZER_PATTERNS, NORMALIZER_PRESETS, type NetworkAttrs, NeverSampler, type OTelAttrs, type OperationContext, type TraceContext as OtelTraceContext, type OutcomeStatus, type ParsedError, type PeerAttrs, type PipelineDrainFn, type ProcessAttrs, type ProducerConfig, type ProducerContext, type PromptSentEvent, REDACTOR_PATTERNS, REDACTOR_PRESETS, ROOT_CONTEXT, type RPCAttrs, RandomSampler, type RequestLogSnapshot, type RequestLogger, type RequestLoggerOptions, type ResponseReceivedEvent, type RetryEvent, type SafeBaggageOptions, type SafeBaggageSchema, type Sampler, type SamplingContext, type SamplingPreset, type SchemaLike, type ServerAddressAttrs, ServiceAttributes, type ServiceAttrs, type SessionAttrs, type Span, type SpanAttributes, type SpanContext, type SpanFilterPredicate, SpanKind, type SpanLink, type SpanNameNormalizerConfig, type SpanNameNormalizerFn, type SpanNameNormalizerPreset, SpanNameNormalizingProcessor, type SpanNameNormalizingProcessorOptions, type SpanOptions, SpanStatusCode, type StepConfig, type StepContext, type StepStatus, type StreamFirstTokenEvent, type StringRedactor, type StructuredError, type StructuredErrorInput, type TLSAttrs, type TextMapGetter, type TextMapSetter, type ThreadAttrs, type TimeInput, type TokenUsage, type ToolCallEvent, type TraceContext$1 as TraceContext, type TraceFlags, type TraceState, type Tracer, type TracerProvider, URLAttributes, type URLAttrs, type UserAttrs, UserIdSampler, type ValuePatternConfig, type WithBaggageOptions, type WithNewContextOptions, type WorkflowConfig, type WorkflowContext, type WorkflowStatus, attrs, autoRedactPII, builtinPatterns, context, createAttributeRedactor, createCounter, createDeterministicTraceId, createDrainPipeline, createHistogram, createLinkFromHeaders, createNoopRequestLogger, createObservableGauge, createRedactedSpan, createSafeBaggageSchema, createStringRedactor, createStructuredError, createUpDownCounter, ctx, dbClient, defineAuditCatalog, defineBaggageSchema, defineDrain, defineEnricher, defineErrorCatalog, defineEvent, defineHttpDrain, enrichWithTraceContext, estimateLLMCost, extractLinksFromBatch, finalizeSpan, flattenMetadata, flattenToAttributes, flush, formatDuration, genAiMetricViews, generateCorrelationId, getActiveContext, getActiveSpan, getAutotelTracer, getAutotelTracerProvider, getCatalogCode, getCorrelationId, getCurrentWorkflowContext, getEventQueue, getEvents, getMeter, getMetrics, getOperationContext, getOrCreateCorrelationId, getRequestLogger, getRequestLoggerSafe, getStructuredErrorAttributes, getTraceContext, getTracer, hasRequestContext, httpClient, httpRequestHeaderAttribute, httpResponseHeaderAttribute, httpServer, identify, init, instrument, isCatalogError, isInWorkflow, isInitialized, isLoggerLocked, isTracing, llmHistogramAdvice, lockLogger, markAsImmediate, mergeAttrs, mergeServiceResource, normalizeAttributeRedactorConfig, otelTrace, parseError, propagation, recordLLMCost, recordPromptSent, recordResponseReceived, recordRetry, recordStreamFirstToken, recordStructuredError, recordToolCall, request, resetEvents, resetMetrics, resolveSamplingPreset, resolveTraceUrl, runInOperationContext, runWithCorrelationId, runWithRequestContext, runWithSpan, safeSetAttributes, samplingPresets, setAutotelTracerProvider, setCorrelationId, setCorrelationIdInBaggage, setDevice, setError, setException, setSession, setUser, shutdown, span, structuredErrorToJSON, toAttributeValue, trace, traceConsumer, traceDB, traceHTTP, traceLLM, traceMessaging, traceProducer, traceStep, traceWorkflow, track, validateAttribute, withBaggage, withNewContext, withTracing };
637
+ export { AUTOTEL_SAMPLING_TAIL_EVALUATED, AUTOTEL_SAMPLING_TAIL_KEEP, AdaptiveSampler, AlwaysSampler, type AttributeGuardrails, type AttributePolicy, AttributeRedactingProcessor, type AttributeRedactingProcessorOptions, type AttributeRedactorConfig, type AttributeRedactorFn, type AttributeRedactorPreset, type AttributeValue, type Attributes, type AuditAction, type AuditCatalog, type AuditCatalogEntry, type AuditDescriptor, type AuditSeverity, type AutotelConfig, type Baggage, type BaggageEntry, type BaggageError, type BaggageFieldDefinition, type BaggageFieldType, BaggageSpanProcessor, type BaggageSpanProcessorOptions, type BuiltinPatternName, BusinessBaggage, type BusinessBaggageValues, CORRELATION_ID_BAGGAGE_KEY, type ClientAttrs, type CloudAttrs, type CodeAttrs, type ConsumerConfig, type ConsumerContext, type ContainerAttrs, type Context, type DBAttrs, type DBConfig, type DefineEventOptions, type DefinedEvent, type DeploymentAttrs, type DeviceAttrs, type DrainOptions, type DrainPipelineOptions, type EnrichContext, type EnricherDefinition, type EnricherOptions, type ErrorAttrs, type ErrorBuildOptions, type ErrorBuilder, type ErrorCatalog, type ErrorCatalogEntry, Event, type EventAttributes, type EventSubscriber, type EventsOptions, type Exception, type ExceptionAttrs, type FaaSAttrs, type FeatureFlagAttrs, FilteringSpanProcessor, type FilteringSpanProcessorOptions, type ForkLifecycle, type ForkOptions, type FunnelStatus, type GraphQLAttrs, HTTPAttributes, type HTTPClientAttrs, type HTTPConfig, type HTTPServerAttrs, type HrTime, type HttpDrainOptions, type HttpDrainRequest, type InstrumentOptions, type K8sAttrs, type LagMetricsConfig, type Link, type MaskFn, type MessagingAttrs, type MessagingConfig, type MessagingOperation, type MessagingSystem, Metric, type MetricsOptions, NORMALIZER_PATTERNS, NORMALIZER_PRESETS, type NetworkAttrs, NeverSampler, type OTelAttrs, type OperationContext, type TraceContext as OtelTraceContext, type OutcomeStatus, type ParsedError, type PeerAttrs, type PipelineDrainFn, type ProcessAttrs, type ProducerConfig, type ProducerContext, REDACTOR_PATTERNS, REDACTOR_PRESETS, ROOT_CONTEXT, type RPCAttrs, RandomSampler, type RequestLogSnapshot, type RequestLogger, type RequestLoggerOptions, type SafeBaggageOptions, type SafeBaggageSchema, type Sampler, type SamplingContext, type SamplingPreset, type SchemaLike, type ServerAddressAttrs, ServiceAttributes, type ServiceAttrs, type SessionAttrs, type Span, type SpanAttributes, type SpanContext, type SpanFilterPredicate, SpanKind, type SpanLink, type SpanNameNormalizerConfig, type SpanNameNormalizerFn, type SpanNameNormalizerPreset, SpanNameNormalizingProcessor, type SpanNameNormalizingProcessorOptions, type SpanOptions, SpanStatusCode, type StepConfig, type StepContext, type StepStatus, type StringRedactor, type StructuredError, type StructuredErrorInput, type TLSAttrs, type TextMapGetter, type TextMapSetter, type ThreadAttrs, type TimeInput, type TraceContext$1 as TraceContext, type TraceFlags, type TraceState, type Tracer, type TracerProvider, URLAttributes, type URLAttrs, type UserAttrs, UserIdSampler, type ValuePatternConfig, type WithBaggageOptions, type WithNewContextOptions, type WorkflowConfig, type WorkflowContext, type WorkflowStatus, attrs, autoRedactPII, builtinPatterns, context, createAttributeRedactor, createCounter, createDeterministicTraceId, createDrainPipeline, createHistogram, createLinkFromHeaders, createNoopRequestLogger, createObservableGauge, createRedactedSpan, createSafeBaggageSchema, createStringRedactor, createStructuredError, createUpDownCounter, ctx, dbClient, defineAuditCatalog, defineBaggageSchema, defineDrain, defineEnricher, defineErrorCatalog, defineEvent, defineHttpDrain, enrichWithTraceContext, extractLinksFromBatch, finalizeSpan, flattenMetadata, flattenToAttributes, flush, formatDuration, generateCorrelationId, getActiveContext, getActiveSpan, getAutotelTracer, getAutotelTracerProvider, getCatalogCode, getCorrelationId, getCurrentWorkflowContext, getEventQueue, getEvents, getMeter, getMetrics, getOperationContext, getOrCreateCorrelationId, getRequestLogger, getRequestLoggerSafe, getStructuredErrorAttributes, getTraceContext, getTracer, hasRequestContext, httpClient, httpRequestHeaderAttribute, httpResponseHeaderAttribute, httpServer, identify, init, instrument, isCatalogError, isInWorkflow, isInitialized, isLoggerLocked, isTracing, lockLogger, markAsImmediate, mergeAttrs, mergeServiceResource, normalizeAttributeRedactorConfig, otelTrace, parseError, propagation, recordStructuredError, request, resetEvents, resetMetrics, resolveSamplingPreset, resolveTraceUrl, runInOperationContext, runWithCorrelationId, runWithRequestContext, runWithSpan, safeSetAttributes, samplingPresets, setAutotelTracerProvider, setCorrelationId, setCorrelationIdInBaggage, setDevice, setError, setException, setSession, setUser, shutdown, span, structuredErrorToJSON, toAttributeValue, trace, traceConsumer, traceDB, traceHTTP, traceMessaging, traceProducer, traceStep, traceWorkflow, track, validateAttribute, withBaggage, withNewContext, withTracing };
806
638
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","names":[],"sources":["../src/baggage-span-processor.ts","../src/trace-hybrid.ts","../src/operation-context.ts","../src/rate-limiter.ts","../src/event-queue.ts","../src/track.ts","../src/shutdown.ts","../src/request-logger.ts","../src/structured-error.ts","../src/error-catalog.ts","../src/flatten-attributes.ts","../src/drain-toolkit.ts","../src/enricher-toolkit.ts","../src/pretty-log-formatter.ts","../src/gen-ai-metrics.ts","../src/gen-ai-events.ts","../src/gen-ai-cost.ts"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;UAaiB,2BAAA;;;;;EAKf,MAAM;AAAA;;;;;;;;;;;;;;AALR;;;;AAKQ;AAkCR;;;;;;;;;;;;;cAAa,oBAAA,YAAgC,aAAA;EAAA,iBAC1B,MAAA;cAEL,OAAA,GAAS,2BAAA;EAIrB,OAAA,CAAQ,IAAA,EAAM,MAAA,EAAM,aAAA,EAAe,SAAA;EA6BnC,KAAA,CAAM,KAAA,EAAO,YAAA;EAIP,QAAA,IAAY,OAAA;EAIZ,UAAA,IAAc,OAAA;AAAA;;;cC/DT,KAAA,SAAc,OAAA,UAAwB,OAGH;;;;;;;;;;;;;;;UCrB/B,gBAAA;;;;;EAKf,IAAI;AAAA;;;;;;;;;;;AFPN;;;iBE4BgB,mBAAA,IAAuB,gBAAgB;AFvB/C;AAkCR;;;;;;;;;;;;;;;;;;;AAlCQ,iBE+CQ,qBAAA,IAAyB,IAAA,UAAc,EAAA,QAAU,CAAA,GAAI,CAAC;;;;;;;;;UC1DrD,iBAAA;;EAEf,kBAAA;;EAEA,aAAa;AAAA;;;UCoBE,SAAA;EACf,IAAA;EACA,UAAA,GAAa,eAAA;EACb,SAAA;;EAEA,cAAA;;EAEA,QAAA;;EAEA,OAAA,GAAU,mBAAA;;EAEV,MAAA,GAAS,mBAAA;AAAA;AAAA,UAaM,WAAA;EACf,OAAA;EACA,SAAA;EACA,aAAA;EACA,UAAA;EACA,SAAA,GAAY,iBAAiB;AAAA;;;;;;;;;;;cA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;;;;;;;cAUd,aAAA,EAAe,MAAM,SAAS,YAAA;;;;;iBA+C3B,eAAA,CACd,KAAA,UACA,KAAA,EAAO,UAAA,EACP,OAAA,GAAU,mBAAmB;;;;;;iBA0Bf,aAAA,CACd,GAAA,EAAK,IAAA,CAAK,cAAA,mBACV,KAAA,UACA,KAAA,EAAO,UAAA,EACP,OAAA,GAAU,mBAAA"}
1
+ {"version":3,"file":"index.d.ts","names":[],"sources":["../src/baggage-span-processor.ts","../src/trace-hybrid.ts","../src/operation-context.ts","../src/rate-limiter.ts","../src/event-queue.ts","../src/track.ts","../src/shutdown.ts","../src/request-logger.ts","../src/structured-error.ts","../src/error-catalog.ts","../src/flatten-attributes.ts","../src/drain-toolkit.ts","../src/enricher-toolkit.ts","../src/pretty-log-formatter.ts"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;UAaiB,2BAAA;;;;;EAKf,MAAM;AAAA;;;;;;;;;;;;;AALR;;;;AAKQ;AAkCR;;;;;;;;;;;;;;cAAa,oBAAA,YAAgC,aAAA;EAAA,iBAC1B,MAAA;cAEL,OAAA,GAAS,2BAAA;EAIrB,OAAA,CAAQ,IAAA,EAAM,MAAA,EAAM,aAAA,EAAe,SAAA;EA6BnC,KAAA,CAAM,KAAA,EAAO,YAAA;EAIP,QAAA,IAAY,OAAA;EAIZ,UAAA,IAAc,OAAA;AAAA;;;cC/DT,KAAA,SAAc,OAAA,UAAwB,OAGH;;;;;;;;;;;;;;;UCrB/B,gBAAA;;;;;EAKf,IAAI;AAAA;;;;;;;;;;AFPN;;;;iBE4BgB,mBAAA,IAAuB,gBAAgB;AFWvD;;;;;;;;;;;;;;;;;;;;AAAA,iBEagB,qBAAA,IAAyB,IAAA,UAAc,EAAA,QAAU,CAAA,GAAI,CAAC;;;;;;;;;UC1DrD,iBAAA;;EAEf,kBAAA;;EAEA,aAAa;AAAA;;;UCoBE,SAAA;EACf,IAAA;EACA,UAAA,GAAa,eAAA;EACb,SAAA;;EAEA,cAAA;;E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A,EAAQ,MAAA,GAChC,OAAA,GAAS,eAAA,IACP,GAAA,EAAK,aAAA,CAAc,MAAA;;;;;;;;;;;iBCUP,cAAA,CAAe,EAAU"}
package/dist/index.js CHANGED
@@ -1,31 +1,30 @@
1
+ import { getAutotelTracer, getAutotelTracerProvider, setAutotelTracerProvider } from "./tracer-provider.js";
1
2
  import { AUTOTEL_SAMPLING_TAIL_EVALUATED, AUTOTEL_SAMPLING_TAIL_KEEP, AdaptiveSampler, AlwaysSampler, NeverSampler, RandomSampler, UserIdSampler, createLinkFromHeaders, extractLinksFromBatch, resolveSamplingPreset, samplingPresets } from "./sampling.js";
2
- import { a as getSdk, c as isInitialized, f as createStringRedactor, i as getLogger, l as isLoggerLocked, p as BaggageSpanProcessor, s as init, t as _closeEmbeddedDevtools, u as lockLogger } from "./init-Ch6t7MNI.js";
3
+ import { a as getSdk, c as isInitialized, f as createStringRedactor, i as getLogger, l as isLoggerLocked, p as BaggageSpanProcessor, s as init, t as _closeEmbeddedDevtools, u as lockLogger } from "./init-D-jnNMix.js";
3
4
  import { FilteringSpanProcessor } from "./filtering-span-processor.js";
4
5
  import { NORMALIZER_PATTERNS, NORMALIZER_PRESETS, SpanNameNormalizingProcessor } from "./span-name-normalizer.js";
5
6
  import { AttributeRedactingProcessor, REDACTOR_PATTERNS, REDACTOR_PRESETS, builtinPatterns, createAttributeRedactor, createRedactedSpan, normalizeAttributeRedactorConfig } from "./attribute-redacting-processor.js";
6
7
  import { n as formatDuration } from "./canonical-log-line-processor-DbBQT5vY.js";
7
- import { getAutotelTracer, getAutotelTracerProvider, setAutotelTracerProvider } from "./tracer-provider.js";
8
- import { a as CORRELATION_ID_BAGGAGE_KEY, d as setCorrelationId, f as setCorrelationIdInBaggage, l as getOrCreateCorrelationId, m as defineBaggageSchema, n as resetEventQueue, o as generateCorrelationId, p as createTraceContext, r as track, s as getCorrelationId, t as getEventQueue, u as runWithCorrelationId } from "./track-nsKVy-pj.js";
8
+ import { a as CORRELATION_ID_BAGGAGE_KEY, d as setCorrelationId, f as setCorrelationIdInBaggage, l as getOrCreateCorrelationId, m as defineBaggageSchema, n as resetEventQueue, o as generateCorrelationId, p as createTraceContext, r as track, s as getCorrelationId, t as getEventQueue, u as runWithCorrelationId } from "./track-wc0HafS_.js";
9
9
  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";
10
10
  import { createDeterministicTraceId, enrichWithTraceContext, finalizeSpan, flattenMetadata, getActiveContext, getActiveSpan, getTraceContext, getTracer, isTracing, resolveTraceUrl, runWithSpan } from "./trace-helpers.js";
11
11
  import { n as runInOperationContext, t as getOperationContext } from "./operation-context-C-2hmmtP.js";
12
- import { a as trace$2, c as withTracing, i as span, n as instrument, o as withBaggage, r as markAsImmediate, s as withNewContext, t as ctx } from "./functional-BGkT8J-h.js";
12
+ import { a as trace$2, c as withTracing, i as span, n as instrument, o as withBaggage, r as markAsImmediate, s as withNewContext, t as ctx } from "./functional-DtI0u4vx.js";
13
13
  import { t as hashJson } from "./stable-hash-Cg5cT34Q.js";
14
- import { n as getEvents, r as resetEvents, t as Event } from "./event-_58ryBjh.js";
14
+ import { n as getEvents, r as resetEvents, t as Event } from "./event-ByBTV9M2.js";
15
15
  import { Metric, getMetrics, resetMetrics } from "./metric.js";
16
16
  import { t as emitCorrelatedEvent } from "./correlated-events-Bzh5y-UB.js";
17
17
  import { parseError } from "./parse-error.js";
18
18
  import { createDrainPipeline } from "./drain-pipeline.js";
19
19
  import { createCounter, createHistogram, createObservableGauge, createUpDownCounter, getMeter } from "./metric-helpers.js";
20
- import { traceDB, traceHTTP, traceLLM, traceMessaging } from "./semantic-helpers.js";
21
- import { b as ServiceAttributes, f as HTTPAttributes, w as URLAttributes } from "./registry-DfXA3R1L.js";
20
+ import { traceDB, traceHTTP, traceMessaging } from "./semantic-helpers.js";
21
+ import { C as URLAttributes, d as HTTPAttributes, y as ServiceAttributes } from "./registry-DVSmWg6Y.js";
22
22
  import { httpRequestHeaderAttribute, httpResponseHeaderAttribute } from "./semantic-conventions.js";
23
- import { a as identify, c as setDevice, d as setSession, f as setUser, h as autoRedactPII, i as httpServer, l as setError, m as safeSetAttributes, n as dbClient, o as mergeServiceResource, p as mergeAttrs, r as httpClient, s as request, u as setException, v as validateAttribute, y as attrs } from "./attributes-ksn4HVbd.js";
23
+ import { a as identify, c as setDevice, d as setSession, f as setUser, h as autoRedactPII, i as httpServer, l as setError, m as safeSetAttributes, n as dbClient, o as mergeServiceResource, p as mergeAttrs, r as httpClient, s as request, u as setException, v as validateAttribute, y as attrs } from "./attributes-CmYpdqCN.js";
24
24
  import { traceConsumer, traceProducer } from "./messaging.js";
25
25
  import { BusinessBaggage, createSafeBaggageSchema } from "./business-baggage.js";
26
26
  import { getCurrentWorkflowContext, isInWorkflow, traceStep, traceWorkflow } from "./workflow.js";
27
27
  import { ROOT_CONTEXT, SpanKind, SpanStatusCode, context, propagation, trace as otelTrace, trace as trace$1 } from "@opentelemetry/api";
28
- import { AggregationType } from "@opentelemetry/sdk-metrics";
29
28
  import { AsyncLocalStorage } from "node:async_hooks";
30
29
 
31
30
  //#region src/trace-hybrid.ts
@@ -643,333 +642,5 @@ function defineEnricher(def, options = {}) {
643
642
  }
644
643
 
645
644
  //#endregion
646
- //#region src/gen-ai-metrics.ts
647
- /**
648
- * LLM-tuned histogram buckets.
649
- *
650
- * Default OpenTelemetry histogram buckets target HTTP latency (0ms–10s)
651
- * and small counter values. LLM workloads have very different shapes:
652
- *
653
- * - **Duration**: single-token prompts can be fast (50ms), long
654
- * generations and reasoning models can run for minutes. Default buckets
655
- * crush everything above 10s into one bucket.
656
- * - **Token usage**: heavily right-skewed. A single request can range
657
- * from tens of tokens to the million-token context windows.
658
- * - **Cost (USD)**: per-request values are tiny (fractions of a cent),
659
- * so linear buckets waste resolution at the low end.
660
- *
661
- * This module exposes empirically-chosen bucket arrays and a View helper
662
- * so users can apply them to their `MeterProvider` without knowing the
663
- * exact instrument names emitted by OpenAI/Anthropic/Traceloop plugins.
664
- *
665
- * @example
666
- * ```typescript
667
- * import { NodeSDK } from '@opentelemetry/sdk-node';
668
- * import { genAiMetricViews } from 'autotel';
669
- *
670
- * const sdk = new NodeSDK({
671
- * serviceName: 'my-agent',
672
- * views: [...genAiMetricViews()],
673
- * });
674
- * sdk.start();
675
- * ```
676
- */
677
- /**
678
- * Duration buckets for LLM operations, in **seconds**. Covers fast
679
- * completions (50ms) through long-running reasoning jobs (5 min).
680
- *
681
- * Aligns with the OTel GenAI semantic conventions' published advice for
682
- * `gen_ai.client.operation.duration`.
683
- */
684
- const GEN_AI_DURATION_BUCKETS_SECONDS = Object.freeze([
685
- .01,
686
- .05,
687
- .1,
688
- .25,
689
- .5,
690
- 1,
691
- 2,
692
- 5,
693
- 10,
694
- 20,
695
- 30,
696
- 60,
697
- 120,
698
- 300
699
- ]);
700
- /**
701
- * Token-count buckets for prompt, completion, and total token histograms.
702
- * Ranges from tiny prompts to million-token context windows.
703
- *
704
- * Aligns with the OTel GenAI semantic conventions' published advice for
705
- * `gen_ai.client.token.usage`.
706
- */
707
- const GEN_AI_TOKEN_USAGE_BUCKETS = Object.freeze([
708
- 1,
709
- 4,
710
- 16,
711
- 64,
712
- 256,
713
- 1024,
714
- 4096,
715
- 16384,
716
- 65536,
717
- 262144,
718
- 1048576,
719
- 4194304
720
- ]);
721
- /**
722
- * USD cost buckets. Sub-cent resolution at the low end (fractions of a
723
- * cent per small call) up to tens of dollars (batch jobs, Opus/o1 runs).
724
- */
725
- const GEN_AI_COST_USD_BUCKETS = Object.freeze([
726
- 1e-5,
727
- 1e-4,
728
- .001,
729
- .005,
730
- .01,
731
- .05,
732
- .1,
733
- .5,
734
- 1,
735
- 5,
736
- 10,
737
- 50
738
- ]);
739
- /**
740
- * Instrument-level advice object for `createHistogram(name, advice)`.
741
- * Use when you control the instrument creation (e.g. custom business
742
- * LLM metrics); `genAiMetricViews()` is better when the metric comes
743
- * from a third-party plugin.
744
- */
745
- function llmHistogramAdvice(kind) {
746
- return { advice: { explicitBucketBoundaries: [...kind === "duration" ? GEN_AI_DURATION_BUCKETS_SECONDS : kind === "tokens" ? GEN_AI_TOKEN_USAGE_BUCKETS : GEN_AI_COST_USD_BUCKETS] } };
747
- }
748
- /**
749
- * Returns `View`s that re-bucket the standard OTel GenAI histograms. Pass
750
- * the result to your `MeterProvider`'s `views` option.
751
- *
752
- * Matches instrument names emitted by:
753
- * - OpenTelemetry GenAI autoinstrumentation
754
- * - OpenInference / OpenLLMetry (traceloop)
755
- * - Arize Phoenix, LangSmith, etc. that follow the OTel spec
756
- *
757
- * Add more instrument patterns via the `extra` argument if you emit
758
- * custom LLM metrics.
759
- */
760
- function genAiMetricViews(extra = []) {
761
- return [...[
762
- {
763
- instrumentName: "gen_ai.client.operation.duration",
764
- kind: "duration"
765
- },
766
- {
767
- instrumentName: "gen_ai.client.token.usage",
768
- kind: "tokens"
769
- },
770
- {
771
- instrumentName: "gen_ai.client.cost.usd",
772
- kind: "cost"
773
- }
774
- ], ...extra].map(({ instrumentName, kind }) => ({
775
- instrumentName,
776
- aggregation: {
777
- type: AggregationType.EXPLICIT_BUCKET_HISTOGRAM,
778
- options: { boundaries: kind === "duration" ? [...GEN_AI_DURATION_BUCKETS_SECONDS] : kind === "tokens" ? [...GEN_AI_TOKEN_USAGE_BUCKETS] : [...GEN_AI_COST_USD_BUCKETS] }
779
- }
780
- }));
781
- }
782
-
783
- //#endregion
784
- //#region src/gen-ai-events.ts
785
- /**
786
- * Record that a prompt was dispatched to the provider. Typically called
787
- * before `await provider.chat.completions.create(...)`.
788
- */
789
- function recordPromptSent(ctx, event = {}) {
790
- emitCorrelatedEvent(ctx, "gen_ai.prompt.sent", buildPromptSentAttrs(event));
791
- }
792
- /**
793
- * Record a successful provider response. Call after the response arrives
794
- * (for non-streaming) or after the stream completes.
795
- */
796
- function recordResponseReceived(ctx, event = {}) {
797
- emitCorrelatedEvent(ctx, "gen_ai.response.received", buildResponseAttrs(event));
798
- }
799
- /**
800
- * Record a retry attempt on an LLM call. Call *before* sleeping for
801
- * `delayMs` so the event timestamp accurately marks when the retry
802
- * decision was made.
803
- */
804
- function recordRetry(ctx, event) {
805
- emitCorrelatedEvent(ctx, "gen_ai.retry", buildRetryAttrs(event));
806
- }
807
- /**
808
- * Record a tool / function call made in the course of an agent step.
809
- * Emits an event rather than a child span because many frameworks fire
810
- * several tool calls within a single provider response.
811
- */
812
- function recordToolCall(ctx, event) {
813
- emitCorrelatedEvent(ctx, "gen_ai.tool.call", buildToolCallAttrs(event));
814
- }
815
- /**
816
- * Record the time-to-first-token for a streaming response. Pair with
817
- * `recordResponseReceived` at the end so the span carries both the TTFT
818
- * marker and the final usage numbers.
819
- */
820
- function recordStreamFirstToken(ctx, event = {}) {
821
- emitCorrelatedEvent(ctx, "gen_ai.stream.first_token", buildStreamFirstTokenAttrs(event));
822
- }
823
- function buildPromptSentAttrs(event) {
824
- const attrs = {};
825
- if (event.model) attrs["gen_ai.request.model"] = event.model;
826
- if (event.promptTokens !== void 0) attrs["gen_ai.usage.input_tokens"] = event.promptTokens;
827
- if (event.messageCount !== void 0) attrs["gen_ai.request.message_count"] = event.messageCount;
828
- if (event.operation) attrs["gen_ai.operation.name"] = event.operation;
829
- return attrs;
830
- }
831
- function buildResponseAttrs(event) {
832
- const attrs = {};
833
- if (event.model) attrs["gen_ai.response.model"] = event.model;
834
- if (event.promptTokens !== void 0) attrs["gen_ai.usage.input_tokens"] = event.promptTokens;
835
- if (event.completionTokens !== void 0) attrs["gen_ai.usage.output_tokens"] = event.completionTokens;
836
- if (event.totalTokens !== void 0) attrs["gen_ai.usage.total_tokens"] = event.totalTokens;
837
- if (event.finishReasons && event.finishReasons.length > 0) attrs["gen_ai.response.finish_reasons"] = event.finishReasons.join(",");
838
- return attrs;
839
- }
840
- function buildRetryAttrs(event) {
841
- const attrs = { "retry.attempt": event.attempt };
842
- if (event.reason) attrs["retry.reason"] = event.reason;
843
- if (event.delayMs !== void 0) attrs["retry.delay_ms"] = event.delayMs;
844
- if (event.statusCode !== void 0) attrs["http.response.status_code"] = event.statusCode;
845
- return attrs;
846
- }
847
- function buildToolCallAttrs(event) {
848
- const attrs = { "gen_ai.tool.name": event.toolName };
849
- if (event.toolCallId) attrs["gen_ai.tool.call.id"] = event.toolCallId;
850
- if (event.arguments) attrs["gen_ai.tool.arguments"] = event.arguments;
851
- return attrs;
852
- }
853
- function buildStreamFirstTokenAttrs(event) {
854
- const attrs = {};
855
- if (event.tokensSoFar !== void 0) attrs["gen_ai.stream.tokens_so_far"] = event.tokensSoFar;
856
- return attrs;
857
- }
858
-
859
- //#endregion
860
- //#region src/gen-ai-cost.ts
861
- /** Span attribute key autotel sets for an estimated call cost. */
862
- const GEN_AI_COST_ATTRIBUTE = "gen_ai.usage.cost.usd";
863
- /**
864
- * Approximate public list prices (USD per 1M tokens) at the time of writing.
865
- * Prices change; treat these as convenience defaults, not a billing source of
866
- * truth. Override per call via `options.pricing` or mutate this table at init.
867
- * Matching is exact first, then by longest key prefix, so versioned model ids
868
- * (`claude-sonnet-4-6-20251101`) resolve to a base entry (`claude-sonnet-4-6`).
869
- */
870
- const MODEL_PRICING = {
871
- "gpt-4o": {
872
- inputPer1M: 2.5,
873
- outputPer1M: 10
874
- },
875
- "gpt-4o-mini": {
876
- inputPer1M: .15,
877
- outputPer1M: .6
878
- },
879
- "gpt-4.1": {
880
- inputPer1M: 2,
881
- outputPer1M: 8
882
- },
883
- "gpt-4.1-mini": {
884
- inputPer1M: .4,
885
- outputPer1M: 1.6
886
- },
887
- "gpt-4.1-nano": {
888
- inputPer1M: .1,
889
- outputPer1M: .4
890
- },
891
- "o3-mini": {
892
- inputPer1M: 1.1,
893
- outputPer1M: 4.4
894
- },
895
- "claude-opus-4": {
896
- inputPer1M: 15,
897
- outputPer1M: 75
898
- },
899
- "claude-sonnet-4": {
900
- inputPer1M: 3,
901
- outputPer1M: 15
902
- },
903
- "claude-3-5-sonnet": {
904
- inputPer1M: 3,
905
- outputPer1M: 15
906
- },
907
- "claude-3-5-haiku": {
908
- inputPer1M: .8,
909
- outputPer1M: 4
910
- },
911
- "claude-3-opus": {
912
- inputPer1M: 15,
913
- outputPer1M: 75
914
- },
915
- "claude-3-haiku": {
916
- inputPer1M: .25,
917
- outputPer1M: 1.25
918
- },
919
- "gemini-1.5-pro": {
920
- inputPer1M: 1.25,
921
- outputPer1M: 5
922
- },
923
- "gemini-1.5-flash": {
924
- inputPer1M: .075,
925
- outputPer1M: .3
926
- },
927
- "gemini-2.0-flash": {
928
- inputPer1M: .1,
929
- outputPer1M: .4
930
- }
931
- };
932
- function resolvePricing(table, model) {
933
- const exact = table[model];
934
- if (exact) return exact;
935
- let best;
936
- let bestLength = 0;
937
- for (const key of Object.keys(table)) if (model.startsWith(key) && key.length > bestLength) {
938
- best = table[key];
939
- bestLength = key.length;
940
- }
941
- return best;
942
- }
943
- function round(value) {
944
- return Math.round(value * 1e6) / 1e6;
945
- }
946
- /**
947
- * Estimate the USD cost of an LLM call. Returns `undefined` when the model has
948
- * no known pricing (supply one via `options.pricing`).
949
- */
950
- function estimateLLMCost(model, usage, options) {
951
- const price = resolvePricing(options?.pricing ? {
952
- ...MODEL_PRICING,
953
- ...options.pricing
954
- } : MODEL_PRICING, model);
955
- if (!price) return void 0;
956
- const cachedInput = usage.cachedInputTokens ?? 0;
957
- const billedInput = Math.max(0, (usage.inputTokens ?? 0) - cachedInput);
958
- const output = usage.outputTokens ?? 0;
959
- const cachedRate = price.cachedInputPer1M ?? price.inputPer1M;
960
- return round(billedInput / 1e6 * price.inputPer1M + cachedInput / 1e6 * cachedRate + output / 1e6 * price.outputPer1M);
961
- }
962
- /**
963
- * Estimate cost and record it on `ctx` as the `gen_ai.usage.cost.usd` span
964
- * attribute. Returns the estimated cost, or `undefined` when the model is
965
- * unknown (in which case no attribute is set).
966
- */
967
- function recordLLMCost(ctx, model, usage, options) {
968
- const cost = estimateLLMCost(model, usage, options);
969
- if (cost !== void 0) ctx.setAttribute(GEN_AI_COST_ATTRIBUTE, cost);
970
- return cost;
971
- }
972
-
973
- //#endregion
974
- export { AUTOTEL_SAMPLING_TAIL_EVALUATED, AUTOTEL_SAMPLING_TAIL_KEEP, AdaptiveSampler, AlwaysSampler, AttributeRedactingProcessor, BaggageSpanProcessor, BusinessBaggage, CORRELATION_ID_BAGGAGE_KEY, Event, FilteringSpanProcessor, GEN_AI_COST_ATTRIBUTE, GEN_AI_COST_USD_BUCKETS, GEN_AI_DURATION_BUCKETS_SECONDS, GEN_AI_TOKEN_USAGE_BUCKETS, HTTPAttributes, MODEL_PRICING, Metric, NORMALIZER_PATTERNS, NORMALIZER_PRESETS, NeverSampler, REDACTOR_PATTERNS, REDACTOR_PRESETS, ROOT_CONTEXT, RandomSampler, ServiceAttributes, SpanKind, SpanNameNormalizingProcessor, SpanStatusCode, URLAttributes, UserIdSampler, attrs, autoRedactPII, builtinPatterns, context, createAttributeRedactor, createCounter, createDeterministicTraceId, createDrainPipeline, createHistogram, createLinkFromHeaders, createNoopRequestLogger, createObservableGauge, createRedactedSpan, createSafeBaggageSchema, createStringRedactor, createStructuredError, createUpDownCounter, ctx, dbClient, defineAuditCatalog, defineBaggageSchema, defineDrain, defineEnricher, defineErrorCatalog, defineEvent, defineHttpDrain, enrichWithTraceContext, estimateLLMCost, extractLinksFromBatch, finalizeSpan, flattenMetadata, flattenToAttributes, flush, formatDuration, genAiMetricViews, generateCorrelationId, getActiveContext, getActiveSpan, getAutotelTracer, getAutotelTracerProvider, getCatalogCode, getCorrelationId, getCurrentWorkflowContext, getEventQueue, getEvents, getMeter, getMetrics, getOperationContext, getOrCreateCorrelationId, getRequestLogger, getRequestLoggerSafe, getStructuredErrorAttributes, getTraceContext, getTracer, hasRequestContext, httpClient, httpRequestHeaderAttribute, httpResponseHeaderAttribute, httpServer, identify, init, instrument, isCatalogError, isInWorkflow, isInitialized, isLoggerLocked, isTracing, llmHistogramAdvice, lockLogger, markAsImmediate, mergeAttrs, mergeServiceResource, normalizeAttributeRedactorConfig, otelTrace, parseError, propagation, recordLLMCost, recordPromptSent, recordResponseReceived, recordRetry, recordStreamFirstToken, recordStructuredError, recordToolCall, request, resetEvents, resetMetrics, resolveSamplingPreset, resolveTraceUrl, runInOperationContext, runWithCorrelationId, runWithRequestContext, runWithSpan, safeSetAttributes, samplingPresets, setAutotelTracerProvider, setCorrelationId, setCorrelationIdInBaggage, setDevice, setError, setException, setSession, setUser, shutdown, span, structuredErrorToJSON, toAttributeValue, trace, traceConsumer, traceDB, traceHTTP, traceLLM, traceMessaging, traceProducer, traceStep, traceWorkflow, track, validateAttribute, withBaggage, withNewContext, withTracing };
645
+ export { AUTOTEL_SAMPLING_TAIL_EVALUATED, AUTOTEL_SAMPLING_TAIL_KEEP, AdaptiveSampler, AlwaysSampler, AttributeRedactingProcessor, BaggageSpanProcessor, BusinessBaggage, CORRELATION_ID_BAGGAGE_KEY, Event, FilteringSpanProcessor, HTTPAttributes, Metric, NORMALIZER_PATTERNS, NORMALIZER_PRESETS, NeverSampler, REDACTOR_PATTERNS, REDACTOR_PRESETS, ROOT_CONTEXT, RandomSampler, ServiceAttributes, SpanKind, SpanNameNormalizingProcessor, SpanStatusCode, URLAttributes, UserIdSampler, attrs, autoRedactPII, builtinPatterns, context, createAttributeRedactor, createCounter, createDeterministicTraceId, createDrainPipeline, createHistogram, createLinkFromHeaders, createNoopRequestLogger, createObservableGauge, createRedactedSpan, createSafeBaggageSchema, createStringRedactor, createStructuredError, createUpDownCounter, ctx, dbClient, defineAuditCatalog, defineBaggageSchema, defineDrain, defineEnricher, defineErrorCatalog, defineEvent, defineHttpDrain, enrichWithTraceContext, extractLinksFromBatch, finalizeSpan, flattenMetadata, flattenToAttributes, flush, formatDuration, generateCorrelationId, getActiveContext, getActiveSpan, getAutotelTracer, getAutotelTracerProvider, getCatalogCode, getCorrelationId, getCurrentWorkflowContext, getEventQueue, getEvents, getMeter, getMetrics, getOperationContext, getOrCreateCorrelationId, getRequestLogger, getRequestLoggerSafe, getStructuredErrorAttributes, getTraceContext, getTracer, hasRequestContext, httpClient, httpRequestHeaderAttribute, httpResponseHeaderAttribute, httpServer, identify, init, instrument, isCatalogError, isInWorkflow, isInitialized, isLoggerLocked, isTracing, lockLogger, markAsImmediate, mergeAttrs, mergeServiceResource, normalizeAttributeRedactorConfig, otelTrace, parseError, propagation, recordStructuredError, request, resetEvents, resetMetrics, resolveSamplingPreset, resolveTraceUrl, runInOperationContext, runWithCorrelationId, runWithRequestContext, runWithSpan, safeSetAttributes, samplingPresets, setAutotelTracerProvider, setCorrelationId, setCorrelationIdInBaggage, setDevice, setError, setException, setSession, setUser, shutdown, span, structuredErrorToJSON, toAttributeValue, trace, traceConsumer, traceDB, traceHTTP, traceMessaging, traceProducer, traceStep, traceWorkflow, track, validateAttribute, withBaggage, withNewContext, withTracing };
975
646
  //# sourceMappingURL=index.js.map