diff --git a/.changeset/otel-semconv-exports.md b/.changeset/otel-semconv-exports.md new file mode 100644 index 000000000..96a293a1a --- /dev/null +++ b/.changeset/otel-semconv-exports.md @@ -0,0 +1,6 @@ +--- +"github.com/livekit/protocol": minor +"@livekit/protocol": minor +--- + +Export the Weaver-generated OTEL telemetry semantic conventions. `@livekit/protocol/semconv` now exposes the TypeScript constants as a dependency-free subpath, and a new Go package `github.com/livekit/protocol/otel/gen/go` exposes the Go constants (attribute keys, enum values, events, spans, checkpoints, metrics) plus `RenamedKeys` and `RenamedValues`, the legacy-key and legacy-value alias maps derived from the registry's `renamed_from` annotations for normalizing older captures. diff --git a/.github/workflows/buildtest.yaml b/.github/workflows/buildtest.yaml index 82b589ad6..53a630254 100644 --- a/.github/workflows/buildtest.yaml +++ b/.github/workflows/buildtest.yaml @@ -116,3 +116,5 @@ jobs: run: | node --input-type=module -e "await import('./dist/index.mjs')" node -e "require('./dist/index.cjs')" + node --input-type=module -e "await import('./dist/semconv.mjs')" + node -e "require('./dist/semconv.cjs')" diff --git a/.github/workflows/otel.yaml b/.github/workflows/otel.yaml index d10a1bc8b..dd3c8fa86 100644 --- a/.github/workflows/otel.yaml +++ b/.github/workflows/otel.yaml @@ -37,6 +37,12 @@ jobs: with: version: "0.28.0" + # The Go codegen target is generated, gofmt'd and verified (go build/test) in this workflow. + - name: Set up Go + uses: actions/setup-go@b7ad1dad31e06c5925ef5d2fc7ad053ef454303e # v7.0.0 + with: + go-version-file: "go.mod" + - name: Check the registry run: otel/check.sh @@ -62,6 +68,14 @@ jobs: npx --yes -p typescript@5.9.3 tsc --strict --noEmit --target es2020 otel/gen/ts/semconv.ts python3 -I -W error otel/gen/python/semconv.py + # The Go package is part of the protocol module, so downstream Go services import it from + # github.com/livekit/protocol/otel/gen/go. gotest encodes the alias-map invariants. + - name: Generated Go compiles and passes its tests + run: | + go build ./otel/gen/go/... + go vet ./otel/gen/go/... ./otel/gotest/... + go test ./otel/gotest/... + - name: Codegen escapes literals (round-trip through rustc, tsc and python3) run: otel/tests/codegen.sh diff --git a/magefile.go b/magefile.go index 3e6fd7c72..cfcdc3103 100644 --- a/magefile.go +++ b/magefile.go @@ -263,7 +263,23 @@ func Proto() error { func Otel() error { cmd := exec.Command("otel/generate.sh") connectStd(cmd) - return cmd.Run() + if err := cmd.Run(); err != nil { + return err + } + + // Verify the generated Go package compiles and its alias invariants hold, so a model or + // template change that breaks the Go binding fails here next to generation, not downstream. + for _, args := range [][]string{ + {"build", "./otel/gen/go/..."}, + {"test", "./otel/gotest/..."}, + } { + cmd := exec.Command("go", args...) + connectStd(cmd) + if err := cmd.Run(); err != nil { + return err + } + } + return nil } // run tests diff --git a/otel/README.md b/otel/README.md index a886f11ea..2c949012c 100644 --- a/otel/README.md +++ b/otel/README.md @@ -30,8 +30,9 @@ policy, storage and the app API are not conventions and live with each SDK. | `model/agents/groups.yaml` | GenAI metrics imported from the GenAI registry, and the values Agents sends for upstream keys that the upstream definitions do not list | | `policies/` | LiveKit rules (`lib.rego`), applied per file (`livekit.rego`, default mode) and to the resolved registry (`resolved.rego`, default and `--v2`); any finding fails `check.sh` and `generate.sh` | | `advice/` | Non-failing advice, printed by `check.sh` | -| `templates/registry/{rust,typescript,python,markdown}/` | Codegen templates | -| `gen/` | Generated outputs, committed: `rust/semconv.rs`, `ts/semconv.ts`, `python/semconv.py`, `docs/semconv.md` | +| `templates/registry/{go,rust,typescript,python,markdown}/` | Codegen templates | +| `gen/` | Generated outputs, committed: `go/semconv.go`, `rust/semconv.rs`, `ts/semconv.ts`, `python/semconv.py`, `docs/semconv.md` | +| `gotest/` | A Go test of the generated Go package's alias-map invariants; outside `gen/`, so regeneration never deletes it | | `live-check/` | Live-check config, advice rules and the OTLP/JSON converter | | `tests/` | Policy negatives, live-check samples, codegen escaping | @@ -39,6 +40,19 @@ The generated docs, [`gen/docs/semconv.md`](gen/docs/semconv.md), are the human- naming rules, the Resource, the attributes on every record, each event and span with its requirement table, enum values and bindings. +The Go output, [`gen/go/semconv.go`](gen/go/semconv.go), is part of the protocol Go module, so Go +services import it directly: `semconv "github.com/livekit/protocol/otel/gen/go"`. It gives one +constant per attribute key (`AttrLkRoomId`), enum value (`LkTrackSourceSourceCamera`), event +(`EventLkRoomDisconnected`), span (`SpanLkConnect`), checkpoint and metric +(`MetricLkAgentsConnectionAcquireTime` and its `…Unit`), plus two alias maps built from the shared +keys' `renamed_from` annotations: +`RenamedKeys` (legacy key → canonical key) and `RenamedValues` (legacy key → legacy value → +canonical value, for the two enums whose values also changed). A consumer such as the collector +uses them to normalize an older capture to the canonical names. The legacy spellings are never +registered, so they appear only in these maps. `generate.sh` gofmts the file; `go tool mage otel`, +`.github/workflows/otel.yaml` and the Test workflow (`go test ./...`) build the package and run +`otel/gotest` to check the alias-map invariants. + ## Ownership Every LiveKit key carries `annotations.livekit.owner`: @@ -169,7 +183,7 @@ for each LiveKit file in the not-yet-stable `definition/2` format (`client/group ```sh otel/check.sh # registry + LiveKit policies, default and --v2, then advice otel/tests/negatives.sh # each negative fixture fails with its named finding, both modes -go tool mage otel && git status otel/gen # regenerate (runs otel/generate.sh); no diff expected +go tool mage otel && git status otel/gen # regenerate (runs generate.sh, then go build + test); no diff expected otel/tests/live-check.sh # smoke and sparse samples clean, legacy keys flagged, wrapper exit status otel/tests/generate.sh # generate.sh replaces gen/ whole, and keeps it when a target fails otel/tests/codegen.sh # a value with quotes, backslashes, newlines round-trips through rustc, tsc and python3 @@ -177,9 +191,10 @@ otel/tests/codegen.sh # a value with quotes, backslashes, newli rustc --edition 2021 --crate-type lib -D warnings -D missing_docs otel/gen/rust/semconv.rs --out-dir /tmp npx -p typescript@5.9.3 tsc --strict --noEmit --target es2020 otel/gen/ts/semconv.ts python3 -I -W error otel/gen/python/semconv.py +go build ./otel/gen/go/... && go test ./otel/gotest/... # the generated Go package and its alias-map invariants ``` -The generated Rust and Python also carry an `upstream` section: every OTel key a LiveKit signal +The generated Rust, Python and Go also carry an `upstream` section: every OTel key a LiveKit signal references (`error.type`, `gen_ai.request.model`, `rpc.method`, …), defined by a dependency and never here, so a producer names them from one place. TypeScript does not yet. Three mechanisms add to it: diff --git a/otel/gen/go/semconv.go b/otel/gen/go/semconv.go new file mode 100644 index 000000000..f86e5161d --- /dev/null +++ b/otel/gen/go/semconv.go @@ -0,0 +1,1920 @@ +// Code generated by weaver from livekit/protocol otel/model. DO NOT EDIT. + +// Package semconv is the LiveKit telemetry semantic conventions as Go constants: the attribute +// keys, enum values, event names, span names, checkpoints and metric names LiveKit producers send +// over OTLP, and the legacy-key and legacy-value aliases a consumer uses to normalize an older +// capture to the canonical names (see RenamedKeys and RenamedValues). +package semconv + +// AttrAgentName is the "agent_name" attribute: The agent's name. +const AttrAgentName = "agent_name" + +// AttrBrowserName is the "browser.name" attribute: Browser name. +const AttrBrowserName = "browser.name" + +// AttrBrowserVersion is the "browser.version" attribute: Browser version. +const AttrBrowserVersion = "browser.version" + +// AttrChatItem is the "chat.item" attribute: One chat history item, as a map. Carries conversation content. PII: redacted by the collector. +const AttrChatItem = "chat.item" + +// AttrConnectionReused is the "connection_reused" attribute: Whether a pooled connection was reused, as the string `true`/`false`. +const AttrConnectionReused = "connection_reused" + +// AttrEvaluation is the "evaluation" attribute: One evaluation result, as a map of string fields. +const AttrEvaluation = "evaluation" + +// AttrGenAiTokenType is the "gen_ai.token.type" attribute: Token type (`input` or `output`); deprecated upstream, a dimension of `gen_ai.client.token.usage`. +const AttrGenAiTokenType = "gen_ai.token.type" + +// AttrGenAiUsageInputAudioTokens is the "gen_ai.usage.input_audio_tokens" attribute: LangFuse spelling of audio input tokens. +const AttrGenAiUsageInputAudioTokens = "gen_ai.usage.input_audio_tokens" + +// AttrGenAiUsageInputCachedTokens is the "gen_ai.usage.input_cached_tokens" attribute: LangFuse spelling of cached input tokens. +const AttrGenAiUsageInputCachedTokens = "gen_ai.usage.input_cached_tokens" + +// AttrGenAiUsageInputTextTokens is the "gen_ai.usage.input_text_tokens" attribute: LangFuse spelling of text input tokens. +const AttrGenAiUsageInputTextTokens = "gen_ai.usage.input_text_tokens" + +// AttrGenAiUsageOutputAudioTokens is the "gen_ai.usage.output_audio_tokens" attribute: LangFuse spelling of audio output tokens. +const AttrGenAiUsageOutputAudioTokens = "gen_ai.usage.output_audio_tokens" + +// AttrGenAiUsageOutputTextTokens is the "gen_ai.usage.output_text_tokens" attribute: LangFuse spelling of text output tokens. +const AttrGenAiUsageOutputTextTokens = "gen_ai.usage.output_text_tokens" + +// AttrGenAiUsageReasoningTokens is the "gen_ai.usage.reasoning_tokens" attribute: LangFuse spelling of reasoning tokens. +const AttrGenAiUsageReasoningTokens = "gen_ai.usage.reasoning_tokens" + +// AttrLangfuseObservationCompletionStartTime is the "langfuse.observation.completion_start_time" attribute: LangFuse's completion start time (ISO 8601), set next to `gen_ai.response.time_to_first_chunk`. +const AttrLangfuseObservationCompletionStartTime = "langfuse.observation.completion_start_time" + +// AttrLkAgentLabel is the "lk.agent_label" attribute: Label of the agent running the activity. +const AttrLkAgentLabel = "lk.agent_label" + +// AttrLkAgentName is the "lk.agent_name" attribute: Name of the agent a job was dispatched to. +const AttrLkAgentName = "lk.agent_name" + +// AttrLkAmdCategory is the "lk.amd.category" attribute: AMD classification. +const AttrLkAmdCategory = "lk.amd.category" + +// AttrLkAmdDelay is the "lk.amd.delay" attribute: Seconds from the call start to the AMD decision. Unit: `s`. +const AttrLkAmdDelay = "lk.amd.delay" + +// AttrLkAmdReason is the "lk.amd.reason" attribute: Why the AMD classifier decided. +const AttrLkAmdReason = "lk.amd.reason" + +// AttrLkAmdSpeechDuration is the "lk.amd.speech_duration" attribute: Seconds of speech the AMD classifier heard. Unit: `s`. +const AttrLkAmdSpeechDuration = "lk.amd.speech_duration" + +// AttrLkBlockingCount is the "lk.blocking.count" attribute: Blocks in the session. +const AttrLkBlockingCount = "lk.blocking.count" + +// AttrLkBlockingCpuTime is the "lk.blocking.cpu_time" attribute: CPU seconds the loop thread consumed during the block. Unit: `s`. +const AttrLkBlockingCpuTime = "lk.blocking.cpu_time" + +// AttrLkBlockingDuration is the "lk.blocking.duration" attribute: Seconds the loop was blocked. Unit: `s`. +const AttrLkBlockingDuration = "lk.blocking.duration" + +// AttrLkBlockingGcTime is the "lk.blocking.gc_time" attribute: Seconds of garbage collection on the loop thread during the block. Unit: `s`. +const AttrLkBlockingGcTime = "lk.blocking.gc_time" + +// AttrLkBlockingImport is the "lk.blocking.import" attribute: Module a lazy import was loading when sampled. +const AttrLkBlockingImport = "lk.blocking.import" + +// AttrLkBlockingMaxDuration is the "lk.blocking.max_duration" attribute: Seconds of the longest block in the session. Unit: `s`. +const AttrLkBlockingMaxDuration = "lk.blocking.max_duration" + +// AttrLkBlockingSeverity is the "lk.blocking.severity" attribute: Severity bucket of the block. +const AttrLkBlockingSeverity = "lk.blocking.severity" + +// AttrLkBlockingStack is the "lk.blocking.stack" attribute: Loop-thread stack sampled while blocked (source locations only). +const AttrLkBlockingStack = "lk.blocking.stack" + +// AttrLkBlockingSuppressed is the "lk.blocking.suppressed" attribute: Reports dropped by rate limiting since the previous emitted span. +const AttrLkBlockingSuppressed = "lk.blocking.suppressed" + +// AttrLkBlockingTask is the "lk.blocking.task" attribute: Name of the task that was running. +const AttrLkBlockingTask = "lk.blocking.task" + +// AttrLkBlockingThreshold is the "lk.blocking.threshold" attribute: Seconds above which a block is reported. Unit: `s`. +const AttrLkBlockingThreshold = "lk.blocking.threshold" + +// AttrLkBlockingTotalDuration is the "lk.blocking.total_duration" attribute: Seconds blocked in total over the session. Unit: `s`. +const AttrLkBlockingTotalDuration = "lk.blocking.total_duration" + +// AttrLkCallbackName is the "lk.callback.name" attribute: Name of the shutdown callback. +const AttrLkCallbackName = "lk.callback.name" + +// AttrLkCloseDrain is the "lk.close.drain" attribute: The close drained pending speech first. +const AttrLkCloseDrain = "lk.close.drain" + +// AttrLkCloseReason is the "lk.close_reason" attribute: Why the session closed. +const AttrLkCloseReason = "lk.close_reason" + +// AttrLkCloudAgentId is the "lk.cloud_agent_id" attribute: LiveKit Cloud agent id. +const AttrLkCloudAgentId = "lk.cloud_agent_id" + +// AttrLkConnectAttempt is the "lk.connect.attempt" attribute: 1-based connect attempt. +const AttrLkConnectAttempt = "lk.connect.attempt" + +// AttrLkConnectionState is the "lk.connection_state" attribute: Room connection state. +const AttrLkConnectionState = "lk.connection_state" + +// AttrLkDeploymentId is the "lk.deployment_id" attribute: LiveKit Cloud deployment id. +const AttrLkDeploymentId = "lk.deployment_id" + +// AttrLkDeviceAppState is the "lk.device.app_state" attribute: Whether the app is in front of the user. +const AttrLkDeviceAppState = "lk.device.app_state" + +// LkDeviceAppStateForeground is a value of AttrLkDeviceAppState: In front of the user. +const LkDeviceAppStateForeground = "foreground" + +// LkDeviceAppStateBackground is a value of AttrLkDeviceAppState: In the background. +const LkDeviceAppStateBackground = "background" + +// AttrLkDeviceAudioInterruption is the "lk.device.audio.interruption" attribute: Phase of an audio session interruption. +const AttrLkDeviceAudioInterruption = "lk.device.audio.interruption" + +// LkDeviceAudioInterruptionBegan is a value of AttrLkDeviceAudioInterruption: Interruption began (another app or a call took the audio session). +const LkDeviceAudioInterruptionBegan = "began" + +// LkDeviceAudioInterruptionEnded is a value of AttrLkDeviceAudioInterruption: Interruption ended. +const LkDeviceAudioInterruptionEnded = "ended" + +// AttrLkDeviceAudioRouteOutputs is the "lk.device.audio_route.outputs" attribute: The active outputs, comma-separated. +const AttrLkDeviceAudioRouteOutputs = "lk.device.audio_route.outputs" + +// AttrLkDeviceAudioRouteReason is the "lk.device.audio_route.reason" attribute: Why the audio route changed. +const AttrLkDeviceAudioRouteReason = "lk.device.audio_route.reason" + +// LkDeviceAudioRouteReasonNewDevice is a value of AttrLkDeviceAudioRouteReason: A new output became available. +const LkDeviceAudioRouteReasonNewDevice = "new_device" + +// LkDeviceAudioRouteReasonOldDeviceUnavailable is a value of AttrLkDeviceAudioRouteReason: The previous output went away. +const LkDeviceAudioRouteReasonOldDeviceUnavailable = "old_device_unavailable" + +// LkDeviceAudioRouteReasonCategoryChange is a value of AttrLkDeviceAudioRouteReason: The audio session category changed. +const LkDeviceAudioRouteReasonCategoryChange = "category_change" + +// LkDeviceAudioRouteReasonOverride is a value of AttrLkDeviceAudioRouteReason: The route was overridden. +const LkDeviceAudioRouteReasonOverride = "override" + +// LkDeviceAudioRouteReasonWakeFromSleep is a value of AttrLkDeviceAudioRouteReason: The device woke from sleep. +const LkDeviceAudioRouteReasonWakeFromSleep = "wake_from_sleep" + +// LkDeviceAudioRouteReasonNoSuitableRoute is a value of AttrLkDeviceAudioRouteReason: No route fits the category. +const LkDeviceAudioRouteReasonNoSuitableRoute = "no_suitable_route" + +// LkDeviceAudioRouteReasonRouteConfigurationChange is a value of AttrLkDeviceAudioRouteReason: The route's configuration changed. +const LkDeviceAudioRouteReasonRouteConfigurationChange = "route_configuration_change" + +// LkDeviceAudioRouteReasonUnknown is a value of AttrLkDeviceAudioRouteReason: The platform gave no reason. +const LkDeviceAudioRouteReasonUnknown = "unknown" + +// AttrLkDeviceBatteryCharging is the "lk.device.battery.charging" attribute: The device is charging. +const AttrLkDeviceBatteryCharging = "lk.device.battery.charging" + +// AttrLkDeviceBatteryLevel is the "lk.device.battery.level" attribute: Battery charge in percent, 0-100. Unit: `%`. +const AttrLkDeviceBatteryLevel = "lk.device.battery.level" + +// AttrLkDeviceCaptureDevice is the "lk.device.capture.device" attribute: Capture device that failed. +const AttrLkDeviceCaptureDevice = "lk.device.capture.device" + +// LkDeviceCaptureDeviceCamera is a value of AttrLkDeviceCaptureDevice: Camera. +const LkDeviceCaptureDeviceCamera = "camera" + +// LkDeviceCaptureDeviceMicrophone is a value of AttrLkDeviceCaptureDevice: Microphone. +const LkDeviceCaptureDeviceMicrophone = "microphone" + +// LkDeviceCaptureDeviceScreenShare is a value of AttrLkDeviceCaptureDevice: Screen capture. +const LkDeviceCaptureDeviceScreenShare = "screen_share" + +// AttrLkDeviceCaptureReason is the "lk.device.capture.reason" attribute: Why capture failed, in the getUserMedia failure taxonomy. +const AttrLkDeviceCaptureReason = "lk.device.capture.reason" + +// LkDeviceCaptureReasonPermissionDenied is a value of AttrLkDeviceCaptureReason: The user or OS denied access. +const LkDeviceCaptureReasonPermissionDenied = "permission_denied" + +// LkDeviceCaptureReasonNotFound is a value of AttrLkDeviceCaptureReason: No such device. +const LkDeviceCaptureReasonNotFound = "not_found" + +// LkDeviceCaptureReasonInUse is a value of AttrLkDeviceCaptureReason: Another app holds the device. +const LkDeviceCaptureReasonInUse = "in_use" + +// LkDeviceCaptureReasonDisconnected is a value of AttrLkDeviceCaptureReason: The device went away. +const LkDeviceCaptureReasonDisconnected = "disconnected" + +// LkDeviceCaptureReasonOther is a value of AttrLkDeviceCaptureReason: Anything else. +const LkDeviceCaptureReasonOther = "other" + +// AttrLkDeviceLowPowerEnabled is the "lk.device.low_power.enabled" attribute: Low Power Mode / Battery Saver is on. +const AttrLkDeviceLowPowerEnabled = "lk.device.low_power.enabled" + +// AttrLkDeviceMemoryPressure is the "lk.device.memory.pressure" attribute: Memory pressure as the OS reports it. +const AttrLkDeviceMemoryPressure = "lk.device.memory.pressure" + +// LkDeviceMemoryPressureNormal is a value of AttrLkDeviceMemoryPressure: No pressure. +const LkDeviceMemoryPressureNormal = "normal" + +// LkDeviceMemoryPressureWarning is a value of AttrLkDeviceMemoryPressure: Low memory. +const LkDeviceMemoryPressureWarning = "warning" + +// LkDeviceMemoryPressureCritical is a value of AttrLkDeviceMemoryPressure: Critically low memory. +const LkDeviceMemoryPressureCritical = "critical" + +// AttrLkDeviceNetworkConstrained is the "lk.device.network.constrained" attribute: The user asked for less traffic (Low Data Mode, Data Saver). +const AttrLkDeviceNetworkConstrained = "lk.device.network.constrained" + +// AttrLkDeviceNetworkExpensive is the "lk.device.network.expensive" attribute: The network is metered (cellular, personal hotspot). +const AttrLkDeviceNetworkExpensive = "lk.device.network.expensive" + +// AttrLkDeviceThermalState is the "lk.device.thermal.state" attribute: Thermal pressure as the OS reports it. +const AttrLkDeviceThermalState = "lk.device.thermal.state" + +// LkDeviceThermalStateNominal is a value of AttrLkDeviceThermalState: Within normal limits. +const LkDeviceThermalStateNominal = "nominal" + +// LkDeviceThermalStateFair is a value of AttrLkDeviceThermalState: Slightly elevated. +const LkDeviceThermalStateFair = "fair" + +// LkDeviceThermalStateSerious is a value of AttrLkDeviceThermalState: High; the system reduces performance. +const LkDeviceThermalStateSerious = "serious" + +// LkDeviceThermalStateCritical is a value of AttrLkDeviceThermalState: Critical; the device needs to cool down. +const LkDeviceThermalStateCritical = "critical" + +// AttrLkDisconnectReason is the "lk.disconnect_reason" attribute: Why a participant left the room, as the protobuf `DisconnectReason` enum name. +const AttrLkDisconnectReason = "lk.disconnect_reason" + +// LkDisconnectReasonUnknownReason is a value of AttrLkDisconnectReason: No reason given, or a number the producer does not know. +const LkDisconnectReasonUnknownReason = "UNKNOWN_REASON" + +// LkDisconnectReasonClientInitiated is a value of AttrLkDisconnectReason: The participant hung up. +const LkDisconnectReasonClientInitiated = "CLIENT_INITIATED" + +// LkDisconnectReasonDuplicateIdentity is a value of AttrLkDisconnectReason: Another participant joined with the same identity. +const LkDisconnectReasonDuplicateIdentity = "DUPLICATE_IDENTITY" + +// LkDisconnectReasonServerShutdown is a value of AttrLkDisconnectReason: The server instance shut down. +const LkDisconnectReasonServerShutdown = "SERVER_SHUTDOWN" + +// LkDisconnectReasonParticipantRemoved is a value of AttrLkDisconnectReason: RoomService.RemoveParticipant was called. +const LkDisconnectReasonParticipantRemoved = "PARTICIPANT_REMOVED" + +// LkDisconnectReasonRoomDeleted is a value of AttrLkDisconnectReason: RoomService.DeleteRoom was called. +const LkDisconnectReasonRoomDeleted = "ROOM_DELETED" + +// LkDisconnectReasonStateMismatch is a value of AttrLkDisconnectReason: The server did not know the session the client tried to resume. +const LkDisconnectReasonStateMismatch = "STATE_MISMATCH" + +// LkDisconnectReasonJoinFailure is a value of AttrLkDisconnectReason: The client could not connect fully. +const LkDisconnectReasonJoinFailure = "JOIN_FAILURE" + +// LkDisconnectReasonMigration is a value of AttrLkDisconnectReason: The server asked the participant to migrate (Cloud only). +const LkDisconnectReasonMigration = "MIGRATION" + +// LkDisconnectReasonSignalClose is a value of AttrLkDisconnectReason: The signal WebSocket closed unexpectedly. +const LkDisconnectReasonSignalClose = "SIGNAL_CLOSE" + +// LkDisconnectReasonRoomClosed is a value of AttrLkDisconnectReason: The room closed after its participants left. +const LkDisconnectReasonRoomClosed = "ROOM_CLOSED" + +// LkDisconnectReasonUserUnavailable is a value of AttrLkDisconnectReason: The SIP callee did not answer in time. +const LkDisconnectReasonUserUnavailable = "USER_UNAVAILABLE" + +// LkDisconnectReasonUserRejected is a value of AttrLkDisconnectReason: The SIP callee rejected the call. +const LkDisconnectReasonUserRejected = "USER_REJECTED" + +// LkDisconnectReasonSipTrunkFailure is a value of AttrLkDisconnectReason: SIP protocol failure. +const LkDisconnectReasonSipTrunkFailure = "SIP_TRUNK_FAILURE" + +// LkDisconnectReasonConnectionTimeout is a value of AttrLkDisconnectReason: The server timed out the session. +const LkDisconnectReasonConnectionTimeout = "CONNECTION_TIMEOUT" + +// LkDisconnectReasonMediaFailure is a value of AttrLkDisconnectReason: Media failed or timed out. +const LkDisconnectReasonMediaFailure = "MEDIA_FAILURE" + +// LkDisconnectReasonAgentError is a value of AttrLkDisconnectReason: The agent failed. +const LkDisconnectReasonAgentError = "AGENT_ERROR" + +// LkDisconnectReasonReconnectFailed is a value of AttrLkDisconnectReason: The client ran out of reconnect attempts (client only, not a protobuf value). +const LkDisconnectReasonReconnectFailed = "RECONNECT_FAILED" + +// AttrLkDispatchId is the "lk.dispatch_id" attribute: Agent dispatch id. +const AttrLkDispatchId = "lk.dispatch_id" + +// AttrLkE2eLatency is the "lk.e2e_latency" attribute: Seconds from the end of the user's speech to the agent's first audio. Unit: `s`. +const AttrLkE2eLatency = "lk.e2e_latency" + +// AttrLkEndOfTurnDelay is the "lk.end_of_turn_delay" attribute: Seconds from the end of speech to the turn decision. Unit: `s`. +const AttrLkEndOfTurnDelay = "lk.end_of_turn_delay" + +// AttrLkEouDetectionDelay is the "lk.eou.detection_delay" attribute: Seconds the detector inference took. Unit: `s`. +const AttrLkEouDetectionDelay = "lk.eou.detection_delay" + +// AttrLkEouEndpointingDelay is the "lk.eou.endpointing_delay" attribute: Seconds of endpointing delay applied. Unit: `s`. +const AttrLkEouEndpointingDelay = "lk.eou.endpointing_delay" + +// AttrLkEouFromCache is the "lk.eou.from_cache" attribute: The detector answer came from the cache. +const AttrLkEouFromCache = "lk.eou.from_cache" + +// AttrLkEouLanguage is the "lk.eou.language" attribute: Language the detector ran for. +const AttrLkEouLanguage = "lk.eou.language" + +// AttrLkEouNotCommittedCount is the "lk.eou.not_committed_count" attribute: Turn decisions the wait rejected before it ended. +const AttrLkEouNotCommittedCount = "lk.eou.not_committed_count" + +// AttrLkEouOutcome is the "lk.eou.outcome" attribute: How the endpointing wait ended. +const AttrLkEouOutcome = "lk.eou.outcome" + +// LkEouOutcomeCommitted is a value of AttrLkEouOutcome: The turn was committed. +const LkEouOutcomeCommitted = "committed" + +// LkEouOutcomeUserResumed is a value of AttrLkEouOutcome: The user spoke again. +const LkEouOutcomeUserResumed = "user_resumed" + +// LkEouOutcomeDropped is a value of AttrLkEouOutcome: The turn was dropped. +const LkEouOutcomeDropped = "dropped" + +// AttrLkEouProbability is the "lk.eou.probability" attribute: End-of-utterance probability. +const AttrLkEouProbability = "lk.eou.probability" + +// AttrLkEouRearmCount is the "lk.eou.rearm_count" attribute: Times the endpointing wait restarted on a later trigger. +const AttrLkEouRearmCount = "lk.eou.rearm_count" + +// AttrLkEouResumeCount is the "lk.eou.resume_count" attribute: Endpointing waits the user cut short by speaking again. +const AttrLkEouResumeCount = "lk.eou.resume_count" + +// AttrLkEouSource is the "lk.eou.source" attribute: What decided the end of the turn. +const AttrLkEouSource = "lk.eou.source" + +// AttrLkEouUnlikelyThreshold is the "lk.eou.unlikely_threshold" attribute: Threshold under which the turn is unlikely to be over. +const AttrLkEouUnlikelyThreshold = "lk.eou.unlikely_threshold" + +// AttrLkEouWaitDuration is the "lk.eou.wait_duration" attribute: Seconds from the end of the user's speech to the turn decision. Unit: `s`. +const AttrLkEouWaitDuration = "lk.eou.wait_duration" + +// AttrLkErrorRetryable is the "lk.error.retryable" attribute: The provider error is retryable (Node binding). +const AttrLkErrorRetryable = "lk.error.retryable" + +// AttrLkFail is the "lk.fail" attribute: The session report is tagged failed. +const AttrLkFail = "lk.fail" + +// AttrLkFallbackIndex is the "lk.fallback.index" attribute: Index of the fallback instance that served the request. +const AttrLkFallbackIndex = "lk.fallback.index" + +// AttrLkFallbackLabel is the "lk.fallback.label" attribute: Label of the fallback instance that served the request. +const AttrLkFallbackLabel = "lk.fallback.label" + +// AttrLkFallbackRecovery is the "lk.fallback.recovery" attribute: The request was a recovery probe of a failed instance. +const AttrLkFallbackRecovery = "lk.fallback.recovery" + +// AttrLkFirstFrameDelay is the "lk.first_frame_delay" attribute: Seconds from waiting for a track to its first frame. Unit: `s`. +const AttrLkFirstFrameDelay = "lk.first_frame_delay" + +// AttrLkFrameResolution is the "lk.frame.resolution" attribute: How the inbound frame of a plugin-task metric was resolved (Node binding). +const AttrLkFrameResolution = "lk.frame.resolution" + +// LkFrameResolutionRoot is a value of AttrLkFrameResolution: The root frame. +const LkFrameResolutionRoot = "root" + +// LkFrameResolutionLive is a value of AttrLkFrameResolution: A live speech frame. +const LkFrameResolutionLive = "live" + +// LkFrameResolutionStale is a value of AttrLkFrameResolution: A frame whose speech already ended. +const LkFrameResolutionStale = "stale" + +// LkFrameResolutionUnknown is a value of AttrLkFrameResolution: Not a frame the slab knows. +const LkFrameResolutionUnknown = "unknown" + +// AttrLkFunctionToolId is the "lk.function_tool.id" attribute: Tool call id. +const AttrLkFunctionToolId = "lk.function_tool.id" + +// AttrLkFunctionToolIsError is the "lk.function_tool.is_error" attribute: The tool returned an error. +const AttrLkFunctionToolIsError = "lk.function_tool.is_error" + +// AttrLkFunctionToolName is the "lk.function_tool.name" attribute: Tool name. +const AttrLkFunctionToolName = "lk.function_tool.name" + +// AttrLkFunctionTools is the "lk.function_tools" attribute: Function tool names offered. +const AttrLkFunctionTools = "lk.function_tools" + +// AttrLkGenerationCount is the "lk.generation_count" attribute: Generations in the turn. +const AttrLkGenerationCount = "lk.generation_count" + +// AttrLkGenerationId is the "lk.generation_id" attribute: Id of the agent turn (generation). +const AttrLkGenerationId = "lk.generation_id" + +// AttrLkInputBaseSpanId is the "lk.input.base_span_id" attribute: Span whose input record this one continues. +const AttrLkInputBaseSpanId = "lk.input.base_span_id" + +// AttrLkInputDelta is the "lk.input.delta" attribute: The span's input record is a delta over its base span. +const AttrLkInputDelta = "lk.input.delta" + +// AttrLkInputDroppedFromBase is the "lk.input.dropped_from_base" attribute: Items of the base record not carried into this one. +const AttrLkInputDroppedFromBase = "lk.input.dropped_from_base" + +// AttrLkInterrupted is the "lk.interrupted" attribute: The speech was interrupted. +const AttrLkInterrupted = "lk.interrupted" + +// AttrLkInterruptionDetectionDelay is the "lk.interruption.detection_delay" attribute: Seconds from the user's speech to the interruption decision. Unit: `s`. +const AttrLkInterruptionDetectionDelay = "lk.interruption.detection_delay" + +// AttrLkInterruptionPredictionDuration is the "lk.interruption.prediction_duration" attribute: Seconds the interruption prediction took. Unit: `s`. +const AttrLkInterruptionPredictionDuration = "lk.interruption.prediction_duration" + +// AttrLkInterruptionProbability is the "lk.interruption.probability" attribute: Interruption probability. +const AttrLkInterruptionProbability = "lk.interruption.probability" + +// AttrLkInterruptionSource is the "lk.interruption.source" attribute: What triggered the interruption. +const AttrLkInterruptionSource = "lk.interruption.source" + +// AttrLkInterruptionTotalDuration is the "lk.interruption.total_duration" attribute: Seconds of the interruption from detection to resolution. Unit: `s`. +const AttrLkInterruptionTotalDuration = "lk.interruption.total_duration" + +// AttrLkIsInterruption is the "lk.is_interruption" attribute: The user turn was classified as an interruption. +const AttrLkIsInterruption = "lk.is_interruption" + +// AttrLkJobAcceptLatency is the "lk.job.accept_latency" attribute: Seconds from the job request to its acceptance. Unit: `s`. +const AttrLkJobAcceptLatency = "lk.job.accept_latency" + +// AttrLkJobAgentId is the "lk.job.agent_id" attribute: Agent id of the job. +const AttrLkJobAgentId = "lk.job.agent_id" + +// AttrLkJobAssignmentLatency is the "lk.job.assignment_latency" attribute: Seconds from acceptance to the job assignment. Unit: `s`. +const AttrLkJobAssignmentLatency = "lk.job.assignment_latency" + +// AttrLkJobDispatchLatency is the "lk.job.dispatch_latency" attribute: Seconds from the dispatch request to the entrypoint running. Unit: `s`. +const AttrLkJobDispatchLatency = "lk.job.dispatch_latency" + +// AttrLkJobEntrypointLatency is the "lk.job.entrypoint_latency" attribute: Seconds from launch to the entrypoint running. Unit: `s`. +const AttrLkJobEntrypointLatency = "lk.job.entrypoint_latency" + +// AttrLkJobLaunchLatency is the "lk.job.launch_latency" attribute: Seconds from assignment to the job process launch. Unit: `s`. +const AttrLkJobLaunchLatency = "lk.job.launch_latency" + +// AttrLkJobWorkerId is the "lk.job.worker_id" attribute: Worker id the job runs on. +const AttrLkJobWorkerId = "lk.job.worker_id" + +// AttrLkJobId is the "lk.job_id" attribute: Agent job ID (`AJ_...`). +const AttrLkJobId = "lk.job_id" + +// AttrLkKeytermsAdded is the "lk.keyterms.added" attribute: Keyterms added by the update. +const AttrLkKeytermsAdded = "lk.keyterms.added" + +// AttrLkKeytermsCount is the "lk.keyterms.count" attribute: Number of keyterms configured. +const AttrLkKeytermsCount = "lk.keyterms.count" + +// AttrLkKeytermsRemoved is the "lk.keyterms.removed" attribute: Keyterms removed by the update. +const AttrLkKeytermsRemoved = "lk.keyterms.removed" + +// AttrLkLlmMetrics is the "lk.llm_metrics" attribute: LLM metrics of the turn, serialized. +const AttrLkLlmMetrics = "lk.llm_metrics" + +// AttrLkLogLogger is the "lk.log.logger" attribute: Logger, type, module or file that wrote the line. +const AttrLkLogLogger = "lk.log.logger" + +// AttrLkLogSource is the "lk.log.source" attribute: Which layer wrote the log line. +const AttrLkLogSource = "lk.log.source" + +// LkLogSourceSdk is a value of AttrLkLogSource: The platform SDK. +const LkLogSourceSdk = "sdk" + +// LkLogSourceFfi is a value of AttrLkLogSource: The Rust core, copied by the log forwarder with JWT-shaped substrings masked as ``. +const LkLogSourceFfi = "ffi" + +// LkLogSourceWebrtc is a value of AttrLkLogSource: WebRTC. +const LkLogSourceWebrtc = "webrtc" + +// AttrLkMetric is the "lk.metric" attribute: Metric type noted from a plugin task (Node binding `metrics` span). +const AttrLkMetric = "lk.metric" + +// AttrLkNewState is the "lk.new_state" attribute: State after a transition. +const AttrLkNewState = "lk.new_state" + +// AttrLkOldState is the "lk.old_state" attribute: State before a transition. +const AttrLkOldState = "lk.old_state" + +// AttrLkOnUserTurnCompletedDelay is the "lk.on_user_turn_completed_delay" attribute: Seconds the `on_user_turn_completed` hook took. Unit: `s`. +const AttrLkOnUserTurnCompletedDelay = "lk.on_user_turn_completed_delay" + +// AttrLkOutcome is the "lk.outcome" attribute: How the attempt ended. Rollups read this, never the span status. +const AttrLkOutcome = "lk.outcome" + +// LkOutcomeOk is a value of AttrLkOutcome: Succeeded; span status Unset. +const LkOutcomeOk = "ok" + +// LkOutcomeError is a value of AttrLkOutcome: Failed; span status Error, with `error.type` when the failure has a type. +const LkOutcomeError = "error" + +// LkOutcomeCancelled is a value of AttrLkOutcome: Cancelled by the caller or superseded; span status Unset. +const LkOutcomeCancelled = "cancelled" + +// AttrLkParentGenerationId is the "lk.parent_generation_id" attribute: Generation this one continues (a tool-call follow-up). +const AttrLkParentGenerationId = "lk.parent_generation_id" + +// AttrLkParticipantId is the "lk.participant_id" attribute: Server-assigned SID of the local participant (`PA_...`). +const AttrLkParticipantId = "lk.participant_id" + +// AttrLkParticipantKind is the "lk.participant_kind" attribute: Kind of the linked participant (protocol `ParticipantInfo.Kind`). +const AttrLkParticipantKind = "lk.participant_kind" + +// AttrLkPiiAmdTranscript is the "lk.pii.amd.transcript" attribute: Transcript the AMD classifier used. PII: redacted by the collector. +const AttrLkPiiAmdTranscript = "lk.pii.amd.transcript" + +// AttrLkPiiArguments is the "lk.pii.arguments" attribute: Tool-call arguments on a log record. PII: redacted by the collector. +const AttrLkPiiArguments = "lk.pii.arguments" + +// AttrLkPiiChatCtx is the "lk.pii.chat_ctx" attribute: Serialized chat context sent to the LLM. PII: redacted by the collector. +const AttrLkPiiChatCtx = "lk.pii.chat_ctx" + +// AttrLkPiiDtmfInputs is the "lk.pii.dtmf_inputs" attribute: DTMF digits received. PII: redacted by the collector. +const AttrLkPiiDtmfInputs = "lk.pii.dtmf_inputs" + +// AttrLkPiiError is the "lk.pii.error" attribute: Error text that may quote user content. PII: redacted by the collector. +const AttrLkPiiError = "lk.pii.error" + +// AttrLkPiiEvent is the "lk.pii.event" attribute: Raw provider event on a debug log record. PII: redacted by the collector. +const AttrLkPiiEvent = "lk.pii.event" + +// AttrLkPiiFunctionToolArguments is the "lk.pii.function_tool.arguments" attribute: Tool call arguments. PII: redacted by the collector. +const AttrLkPiiFunctionToolArguments = "lk.pii.function_tool.arguments" + +// AttrLkPiiFunctionToolOutput is the "lk.pii.function_tool.output" attribute: Tool output. PII: redacted by the collector. +const AttrLkPiiFunctionToolOutput = "lk.pii.function_tool.output" + +// AttrLkPiiInputText is the "lk.pii.input_text" attribute: Text sent to the TTS. PII: redacted by the collector. +const AttrLkPiiInputText = "lk.pii.input_text" + +// AttrLkPiiInstructions is the "lk.pii.instructions" attribute: Agent instructions in force. PII: redacted by the collector. +const AttrLkPiiInstructions = "lk.pii.instructions" + +// AttrLkPiiInterimTranscript is the "lk.pii.interim_transcript" attribute: An interim (non-final) transcript, on a log record. PII: redacted by the collector. +const AttrLkPiiInterimTranscript = "lk.pii.interim_transcript" + +// AttrLkPiiKeyterms is the "lk.pii.keyterms" attribute: The keyterms themselves (customer vocabulary). PII: redacted by the collector. +const AttrLkPiiKeyterms = "lk.pii.keyterms" + +// AttrLkPiiOutput is the "lk.pii.output" attribute: Tool-call output on a log record. PII: redacted by the collector. +const AttrLkPiiOutput = "lk.pii.output" + +// AttrLkPiiParticipantIdentity is the "lk.pii.participant_identity" attribute: Customer-supplied identity of the local participant. PII: redacted by the collector. +const AttrLkPiiParticipantIdentity = "lk.pii.participant_identity" + +// AttrLkPiiProgressMessage is the "lk.pii.progress_message" attribute: MCP tool progress message. PII: redacted by the collector. +const AttrLkPiiProgressMessage = "lk.pii.progress_message" + +// AttrLkPiiRawArguments is the "lk.pii.raw_arguments" attribute: Malformed tool-call arguments as received. PII: redacted by the collector. +const AttrLkPiiRawArguments = "lk.pii.raw_arguments" + +// AttrLkPiiRemoteParticipantIdentity is the "lk.pii.remote_participant_identity" attribute: Customer-supplied identity of the remote participant a record is about (the publisher, on subscribe). PII: redacted by the collector. +const AttrLkPiiRemoteParticipantIdentity = "lk.pii.remote_participant_identity" + +// AttrLkPiiRepaired is the "lk.pii.repaired" attribute: Tool-call arguments after repair. PII: redacted by the collector. +const AttrLkPiiRepaired = "lk.pii.repaired" + +// AttrLkPiiResponseFunctionCalls is the "lk.pii.response.function_calls" attribute: Function calls the LLM produced, serialized. PII: redacted by the collector. +const AttrLkPiiResponseFunctionCalls = "lk.pii.response.function_calls" + +// AttrLkPiiResponseText is the "lk.pii.response.text" attribute: Text the LLM produced. PII: redacted by the collector. +const AttrLkPiiResponseText = "lk.pii.response.text" + +// AttrLkPiiRoomName is the "lk.pii.room_name" attribute: Customer-supplied room name. PII: redacted by the collector. +const AttrLkPiiRoomName = "lk.pii.room_name" + +// AttrLkPiiRpcPayload is the "lk.pii.rpc.payload" attribute: RPC request payload. PII: redacted by the collector. +const AttrLkPiiRpcPayload = "lk.pii.rpc.payload" + +// AttrLkPiiRpcResponse is the "lk.pii.rpc.response" attribute: RPC response payload. PII: redacted by the collector. +const AttrLkPiiRpcResponse = "lk.pii.rpc.response" + +// AttrLkPiiSipPhoneNumber is the "lk.pii.sip.phoneNumber" attribute: Phone number of a SIP participant. PII: redacted by the collector. +const AttrLkPiiSipPhoneNumber = "lk.pii.sip.phoneNumber" + +// AttrLkPiiText is the "lk.pii.text" attribute: Message text on a log record. PII: redacted by the collector. +const AttrLkPiiText = "lk.pii.text" + +// AttrLkPiiTranscript is the "lk.pii.transcript" attribute: Transcript text on a log record. PII: redacted by the collector. +const AttrLkPiiTranscript = "lk.pii.transcript" + +// AttrLkPiiUserInput is the "lk.pii.user_input" attribute: The user's transcript for the turn. PII: redacted by the collector. +const AttrLkPiiUserInput = "lk.pii.user_input" + +// AttrLkPiiUserTranscript is the "lk.pii.user_transcript" attribute: Transcript the detector scored. PII: redacted by the collector. +const AttrLkPiiUserTranscript = "lk.pii.user_transcript" + +// AttrLkPingSeq is the "lk.ping.seq" attribute: Monotonically increasing sequence number per pipeline. +const AttrLkPingSeq = "lk.ping.seq" + +// AttrLkPlayoutPosition is the "lk.playout.position" attribute: Seconds of the agent's speech played out when it was interrupted. Unit: `s`. +const AttrLkPlayoutPosition = "lk.playout.position" + +// AttrLkPreConnectAudioDuration is the "lk.pre_connect_audio.duration" attribute: Seconds of pre-connect audio replayed. Unit: `s`. +const AttrLkPreConnectAudioDuration = "lk.pre_connect_audio.duration" + +// AttrLkPreviousAgentLabel is the "lk.previous_agent_label" attribute: Label of the agent handed off from. +const AttrLkPreviousAgentLabel = "lk.previous_agent_label" + +// AttrLkProviderRequestIds is the "lk.provider_request_ids" attribute: Provider request ids a span covers, for joining against provider logs. +const AttrLkProviderRequestIds = "lk.provider_request_ids" + +// AttrLkProviderTools is the "lk.provider_tools" attribute: Provider-side tool names offered. +const AttrLkProviderTools = "lk.provider_tools" + +// AttrLkRealtimeModelMetrics is the "lk.realtime_model_metrics" attribute: Realtime model metrics of the turn, serialized. +const AttrLkRealtimeModelMetrics = "lk.realtime_model_metrics" + +// AttrLkReconnectAttempts is the "lk.reconnect.attempts" attribute: Reconnect attempts made in the cycle. +const AttrLkReconnectAttempts = "lk.reconnect.attempts" + +// AttrLkReconnectMode is the "lk.reconnect.mode" attribute: Mode of the last reconnect attempt. +const AttrLkReconnectMode = "lk.reconnect.mode" + +// LkReconnectModeQuick is a value of AttrLkReconnectMode: Resume the session (ICE restart). +const LkReconnectModeQuick = "quick" + +// LkReconnectModeFull is a value of AttrLkReconnectMode: Reconnect from scratch. +const LkReconnectModeFull = "full" + +// AttrLkReconnectReason is the "lk.reconnect.reason" attribute: What triggered the reconnect cycle. +const AttrLkReconnectReason = "lk.reconnect.reason" + +// LkReconnectReasonSignalDisconnected is a value of AttrLkReconnectReason: The signaling socket closed (RR_SIGNAL_DISCONNECTED). +const LkReconnectReasonSignalDisconnected = "signal_disconnected" + +// LkReconnectReasonPublisherFailed is a value of AttrLkReconnectReason: The publisher peer connection failed (RR_PUBLISHER_FAILED). +const LkReconnectReasonPublisherFailed = "publisher_failed" + +// LkReconnectReasonSubscriberFailed is a value of AttrLkReconnectReason: The subscriber peer connection failed (RR_SUBSCRIBER_FAILED). +const LkReconnectReasonSubscriberFailed = "subscriber_failed" + +// LkReconnectReasonTransportFailed is a value of AttrLkReconnectReason: A peer connection failed and the platform did not say which (client only). +const LkReconnectReasonTransportFailed = "transport_failed" + +// LkReconnectReasonSwitchCandidate is a value of AttrLkReconnectReason: The server asked for a candidate switch (RR_SWITCH_CANDIDATE). +const LkReconnectReasonSwitchCandidate = "switch_candidate" + +// LkReconnectReasonNetworkChanged is a value of AttrLkReconnectReason: The device moved to another network (client only). +const LkReconnectReasonNetworkChanged = "network_changed" + +// LkReconnectReasonDebug is a value of AttrLkReconnectReason: A test or a debug menu asked for it (client only). +const LkReconnectReasonDebug = "debug" + +// LkReconnectReasonUnknown is a value of AttrLkReconnectReason: RR_UNKNOWN or a number the client does not know. +const LkReconnectReasonUnknown = "unknown" + +// AttrLkRedactionEnabled is the "lk.redaction.enabled" attribute: PII redaction was requested for the session. +const AttrLkRedactionEnabled = "lk.redaction.enabled" + +// AttrLkResponseTtfb is the "lk.response.ttfb" attribute: Seconds to the first TTS audio byte. Unit: `s`. +const AttrLkResponseTtfb = "lk.response.ttfb" + +// AttrLkResponseTtft is the "lk.response.ttft" attribute: Seconds to the first LLM token. Unit: `s`. +const AttrLkResponseTtft = "lk.response.ttft" + +// AttrLkRetryCount is the "lk.retry_count" attribute: Retries before the operation succeeded or gave up. +const AttrLkRetryCount = "lk.retry_count" + +// AttrLkRoomAutoSubscribe is the "lk.room.auto_subscribe" attribute: The room was joined with auto-subscribe. +const AttrLkRoomAutoSubscribe = "lk.room.auto_subscribe" + +// AttrLkRoomE2ee is the "lk.room.e2ee" attribute: End-to-end encryption is on. +const AttrLkRoomE2ee = "lk.room.e2ee" + +// AttrLkRoomRemoteParticipantCount is the "lk.room.remote_participant_count" attribute: Remote participants when the agent connected. +const AttrLkRoomRemoteParticipantCount = "lk.room.remote_participant_count" + +// AttrLkRoomId is the "lk.room_id" attribute: Server-assigned room session SID (`RM_...`). +const AttrLkRoomId = "lk.room_id" + +// AttrLkRoomIoParticipantFilter is the "lk.room_io.participant_filter" attribute: How room I/O picked its participant. +const AttrLkRoomIoParticipantFilter = "lk.room_io.participant_filter" + +// AttrLkRpcCallerIdentity is the "lk.rpc.caller_identity" attribute: Identity of the RPC caller. +const AttrLkRpcCallerIdentity = "lk.rpc.caller_identity" + +// AttrLkRpcDestinationIdentity is the "lk.rpc.destination_identity" attribute: Identity the RPC is sent to. +const AttrLkRpcDestinationIdentity = "lk.rpc.destination_identity" + +// AttrLkRpcErrorCode is the "lk.rpc.error_code" attribute: RPC error code. +const AttrLkRpcErrorCode = "lk.rpc.error_code" + +// AttrLkRpcHandlerRegistered is the "lk.rpc.handler_registered" attribute: A handler was registered for the method. +const AttrLkRpcHandlerRegistered = "lk.rpc.handler_registered" + +// AttrLkRpcPayloadSize is the "lk.rpc.payload_size" attribute: RPC request payload size in bytes. Unit: `By`. +const AttrLkRpcPayloadSize = "lk.rpc.payload_size" + +// AttrLkRpcRequestId is the "lk.rpc.request_id" attribute: RPC request id. +const AttrLkRpcRequestId = "lk.rpc.request_id" + +// AttrLkRpcResponseSize is the "lk.rpc.response_size" attribute: RPC response size in bytes. Unit: `By`. +const AttrLkRpcResponseSize = "lk.rpc.response_size" + +// AttrLkRpcResponseTimeout is the "lk.rpc.response_timeout" attribute: RPC response timeout in seconds. Unit: `s`. +const AttrLkRpcResponseTimeout = "lk.rpc.response_timeout" + +// AttrLkRtcAudioLevelAvg is the "lk.rtc.audio_level.avg" attribute: Average audio level in the window, 0-1, inbound audio. Unit: `1`. +const AttrLkRtcAudioLevelAvg = "lk.rtc.audio_level.avg" + +// AttrLkRtcAudioLevelMax is the "lk.rtc.audio_level.max" attribute: Maximum audio level in the window, 0-1, inbound audio. Unit: `1`. +const AttrLkRtcAudioLevelMax = "lk.rtc.audio_level.max" + +// AttrLkRtcAudioLevelMin is the "lk.rtc.audio_level.min" attribute: Minimum audio level in the window, 0-1, inbound audio. Unit: `1`. +const AttrLkRtcAudioLevelMin = "lk.rtc.audio_level.min" + +// AttrLkRtcBytes is the "lk.rtc.bytes" attribute: Bytes sent or received (cumulative). Unit: `By`. +const AttrLkRtcBytes = "lk.rtc.bytes" + +// AttrLkRtcCodec is the "lk.rtc.codec" attribute: Codec mimeType, when known. +const AttrLkRtcCodec = "lk.rtc.codec" + +// AttrLkRtcConcealedSamples is the "lk.rtc.concealed_samples" attribute: Concealed audio samples, inbound audio (cumulative). Unit: `{sample}`. +const AttrLkRtcConcealedSamples = "lk.rtc.concealed_samples" + +// AttrLkRtcConcealmentEvents is the "lk.rtc.concealment_events" attribute: Concealment events, inbound audio (cumulative). Unit: `{event}`. +const AttrLkRtcConcealmentEvents = "lk.rtc.concealment_events" + +// AttrLkRtcFpsAvg is the "lk.rtc.fps.avg" attribute: Average frame rate in the window, video. Unit: `{frame}/s`. +const AttrLkRtcFpsAvg = "lk.rtc.fps.avg" + +// AttrLkRtcFpsMax is the "lk.rtc.fps.max" attribute: Maximum frame rate in the window, video. Unit: `{frame}/s`. +const AttrLkRtcFpsMax = "lk.rtc.fps.max" + +// AttrLkRtcFpsMin is the "lk.rtc.fps.min" attribute: Minimum frame rate in the window, video. Unit: `{frame}/s`. +const AttrLkRtcFpsMin = "lk.rtc.fps.min" + +// AttrLkRtcFreezeCount is the "lk.rtc.freeze_count" attribute: Video freezes, inbound video (cumulative). Unit: `{freeze}`. +const AttrLkRtcFreezeCount = "lk.rtc.freeze_count" + +// AttrLkRtcFreezesDurationMs is the "lk.rtc.freezes_duration_ms" attribute: Total freeze time, inbound video (cumulative). Unit: `ms`. +const AttrLkRtcFreezesDurationMs = "lk.rtc.freezes_duration_ms" + +// AttrLkRtcInterruptionCount is the "lk.rtc.interruption_count" attribute: Audio interruptions, inbound audio (cumulative). Unit: `{interruption}`. +const AttrLkRtcInterruptionCount = "lk.rtc.interruption_count" + +// AttrLkRtcInterruptionsDurationMs is the "lk.rtc.interruptions_duration_ms" attribute: Total interruption time, inbound audio (cumulative). Unit: `ms`. +const AttrLkRtcInterruptionsDurationMs = "lk.rtc.interruptions_duration_ms" + +// AttrLkRtcJitterBufferDelayMs is the "lk.rtc.jitter_buffer_delay_ms" attribute: Jitter buffer delay, inbound (cumulative). Unit: `ms`. +const AttrLkRtcJitterBufferDelayMs = "lk.rtc.jitter_buffer_delay_ms" + +// AttrLkRtcJitterBufferEmittedCount is the "lk.rtc.jitter_buffer_emitted_count" attribute: Samples or frames emitted by the jitter buffer, inbound (cumulative). Unit: `{sample}`. +const AttrLkRtcJitterBufferEmittedCount = "lk.rtc.jitter_buffer_emitted_count" + +// AttrLkRtcJitterMsAvg is the "lk.rtc.jitter_ms.avg" attribute: Average jitter in the window, inbound. Unit: `ms`. +const AttrLkRtcJitterMsAvg = "lk.rtc.jitter_ms.avg" + +// AttrLkRtcJitterMsMax is the "lk.rtc.jitter_ms.max" attribute: Maximum jitter in the window, inbound. Unit: `ms`. +const AttrLkRtcJitterMsMax = "lk.rtc.jitter_ms.max" + +// AttrLkRtcJitterMsMin is the "lk.rtc.jitter_ms.min" attribute: Minimum jitter in the window, inbound. Unit: `ms`. +const AttrLkRtcJitterMsMin = "lk.rtc.jitter_ms.min" + +// AttrLkRtcPackets is the "lk.rtc.packets" attribute: Packets sent or received (cumulative). Unit: `{packet}`. +const AttrLkRtcPackets = "lk.rtc.packets" + +// AttrLkRtcPacketsLost is the "lk.rtc.packets_lost" attribute: Packets lost, inbound (cumulative). Unit: `{packet}`. +const AttrLkRtcPacketsLost = "lk.rtc.packets_lost" + +// AttrLkRtcPauseCount is the "lk.rtc.pause_count" attribute: Video pauses, inbound video (cumulative). Unit: `{pause}`. +const AttrLkRtcPauseCount = "lk.rtc.pause_count" + +// AttrLkRtcPausesDurationMs is the "lk.rtc.pauses_duration_ms" attribute: Total pause time, inbound video (cumulative). Unit: `ms`. +const AttrLkRtcPausesDurationMs = "lk.rtc.pauses_duration_ms" + +// AttrLkRtcQualityLimitationBandwidthMs is the "lk.rtc.quality_limitation.bandwidth_ms" attribute: Time the encoder was limited by bandwidth, outbound video (cumulative). Unit: `ms`. +const AttrLkRtcQualityLimitationBandwidthMs = "lk.rtc.quality_limitation.bandwidth_ms" + +// AttrLkRtcQualityLimitationCpuMs is the "lk.rtc.quality_limitation.cpu_ms" attribute: Time the encoder was limited by CPU, outbound video (cumulative). Unit: `ms`. +const AttrLkRtcQualityLimitationCpuMs = "lk.rtc.quality_limitation.cpu_ms" + +// AttrLkRtcQualityLimitationOtherMs is the "lk.rtc.quality_limitation.other_ms" attribute: Time the encoder was limited for other reasons, outbound video (cumulative). Unit: `ms`. +const AttrLkRtcQualityLimitationOtherMs = "lk.rtc.quality_limitation.other_ms" + +// AttrLkRtcRttMsAvg is the "lk.rtc.rtt_ms.avg" attribute: Average round-trip time in the window. Unit: `ms`. +const AttrLkRtcRttMsAvg = "lk.rtc.rtt_ms.avg" + +// AttrLkRtcRttMsMax is the "lk.rtc.rtt_ms.max" attribute: Maximum round-trip time in the window. Unit: `ms`. +const AttrLkRtcRttMsMax = "lk.rtc.rtt_ms.max" + +// AttrLkRtcRttMsMin is the "lk.rtc.rtt_ms.min" attribute: Minimum round-trip time in the window. Unit: `ms`. +const AttrLkRtcRttMsMin = "lk.rtc.rtt_ms.min" + +// AttrLkRtcSamples is the "lk.rtc.samples" attribute: Stats readings folded into the window. Unit: `{reading}`. +const AttrLkRtcSamples = "lk.rtc.samples" + +// AttrLkRtcSilentConcealedSamples is the "lk.rtc.silent_concealed_samples" attribute: Concealed samples that were silent, inbound audio (cumulative). Unit: `{sample}`. +const AttrLkRtcSilentConcealedSamples = "lk.rtc.silent_concealed_samples" + +// AttrLkRtcWindowMs is the "lk.rtc.window_ms" attribute: Actual length of the stats window. Unit: `ms`. +const AttrLkRtcWindowMs = "lk.rtc.window_ms" + +// AttrLkSdkName is the "lk.sdk.name" attribute: LiveKit SDK name. +const AttrLkSdkName = "lk.sdk.name" + +// AttrLkSdkVersion is the "lk.sdk.version" attribute: LiveKit SDK version. +const AttrLkSdkVersion = "lk.sdk.version" + +// AttrLkShutdownReason is the "lk.shutdown.reason" attribute: Why the job shut down. +const AttrLkShutdownReason = "lk.shutdown.reason" + +// AttrLkShutdownUserInitiated is the "lk.shutdown.user_initiated" attribute: The shutdown was requested by user code. +const AttrLkShutdownUserInitiated = "lk.shutdown.user_initiated" + +// AttrLkSimulationEnabled is the "lk.simulation.enabled" attribute: The session is a simulation. +const AttrLkSimulationEnabled = "lk.simulation.enabled" + +// AttrLkSimulationJobId is the "lk.simulation.job_id" attribute: Simulation run job (one scenario) behind the session. +const AttrLkSimulationJobId = "lk.simulation.job_id" + +// AttrLkSimulationRunId is the "lk.simulation.run_id" attribute: Simulation run the session belongs to. +const AttrLkSimulationRunId = "lk.simulation.run_id" + +// AttrLkSpeechQueueWait is the "lk.speech.queue_wait" attribute: Seconds a speech handle waited in the queue before generation was authorized. Unit: `s`. +const AttrLkSpeechQueueWait = "lk.speech.queue_wait" + +// AttrLkSpeechId is the "lk.speech_id" attribute: Id of the speech handle a span belongs to. +const AttrLkSpeechId = "lk.speech_id" + +// AttrLkSttEvents is the "lk.stt.events" attribute: JSON list of transcript events on the user turn, in arrival order (received_at, type, transcript_length). +const AttrLkSttEvents = "lk.stt.events" + +// AttrLkSuccess is the "lk.success" attribute: The session report is tagged successful. +const AttrLkSuccess = "lk.success" + +// AttrLkTelemetryCacheBatches is the "lk.telemetry.cache.batches" attribute: Batches waiting in the cache now. Unit: `{batch}`. +const AttrLkTelemetryCacheBatches = "lk.telemetry.cache.batches" + +// AttrLkTelemetryCacheDeleteErrors is the "lk.telemetry.cache.delete_errors" attribute: Sent batches the cache could not delete; never sent twice from the same launch. Unit: `{batch}`. +const AttrLkTelemetryCacheDeleteErrors = "lk.telemetry.cache.delete_errors" + +// AttrLkTelemetryCacheListErrors is the "lk.telemetry.cache.list_errors" attribute: Times the cache could not be listed, so nothing was reconciled or sent. Unit: `{attempt}`. +const AttrLkTelemetryCacheListErrors = "lk.telemetry.cache.list_errors" + +// AttrLkTelemetryCacheReadErrors is the "lk.telemetry.cache.read_errors" attribute: Cached batches that could not be read right now, kept for the next pass. Unit: `{batch}`. +const AttrLkTelemetryCacheReadErrors = "lk.telemetry.cache.read_errors" + +// AttrLkTelemetryCacheWriteErrors is the "lk.telemetry.cache.write_errors" attribute: Batches the disk refused, kept in memory instead. Unit: `{batch}`. +const AttrLkTelemetryCacheWriteErrors = "lk.telemetry.cache.write_errors" + +// AttrLkTelemetryDroppedCacheError is the "lk.telemetry.dropped.cache_error" attribute: Records no cache, not even memory, could take. Unit: `{record}`. +const AttrLkTelemetryDroppedCacheError = "lk.telemetry.dropped.cache_error" + +// AttrLkTelemetryDroppedCacheFull is the "lk.telemetry.dropped.cache_full" attribute: Records evicted by the cache's size or file-count bound. Unit: `{record}`. +const AttrLkTelemetryDroppedCacheFull = "lk.telemetry.dropped.cache_full" + +// AttrLkTelemetryDroppedCorrupt is the "lk.telemetry.dropped.corrupt" attribute: Records in cached batches that failed their CRC. Unit: `{record}`. +const AttrLkTelemetryDroppedCorrupt = "lk.telemetry.dropped.corrupt" + +// AttrLkTelemetryDroppedExpired is the "lk.telemetry.dropped.expired" attribute: Records in batches past the cache's age limit. Unit: `{record}`. +const AttrLkTelemetryDroppedExpired = "lk.telemetry.dropped.expired" + +// AttrLkTelemetryDroppedInvalid is the "lk.telemetry.dropped.invalid" attribute: Custom events, attributes or SDK strings over the limits, rejected. Unit: `{record}`. +const AttrLkTelemetryDroppedInvalid = "lk.telemetry.dropped.invalid" + +// AttrLkTelemetryDroppedOversized is the "lk.telemetry.dropped.oversized" attribute: Single records larger than the collector accepts (413). Unit: `{record}`. +const AttrLkTelemetryDroppedOversized = "lk.telemetry.dropped.oversized" + +// AttrLkTelemetryDroppedQueueFull is the "lk.telemetry.dropped.queue_full" attribute: Records evicted from the in-memory queue. Unit: `{record}`. +const AttrLkTelemetryDroppedQueueFull = "lk.telemetry.dropped.queue_full" + +// AttrLkTelemetryDroppedRateLimited is the "lk.telemetry.dropped.rate_limited" attribute: Discrete events dropped by the flood guard. Unit: `{record}`. +const AttrLkTelemetryDroppedRateLimited = "lk.telemetry.dropped.rate_limited" + +// AttrLkTelemetryDroppedRejected is the "lk.telemetry.dropped.rejected" attribute: Records the collector rejected (final 4xx/5xx, OTLP partial success). Unit: `{record}`. +const AttrLkTelemetryDroppedRejected = "lk.telemetry.dropped.rejected" + +// AttrLkTelemetryDroppedThrottled is the "lk.telemetry.dropped.throttled" attribute: Records evicted from the cache during a server-directed pause. Unit: `{record}`. +const AttrLkTelemetryDroppedThrottled = "lk.telemetry.dropped.throttled" + +// AttrLkTelemetryDroppedUnattributed is the "lk.telemetry.dropped.unattributed" attribute: Log lines from a Room-shaped logging context with no telemetry scope behind it, dropped. Unit: `{record}`. +const AttrLkTelemetryDroppedUnattributed = "lk.telemetry.dropped.unattributed" + +// AttrLkTelemetryHoldsCapped is the "lk.telemetry.holds.capped" attribute: Soft upload holds that reached their cap. Unit: `{hold}`. +const AttrLkTelemetryHoldsCapped = "lk.telemetry.holds.capped" + +// AttrLkTelemetryUploadsBytes is the "lk.telemetry.uploads.bytes" attribute: Compressed bytes the collector accepted. Unit: `By`. +const AttrLkTelemetryUploadsBytes = "lk.telemetry.uploads.bytes" + +// AttrLkTelemetryUploadsFailed is the "lk.telemetry.uploads.failed" attribute: Upload attempts that failed transiently (no answer, 429, 5xx). Unit: `{attempt}`. +const AttrLkTelemetryUploadsFailed = "lk.telemetry.uploads.failed" + +// AttrLkTelemetryUploadsSent is the "lk.telemetry.uploads.sent" attribute: Batches the collector accepted. Unit: `{batch}`. +const AttrLkTelemetryUploadsSent = "lk.telemetry.uploads.sent" + +// AttrLkTelemetryUploadsTimeouts is the "lk.telemetry.uploads.timeouts" attribute: Upload attempts that hit the export timeout. Unit: `{attempt}`. +const AttrLkTelemetryUploadsTimeouts = "lk.telemetry.uploads.timeouts" + +// AttrLkTelemetryUploadsUnauthorized is the "lk.telemetry.uploads.unauthorized" attribute: 401/403 answers (tokens the collector refused). Unit: `{attempt}`. +const AttrLkTelemetryUploadsUnauthorized = "lk.telemetry.uploads.unauthorized" + +// AttrLkToolSets is the "lk.tool_sets" attribute: Tool set names offered. +const AttrLkToolSets = "lk.tool_sets" + +// AttrLkTrackDirection is the "lk.track.direction" attribute: Whether the stats describe sent or received media. +const AttrLkTrackDirection = "lk.track.direction" + +// LkTrackDirectionInbound is a value of AttrLkTrackDirection: Received media (inbound-rtp). +const LkTrackDirectionInbound = "inbound" + +// LkTrackDirectionOutbound is a value of AttrLkTrackDirection: Sent media (outbound-rtp). +const LkTrackDirectionOutbound = "outbound" + +// AttrLkTrackKind is the "lk.track.kind" attribute: Media kind of the track. +const AttrLkTrackKind = "lk.track.kind" + +// LkTrackKindAudio is a value of AttrLkTrackKind: Audio. +const LkTrackKindAudio = "audio" + +// LkTrackKindVideo is a value of AttrLkTrackKind: Video. +const LkTrackKindVideo = "video" + +// AttrLkTrackId is the "lk.track_id" attribute: Server-assigned track SID (`TR_...`). +const AttrLkTrackId = "lk.track_id" + +// AttrLkTrackSource is the "lk.track_source" attribute: Source of the track, as the Agents RTC FFI `TrackSource` enum name. +const AttrLkTrackSource = "lk.track_source" + +// LkTrackSourceSourceUnknown is a value of AttrLkTrackSource: Unknown source. +const LkTrackSourceSourceUnknown = "SOURCE_UNKNOWN" + +// LkTrackSourceSourceCamera is a value of AttrLkTrackSource: Camera. +const LkTrackSourceSourceCamera = "SOURCE_CAMERA" + +// LkTrackSourceSourceMicrophone is a value of AttrLkTrackSource: Microphone. +const LkTrackSourceSourceMicrophone = "SOURCE_MICROPHONE" + +// LkTrackSourceSourceScreenshare is a value of AttrLkTrackSource: Screen share video. +const LkTrackSourceSourceScreenshare = "SOURCE_SCREENSHARE" + +// LkTrackSourceSourceScreenshareAudio is a value of AttrLkTrackSource: Screen share audio. +const LkTrackSourceSourceScreenshareAudio = "SOURCE_SCREENSHARE_AUDIO" + +// AttrLkTranscriptConfidence is the "lk.transcript_confidence" attribute: Confidence of the final transcript. +const AttrLkTranscriptConfidence = "lk.transcript_confidence" + +// AttrLkTranscriptionDelay is the "lk.transcription_delay" attribute: Seconds from the end of speech to the final transcript. Unit: `s`. +const AttrLkTranscriptionDelay = "lk.transcription_delay" + +// AttrLkTtsBytes is the "lk.tts.bytes" attribute: Audio bytes the TTS driver collected (Node binding). Unit: `By`. +const AttrLkTtsBytes = "lk.tts.bytes" + +// AttrLkTtsFrames is the "lk.tts.frames" attribute: Audio frames the TTS driver collected (Node binding). +const AttrLkTtsFrames = "lk.tts.frames" + +// AttrLkTtsLabel is the "lk.tts.label" attribute: Label of the TTS instance. +const AttrLkTtsLabel = "lk.tts.label" + +// AttrLkTtsNoDuplexPath is the "lk.tts.no_duplex_path" attribute: The TTS reported no duplex path, so the stream adapter was selected (Node binding; not a failure). +const AttrLkTtsNoDuplexPath = "lk.tts.no_duplex_path" + +// AttrLkTtsStreaming is the "lk.tts.streaming" attribute: The TTS instance streams (duplex path). +const AttrLkTtsStreaming = "lk.tts.streaming" + +// AttrLkTtsMetrics is the "lk.tts_metrics" attribute: TTS metrics of the turn, serialized. +const AttrLkTtsMetrics = "lk.tts_metrics" + +// AttrModelName is the "model_name" attribute: Model name the plugin reported. +const AttrModelName = "model_name" + +// AttrModelProvider is the "model_provider" attribute: Provider the plugin reported. +const AttrModelProvider = "model_provider" + +// AttrOutcome is the "outcome" attribute: The session outcome, as a map with the field `outcome` (`success` or `fail`) and an optional `reason`. +const AttrOutcome = "outcome" + +// AttrSdkVersion is the "sdk_version" attribute: The Agents SDK version. +const AttrSdkVersion = "sdk_version" + +// AttrSessionOptions is the "session.options" attribute: The session's options, as a map of option name to value. +const AttrSessionOptions = "session.options" + +// AttrSessionReportTimestamp is the "session.report_timestamp" attribute: When the report was made, in Unix seconds. +const AttrSessionReportTimestamp = "session.report_timestamp" + +// AttrSessionTags is the "session.tags" attribute: The session's tags, sorted. Absent when the session has none. +const AttrSessionTags = "session.tags" + +// AttrTag is the "tag" attribute: One tag with metadata, as a map with the fields `name` and `metadata`. +const AttrTag = "tag" + +// AttrUsage is the "usage" attribute: Model usage, as a list of maps, one per model. Absent when there was none. +const AttrUsage = "usage" + +// Upstream OTel keys that LiveKit signals reference (defined by the registry's dependencies, never +// here), so a producer can name them from one place. + +// AttrCodeFilePath is the "code.file.path" attribute: The source code filename that identifies the code unit as uniquely as possible (preferably an absolute file path). This attribute MUST NOT be used on the Profile signal since the data is already captured in 'message Function'. This constraint is imposed to prevent redundancy and maintain data integrity. +const AttrCodeFilePath = "code.file.path" + +// AttrCodeFunctionName is the "code.function.name" attribute: The method or function fully-qualified name without arguments. The value should fit the natural representation of the language runtime, which is also likely the same used within `code.stacktrace` attribute value. This attribute MUST NOT be used on the Profile signal since the data is already captured in 'message Function'. This constraint is imposed to prevent redundancy and maintain data integrity. +const AttrCodeFunctionName = "code.function.name" + +// AttrCodeLineNumber is the "code.line.number" attribute: The line number in `code.file.path` best representing the operation. It SHOULD point within the code unit named in `code.function.name`. This attribute MUST NOT be used on the Profile signal since the data is already captured in 'message Line'. This constraint is imposed to prevent redundancy and maintain data integrity. +const AttrCodeLineNumber = "code.line.number" + +// AttrDeviceModelIdentifier is the "device.model.identifier" attribute: The model identifier for the device +const AttrDeviceModelIdentifier = "device.model.identifier" + +// AttrErrorType is the "error.type" attribute: Describes a class of error the operation ended with. +const AttrErrorType = "error.type" + +// ErrorTypeOther is a value of AttrErrorType: A fallback error value to be used when the instrumentation doesn't define a custom value. +const ErrorTypeOther = "_OTHER" + +// AttrExceptionMessage is the "exception.message" attribute: The exception message. +const AttrExceptionMessage = "exception.message" + +// AttrExceptionStacktrace is the "exception.stacktrace" attribute: A stacktrace as a string in the natural representation for the language runtime. The representation is to be determined and documented by each language SIG. +const AttrExceptionStacktrace = "exception.stacktrace" + +// AttrExceptionType is the "exception.type" attribute: The type of the exception (its fully-qualified class name, if applicable). The dynamic type of the exception should be preferred over the static type in languages that support it. +const AttrExceptionType = "exception.type" + +// AttrGenAiAgentName is the "gen_ai.agent.name" attribute: Human-readable name of the GenAI agent provided by the application. +const AttrGenAiAgentName = "gen_ai.agent.name" + +// AttrGenAiConversationId is the "gen_ai.conversation.id" attribute: The unique identifier for a conversation (session, thread), used to store and correlate messages within this conversation. +const AttrGenAiConversationId = "gen_ai.conversation.id" + +// AttrGenAiEvaluationExplanation is the "gen_ai.evaluation.explanation" attribute: A free-form explanation for the assigned score provided by the evaluator. +const AttrGenAiEvaluationExplanation = "gen_ai.evaluation.explanation" + +// AttrGenAiEvaluationName is the "gen_ai.evaluation.name" attribute: The name of the evaluation metric used for the GenAI response. +const AttrGenAiEvaluationName = "gen_ai.evaluation.name" + +// AttrGenAiEvaluationScoreLabel is the "gen_ai.evaluation.score.label" attribute: Human readable label for evaluation. +const AttrGenAiEvaluationScoreLabel = "gen_ai.evaluation.score.label" + +// AttrGenAiInputMessages is the "gen_ai.input.messages" attribute: The chat history provided to the model as an input. +const AttrGenAiInputMessages = "gen_ai.input.messages" + +// AttrGenAiMemoryQueryText is the "gen_ai.memory.query.text" attribute: The search query used to retrieve memories. +const AttrGenAiMemoryQueryText = "gen_ai.memory.query.text" + +// AttrGenAiMemoryRecords is the "gen_ai.memory.records" attribute: The memory records stored or retrieved in a memory operation. +const AttrGenAiMemoryRecords = "gen_ai.memory.records" + +// AttrGenAiOperationName is the "gen_ai.operation.name" attribute: The name of the operation being performed. +const AttrGenAiOperationName = "gen_ai.operation.name" + +// GenAiOperationNameChat is a value of AttrGenAiOperationName: Chat completion operation such as [OpenAI Chat API](https://platform.openai.com/docs/api-reference/chat) +const GenAiOperationNameChat = "chat" + +// GenAiOperationNameGenerateContent is a value of AttrGenAiOperationName: Multimodal content generation operation such as [Gemini Generate Content](https://ai.google.dev/api/generate-content) +const GenAiOperationNameGenerateContent = "generate_content" + +// GenAiOperationNameTextCompletion is a value of AttrGenAiOperationName: Text completions operation such as [OpenAI Completions API (Legacy)](https://platform.openai.com/docs/api-reference/completions) +const GenAiOperationNameTextCompletion = "text_completion" + +// GenAiOperationNameEmbeddings is a value of AttrGenAiOperationName: Embeddings operation such as [OpenAI Create embeddings API](https://platform.openai.com/docs/api-reference/embeddings/create) +const GenAiOperationNameEmbeddings = "embeddings" + +// GenAiOperationNameRetrieval is a value of AttrGenAiOperationName: Retrieval operation such as [OpenAI Search Vector Store API](https://platform.openai.com/docs/api-reference/vector-stores/search) +const GenAiOperationNameRetrieval = "retrieval" + +// GenAiOperationNameFetchResponse is a value of AttrGenAiOperationName: Fetch a previously generated model response by its identifier, without performing inference, such as [OpenAI Get a model response](https://platform.openai.com/docs/api-reference/responses/get) +const GenAiOperationNameFetchResponse = "fetch_response" + +// GenAiOperationNameCreateAgent is a value of AttrGenAiOperationName: Create GenAI agent +const GenAiOperationNameCreateAgent = "create_agent" + +// GenAiOperationNameInvokeAgent is a value of AttrGenAiOperationName: Invoke GenAI agent +const GenAiOperationNameInvokeAgent = "invoke_agent" + +// GenAiOperationNameExecuteTool is a value of AttrGenAiOperationName: Execute a tool +const GenAiOperationNameExecuteTool = "execute_tool" + +// GenAiOperationNameInvokeWorkflow is a value of AttrGenAiOperationName: Invoke GenAI workflow +const GenAiOperationNameInvokeWorkflow = "invoke_workflow" + +// GenAiOperationNamePlan is a value of AttrGenAiOperationName: Agent planning or task decomposition phase +const GenAiOperationNamePlan = "plan" + +// GenAiOperationNameSearchMemory is a value of AttrGenAiOperationName: Search/query memories from a memory store +const GenAiOperationNameSearchMemory = "search_memory" + +// GenAiOperationNameCreateMemory is a value of AttrGenAiOperationName: Create new memory records +const GenAiOperationNameCreateMemory = "create_memory" + +// GenAiOperationNameUpdateMemory is a value of AttrGenAiOperationName: Update existing memory records +const GenAiOperationNameUpdateMemory = "update_memory" + +// GenAiOperationNameUpsertMemory is a value of AttrGenAiOperationName: Create or update memory records without the caller choosing which +const GenAiOperationNameUpsertMemory = "upsert_memory" + +// GenAiOperationNameDeleteMemory is a value of AttrGenAiOperationName: Delete memory records +const GenAiOperationNameDeleteMemory = "delete_memory" + +// GenAiOperationNameCreateMemoryStore is a value of AttrGenAiOperationName: Create or initialize a memory store +const GenAiOperationNameCreateMemoryStore = "create_memory_store" + +// GenAiOperationNameDeleteMemoryStore is a value of AttrGenAiOperationName: Delete or deprovision a memory store +const GenAiOperationNameDeleteMemoryStore = "delete_memory_store" + +// AttrGenAiOutputMessages is the "gen_ai.output.messages" attribute: Messages returned by the model where each message represents a specific model response (choice, candidate). +const AttrGenAiOutputMessages = "gen_ai.output.messages" + +// AttrGenAiOutputType is the "gen_ai.output.type" attribute: Represents the content type requested by the client. +const AttrGenAiOutputType = "gen_ai.output.type" + +// GenAiOutputTypeText is a value of AttrGenAiOutputType: Plain text +const GenAiOutputTypeText = "text" + +// GenAiOutputTypeJson is a value of AttrGenAiOutputType: JSON object with known or unknown schema +const GenAiOutputTypeJson = "json" + +// GenAiOutputTypeImage is a value of AttrGenAiOutputType: Image +const GenAiOutputTypeImage = "image" + +// GenAiOutputTypeSpeech is a value of AttrGenAiOutputType: Speech +const GenAiOutputTypeSpeech = "speech" + +// AttrGenAiPromptVariable is the "gen_ai.prompt.variable" attribute: The variables supplied to the prompt template, the `` being the variable name, the value being the variable value. +const AttrGenAiPromptVariable = "gen_ai.prompt.variable" + +// AttrGenAiProviderName is the "gen_ai.provider.name" attribute: The Generative AI provider as identified by the client or server instrumentation. +const AttrGenAiProviderName = "gen_ai.provider.name" + +// GenAiProviderNameOpenai is a value of AttrGenAiProviderName: [OpenAI](https://openai.com/) +const GenAiProviderNameOpenai = "openai" + +// GenAiProviderNameGcpGenAi is a value of AttrGenAiProviderName: Any Google generative AI endpoint +const GenAiProviderNameGcpGenAi = "gcp.gen_ai" + +// GenAiProviderNameGcpVertexAi is a value of AttrGenAiProviderName: [Vertex AI](https://cloud.google.com/vertex-ai) +const GenAiProviderNameGcpVertexAi = "gcp.vertex_ai" + +// GenAiProviderNameGcpGemini is a value of AttrGenAiProviderName: [Gemini](https://cloud.google.com/products/gemini) +const GenAiProviderNameGcpGemini = "gcp.gemini" + +// GenAiProviderNameAnthropic is a value of AttrGenAiProviderName: [Anthropic](https://www.anthropic.com/) +const GenAiProviderNameAnthropic = "anthropic" + +// GenAiProviderNameCohere is a value of AttrGenAiProviderName: [Cohere](https://cohere.com/) +const GenAiProviderNameCohere = "cohere" + +// GenAiProviderNameAzureAiInference is a value of AttrGenAiProviderName: Azure AI Inference +const GenAiProviderNameAzureAiInference = "azure.ai.inference" + +// GenAiProviderNameAzureAiOpenai is a value of AttrGenAiProviderName: [Azure OpenAI](https://learn.microsoft.com/en-us/azure/ai-services/openai/overview) +const GenAiProviderNameAzureAiOpenai = "azure.ai.openai" + +// GenAiProviderNameIbmWatsonxAi is a value of AttrGenAiProviderName: [IBM Watsonx AI](https://www.ibm.com/products/watsonx-ai) +const GenAiProviderNameIbmWatsonxAi = "ibm.watsonx.ai" + +// GenAiProviderNameAwsBedrock is a value of AttrGenAiProviderName: [AWS Bedrock](https://aws.amazon.com/bedrock) +const GenAiProviderNameAwsBedrock = "aws.bedrock" + +// GenAiProviderNamePerplexity is a value of AttrGenAiProviderName: [Perplexity](https://www.perplexity.ai/) +const GenAiProviderNamePerplexity = "perplexity" + +// GenAiProviderNameXAi is a value of AttrGenAiProviderName: [xAI](https://x.ai/) +const GenAiProviderNameXAi = "x_ai" + +// GenAiProviderNameDeepseek is a value of AttrGenAiProviderName: [DeepSeek](https://www.deepseek.com/) +const GenAiProviderNameDeepseek = "deepseek" + +// GenAiProviderNameGroq is a value of AttrGenAiProviderName: [Groq](https://groq.com/) +const GenAiProviderNameGroq = "groq" + +// GenAiProviderNameMistral is a value of AttrGenAiProviderName: [Mistral](https://mistral.ai/) +const GenAiProviderNameMistral = "mistral" + +// GenAiProviderNameMoonshotAi is a value of AttrGenAiProviderName: [Moonshot AI](https://www.moonshot.ai/) +const GenAiProviderNameMoonshotAi = "moonshot_ai" + +// GenAiProviderNameMistralAi is a value of AttrGenAiProviderName: Mistral, as Agents sends it. The upstream member is `mistral`. Sent by LiveKit, not an upstream value. +const GenAiProviderNameMistralAi = "mistral_ai" + +// AttrGenAiRequestModel is the "gen_ai.request.model" attribute: The name of the GenAI model a request is being made to. +const AttrGenAiRequestModel = "gen_ai.request.model" + +// AttrGenAiRequestStream is the "gen_ai.request.stream" attribute: Indicates whether the GenAI request was made in streaming mode. +const AttrGenAiRequestStream = "gen_ai.request.stream" + +// AttrGenAiResponseFinishReasons is the "gen_ai.response.finish_reasons" attribute: Array of reasons the model stopped generating tokens, corresponding to each generation received. +const AttrGenAiResponseFinishReasons = "gen_ai.response.finish_reasons" + +// GenAiResponseFinishReasonsCompaction is a value of AttrGenAiResponseFinishReasons: Declared in Agents' `GenAIFinishReason`. No Agents code path sends it today. Sent by LiveKit, not an upstream value. +const GenAiResponseFinishReasonsCompaction = "compaction" + +// GenAiResponseFinishReasonsContentFilter is a value of AttrGenAiResponseFinishReasons: A content filter stopped the output. Sent by LiveKit, not an upstream value. +const GenAiResponseFinishReasonsContentFilter = "content_filter" + +// GenAiResponseFinishReasonsError is a value of AttrGenAiResponseFinishReasons: The generation ended abnormally. The upstream note names this value. Sent by LiveKit, not an upstream value. +const GenAiResponseFinishReasonsError = "error" + +// GenAiResponseFinishReasonsLength is a value of AttrGenAiResponseFinishReasons: The output reached the token limit. Sent by LiveKit, not an upstream value. +const GenAiResponseFinishReasonsLength = "length" + +// GenAiResponseFinishReasonsStop is a value of AttrGenAiResponseFinishReasons: The generation finished normally. Sent by LiveKit, not an upstream value. +const GenAiResponseFinishReasonsStop = "stop" + +// GenAiResponseFinishReasonsToolCall is a value of AttrGenAiResponseFinishReasons: The generation ended with a tool call. Sent by LiveKit, not an upstream value. +const GenAiResponseFinishReasonsToolCall = "tool_call" + +// AttrGenAiResponseId is the "gen_ai.response.id" attribute: The unique identifier for the completion. +const AttrGenAiResponseId = "gen_ai.response.id" + +// AttrGenAiResponseModel is the "gen_ai.response.model" attribute: The name of the model that generated the response. +const AttrGenAiResponseModel = "gen_ai.response.model" + +// AttrGenAiResponseTimeToFirstChunk is the "gen_ai.response.time_to_first_chunk" attribute: Time to first chunk in a streaming response, measured from request issuance, in seconds. The value is measured from when the client issues the generation request to when the first chunk is received in the response stream. +const AttrGenAiResponseTimeToFirstChunk = "gen_ai.response.time_to_first_chunk" + +// AttrGenAiRetrievalDocuments is the "gen_ai.retrieval.documents" attribute: The documents retrieved. +const AttrGenAiRetrievalDocuments = "gen_ai.retrieval.documents" + +// AttrGenAiRetrievalQueryText is the "gen_ai.retrieval.query.text" attribute: The query text used for retrieval. +const AttrGenAiRetrievalQueryText = "gen_ai.retrieval.query.text" + +// AttrGenAiSystemInstructions is the "gen_ai.system_instructions" attribute: The system message or instructions provided to the GenAI model separately from the chat history. +const AttrGenAiSystemInstructions = "gen_ai.system_instructions" + +// AttrGenAiToolCallArguments is the "gen_ai.tool.call.arguments" attribute: Parameters passed to the tool call. +const AttrGenAiToolCallArguments = "gen_ai.tool.call.arguments" + +// AttrGenAiToolCallId is the "gen_ai.tool.call.id" attribute: The tool call identifier supplied by the model or provider. +const AttrGenAiToolCallId = "gen_ai.tool.call.id" + +// AttrGenAiToolCallResult is the "gen_ai.tool.call.result" attribute: The result returned by the tool call (if any and if execution was successful). +const AttrGenAiToolCallResult = "gen_ai.tool.call.result" + +// AttrGenAiToolDefinitions is the "gen_ai.tool.definitions" attribute: The list of tool definitions available to the GenAI agent or model. +const AttrGenAiToolDefinitions = "gen_ai.tool.definitions" + +// AttrGenAiToolDescription is the "gen_ai.tool.description" attribute: The tool description. +const AttrGenAiToolDescription = "gen_ai.tool.description" + +// AttrGenAiToolName is the "gen_ai.tool.name" attribute: Name of the tool utilized by the agent. +const AttrGenAiToolName = "gen_ai.tool.name" + +// AttrGenAiToolType is the "gen_ai.tool.type" attribute: Type of the tool utilized by the agent +const AttrGenAiToolType = "gen_ai.tool.type" + +// AttrGenAiUsageAudioCacheReadInputTokens is the "gen_ai.usage.audio.cache_read.input_tokens" attribute: The number of audio input tokens served from a provider-managed cache. +const AttrGenAiUsageAudioCacheReadInputTokens = "gen_ai.usage.audio.cache_read.input_tokens" + +// AttrGenAiUsageAudioInputTokens is the "gen_ai.usage.audio.input_tokens" attribute: The number of audio input tokens. +const AttrGenAiUsageAudioInputTokens = "gen_ai.usage.audio.input_tokens" + +// AttrGenAiUsageAudioOutputTokens is the "gen_ai.usage.audio.output_tokens" attribute: The number of audio output tokens. +const AttrGenAiUsageAudioOutputTokens = "gen_ai.usage.audio.output_tokens" + +// AttrGenAiUsageCacheReadInputTokens is the "gen_ai.usage.cache_read.input_tokens" attribute: The number of input tokens served from a provider-managed cache. +const AttrGenAiUsageCacheReadInputTokens = "gen_ai.usage.cache_read.input_tokens" + +// AttrGenAiUsageCacheWriteInputTokens is the "gen_ai.usage.cache_write.input_tokens" attribute: The number of input tokens written to a provider-managed cache. +const AttrGenAiUsageCacheWriteInputTokens = "gen_ai.usage.cache_write.input_tokens" + +// AttrGenAiUsageImageCacheReadInputTokens is the "gen_ai.usage.image.cache_read.input_tokens" attribute: The number of image input tokens served from a provider-managed cache. +const AttrGenAiUsageImageCacheReadInputTokens = "gen_ai.usage.image.cache_read.input_tokens" + +// AttrGenAiUsageImageInputTokens is the "gen_ai.usage.image.input_tokens" attribute: The number of image input tokens. +const AttrGenAiUsageImageInputTokens = "gen_ai.usage.image.input_tokens" + +// AttrGenAiUsageInputTokens is the "gen_ai.usage.input_tokens" attribute: The number of tokens used in the GenAI input (prompt). +const AttrGenAiUsageInputTokens = "gen_ai.usage.input_tokens" + +// AttrGenAiUsageOutputTokens is the "gen_ai.usage.output_tokens" attribute: The number of tokens used in the GenAI response (completion). +const AttrGenAiUsageOutputTokens = "gen_ai.usage.output_tokens" + +// AttrGenAiUsageReasoningOutputTokens is the "gen_ai.usage.reasoning.output_tokens" attribute: The number of output tokens used for reasoning (e.g. chain-of-thought, extended thinking). +const AttrGenAiUsageReasoningOutputTokens = "gen_ai.usage.reasoning.output_tokens" + +// AttrGenAiUsageTextCacheReadInputTokens is the "gen_ai.usage.text.cache_read.input_tokens" attribute: The number of text input tokens served from a provider-managed cache. +const AttrGenAiUsageTextCacheReadInputTokens = "gen_ai.usage.text.cache_read.input_tokens" + +// AttrGenAiUsageTextInputTokens is the "gen_ai.usage.text.input_tokens" attribute: The number of text input tokens. +const AttrGenAiUsageTextInputTokens = "gen_ai.usage.text.input_tokens" + +// AttrGenAiUsageTextOutputTokens is the "gen_ai.usage.text.output_tokens" attribute: The number of text output tokens. +const AttrGenAiUsageTextOutputTokens = "gen_ai.usage.text.output_tokens" + +// AttrGenAiWorkflowName is the "gen_ai.workflow.name" attribute: Human-readable name of the GenAI workflow provided by the application. +const AttrGenAiWorkflowName = "gen_ai.workflow.name" + +// AttrNetworkConnectionType is the "network.connection.type" attribute: The internet connection type. +const AttrNetworkConnectionType = "network.connection.type" + +// NetworkConnectionTypeWifi is a value of AttrNetworkConnectionType: Wi-Fi +const NetworkConnectionTypeWifi = "wifi" + +// NetworkConnectionTypeWired is a value of AttrNetworkConnectionType: `wired`. +const NetworkConnectionTypeWired = "wired" + +// NetworkConnectionTypeCell is a value of AttrNetworkConnectionType: `cell`. +const NetworkConnectionTypeCell = "cell" + +// NetworkConnectionTypeUnavailable is a value of AttrNetworkConnectionType: `unavailable`. +const NetworkConnectionTypeUnavailable = "unavailable" + +// NetworkConnectionTypeUnknown is a value of AttrNetworkConnectionType: `unknown`. +const NetworkConnectionTypeUnknown = "unknown" + +// AttrOsName is the "os.name" attribute: Human readable operating system name. +const AttrOsName = "os.name" + +// AttrOsVersion is the "os.version" attribute: The version string of the operating system as defined in [Version Attributes](/docs/resource/README.md#version-attributes). +const AttrOsVersion = "os.version" + +// AttrOtelEventName is the "otel.event.name" attribute: Identifies the class / type of event. +const AttrOtelEventName = "otel.event.name" + +// AttrRpcMethod is the "rpc.method" attribute: The fully-qualified logical name of the method from the RPC interface perspective. +const AttrRpcMethod = "rpc.method" + +// AttrServiceName is the "service.name" attribute: Logical name of the service. +const AttrServiceName = "service.name" + +// AttrServiceVersion is the "service.version" attribute: The version string of the service component. The format is not defined by these conventions. +const AttrServiceVersion = "service.version" + +// AttrSessionId is the "session.id" attribute: A unique ID to identify a session. +const AttrSessionId = "session.id" + +// AttrTelemetrySdkLanguage is the "telemetry.sdk.language" attribute: The language of the telemetry SDK. +const AttrTelemetrySdkLanguage = "telemetry.sdk.language" + +// TelemetrySdkLanguageCpp is a value of AttrTelemetrySdkLanguage: [C++](https://opentelemetry.io/docs/languages/cpp/) +const TelemetrySdkLanguageCpp = "cpp" + +// TelemetrySdkLanguageDotnet is a value of AttrTelemetrySdkLanguage: [.NET](https://opentelemetry.io/docs/languages/dotnet/) +const TelemetrySdkLanguageDotnet = "dotnet" + +// TelemetrySdkLanguageErlang is a value of AttrTelemetrySdkLanguage: [Erlang/Elixir](https://opentelemetry.io/docs/languages/erlang/) +const TelemetrySdkLanguageErlang = "erlang" + +// TelemetrySdkLanguageGo is a value of AttrTelemetrySdkLanguage: [Go](https://opentelemetry.io/docs/languages/go/) +const TelemetrySdkLanguageGo = "go" + +// TelemetrySdkLanguageJava is a value of AttrTelemetrySdkLanguage: [Java](https://opentelemetry.io/docs/languages/java/) +const TelemetrySdkLanguageJava = "java" + +// TelemetrySdkLanguageKotlin is a value of AttrTelemetrySdkLanguage: [Kotlin](https://opentelemetry.io/docs/languages/kotlin/) +const TelemetrySdkLanguageKotlin = "kotlin" + +// TelemetrySdkLanguageNodejs is a value of AttrTelemetrySdkLanguage: [Node.js](https://opentelemetry.io/docs/languages/js/) +const TelemetrySdkLanguageNodejs = "nodejs" + +// TelemetrySdkLanguagePhp is a value of AttrTelemetrySdkLanguage: [PHP](https://opentelemetry.io/docs/languages/php/) +const TelemetrySdkLanguagePhp = "php" + +// TelemetrySdkLanguagePython is a value of AttrTelemetrySdkLanguage: [Python](https://opentelemetry.io/docs/languages/python/) +const TelemetrySdkLanguagePython = "python" + +// TelemetrySdkLanguageRuby is a value of AttrTelemetrySdkLanguage: [Ruby](https://opentelemetry.io/docs/languages/ruby/) +const TelemetrySdkLanguageRuby = "ruby" + +// TelemetrySdkLanguageRust is a value of AttrTelemetrySdkLanguage: [Rust](https://opentelemetry.io/docs/languages/rust/) +const TelemetrySdkLanguageRust = "rust" + +// TelemetrySdkLanguageSwift is a value of AttrTelemetrySdkLanguage: [Swift](https://opentelemetry.io/docs/languages/swift/) +const TelemetrySdkLanguageSwift = "swift" + +// TelemetrySdkLanguageWebjs is a value of AttrTelemetrySdkLanguage: [Browser](https://opentelemetry.io/docs/languages/js/) +const TelemetrySdkLanguageWebjs = "webjs" + +// AttrTelemetrySdkName is the "telemetry.sdk.name" attribute: The name of the telemetry SDK as defined above. +const AttrTelemetrySdkName = "telemetry.sdk.name" + +// AttrTelemetrySdkVersion is the "telemetry.sdk.version" attribute: The version string of the telemetry SDK. +const AttrTelemetrySdkVersion = "telemetry.sdk.version" + +// Upstream metrics that LiveKit producers create, imported from the registry's dependencies. + +// MetricGenAiExecuteToolDuration is the "gen_ai.execute_tool.duration" metric: The duration of a single tool execution. Instrument: histogram, unit: `s`. +const MetricGenAiExecuteToolDuration = "gen_ai.execute_tool.duration" + +// MetricGenAiExecuteToolDurationUnit is the unit of MetricGenAiExecuteToolDuration, as the upstream definition gives it (empty = none). +const MetricGenAiExecuteToolDurationUnit = "s" + +// MetricGenAiInvokeAgentDuration is the "gen_ai.invoke_agent.duration" metric: The end-to-end duration of a single in-process agent invocation, from the moment the invocation starts until the agent emits the last chunk of its final response or terminates with an error. Instrument: histogram, unit: `s`. +const MetricGenAiInvokeAgentDuration = "gen_ai.invoke_agent.duration" + +// MetricGenAiInvokeAgentDurationUnit is the unit of MetricGenAiInvokeAgentDuration, as the upstream definition gives it (empty = none). +const MetricGenAiInvokeAgentDurationUnit = "s" + +// Event names (OTLP LogRecord.event_name). + +// EventCustom is the "custom" event: Namespace of app-defined events, named `custom.` and carrying the app's own attributes. +const EventCustom = "custom" + +// EventGenAiAssistantMessage is the "gen_ai.assistant.message" event: OTel GenAI assistant message (also a function call), a span event on `llm_node`. +const EventGenAiAssistantMessage = "gen_ai.assistant.message" + +// EventGenAiChoice is the "gen_ai.choice" event: OTel GenAI choice, a span event on `llm_node`. +const EventGenAiChoice = "gen_ai.choice" + +// EventGenAiSystemMessage is the "gen_ai.system.message" event: OTel GenAI system (or developer) message, a span event on `llm_node`. +const EventGenAiSystemMessage = "gen_ai.system.message" + +// EventGenAiToolMessage is the "gen_ai.tool.message" event: OTel GenAI tool message (a function call output), a span event on `llm_node`. +const EventGenAiToolMessage = "gen_ai.tool.message" + +// EventGenAiUserMessage is the "gen_ai.user.message" event: OTel GenAI user message, a span event on `llm_node`. +const EventGenAiUserMessage = "gen_ai.user.message" + +// EventLkDeviceAppStateChanged is the "lk.device.app_state.changed" event: The app moved to the foreground or background. +const EventLkDeviceAppStateChanged = "lk.device.app_state.changed" + +// EventLkDeviceAudioInterruption is the "lk.device.audio.interruption" event: An audio session interruption began or ended. +const EventLkDeviceAudioInterruption = "lk.device.audio.interruption" + +// EventLkDeviceAudioRouteChanged is the "lk.device.audio_route.changed" event: The audio route changed. +const EventLkDeviceAudioRouteChanged = "lk.device.audio_route.changed" + +// EventLkDeviceBatteryChanged is the "lk.device.battery.changed" event: Charging changed, or the level crossed 20 % or 10 % unplugged. +const EventLkDeviceBatteryChanged = "lk.device.battery.changed" + +// EventLkDeviceCaptureFailed is the "lk.device.capture.failed" event: A capture device failed. +const EventLkDeviceCaptureFailed = "lk.device.capture.failed" + +// EventLkDeviceLowPowerChanged is the "lk.device.low_power.changed" event: Low Power Mode changed. +const EventLkDeviceLowPowerChanged = "lk.device.low_power.changed" + +// EventLkDeviceMemoryChanged is the "lk.device.memory.changed" event: Memory pressure changed. +const EventLkDeviceMemoryChanged = "lk.device.memory.changed" + +// EventLkDeviceNetworkChanged is the "lk.device.network.changed" event: The network path changed. +const EventLkDeviceNetworkChanged = "lk.device.network.changed" + +// EventLkDeviceThermalChanged is the "lk.device.thermal.changed" event: Thermal state changed. +const EventLkDeviceThermalChanged = "lk.device.thermal.changed" + +// EventLkPing is the "lk.ping" event: Pipeline smoke test. +const EventLkPing = "lk.ping" + +// EventLkRoomDisconnected is the "lk.room.disconnected" event: The Room left connected for good. +const EventLkRoomDisconnected = "lk.room.disconnected" + +// EventLkRtcStatsSample is the "lk.rtc.stats.sample" event: One RTC stats window for one track and direction. +const EventLkRtcStatsSample = "lk.rtc.stats.sample" + +// EventLkTelemetryReport is the "lk.telemetry.report" event: Self-telemetry; counts since the previous report. +const EventLkTelemetryReport = "lk.telemetry.report" + +// Span names. + +// SpanAgentSession is the "agent_session" span: The agent session, parent of every turn. Kind: internal. +const SpanAgentSession = "agent_session" + +// SpanAgentSpeaking is the "agent_speaking" span: The agent's audio playing out. Kind: internal. +const SpanAgentSpeaking = "agent_speaking" + +// SpanAgentTurn is the "agent_turn" span: One agent turn (generation), parent of the LLM and TTS nodes. Kind: internal. +const SpanAgentTurn = "agent_turn" + +// SpanAmd is the "amd" span: Answering-machine detection on an outbound call. Kind: internal. +const SpanAmd = "amd" + +// SpanDrainAgentActivity is the "drain_agent_activity" span: Draining an agent activity before it ends. Kind: internal. +const SpanDrainAgentActivity = "drain_agent_activity" + +// SpanEouDetection is the "eou_detection" span: One end-of-utterance inference. Kind: internal. +const SpanEouDetection = "eou_detection" + +// SpanEouWait is the "eou_wait" span: The endpointing wait, from the user's last speech to the turn decision. Kind: internal. +const SpanEouWait = "eou_wait" + +// SpanEventLoopBlocked is the "event_loop_blocked" span: A synchronous block on the agent event loop. Kind: internal. +const SpanEventLoopBlocked = "event_loop_blocked" + +// SpanFunctionTool is the "function_tool" span: One function tool execution, the OTel GenAI execute-tool span. Kind: internal. +const SpanFunctionTool = "function_tool" + +// SpanJobEntrypoint is the "job_entrypoint" span: The job's entrypoint, root of a job's trace. Kind: internal. +const SpanJobEntrypoint = "job_entrypoint" + +// SpanJobShutdown is the "job_shutdown" span: The job shutting down. Kind: internal. +const SpanJobShutdown = "job_shutdown" + +// SpanJudgeEvaluation is the "judge_evaluation" span: One LLM-judge evaluation of the session. Kind: internal. +const SpanJudgeEvaluation = "judge_evaluation" + +// SpanKeytermDetection is the "keyterm_detection" span: A keyterm update to the STT. Kind: internal. +const SpanKeytermDetection = "keyterm_detection" + +// SpanLkConnect is the "lk.connect" span: One connect attempt. Kind: client. +const SpanLkConnect = "lk.connect" + +// SpanLkPublish is the "lk.publish" span: One track publish. Kind: internal. +const SpanLkPublish = "lk.publish" + +// SpanLkReconnect is the "lk.reconnect" span: One reconnect cycle. Kind: client. +const SpanLkReconnect = "lk.reconnect" + +// SpanLkSubscribe is the "lk.subscribe" span: One subscription, from the intent to subscribe to the first media. Kind: internal. +const SpanLkSubscribe = "lk.subscribe" + +// SpanLlmFallbackAdapter is the "llm_fallback_adapter" span: The LLM fallback adapter choosing an instance. Kind: internal. +const SpanLlmFallbackAdapter = "llm_fallback_adapter" + +// SpanLlmNode is the "llm_node" span: The agent's LLM node for one generation. Kind: internal. +const SpanLlmNode = "llm_node" + +// SpanLlmRequest is the "llm_request" span: One LLM inference request, the OTel GenAI inference span. Kind: client. +const SpanLlmRequest = "llm_request" + +// SpanLlmRequestRun is the "llm_request_run" span: The LLM request's stream being consumed. Kind: internal. +const SpanLlmRequestRun = "llm_request_run" + +// SpanMetrics is the "metrics" span: A plugin-task metric noted through the Node binding, stamped with its resolved frame. Kind: internal. +const SpanMetrics = "metrics" + +// SpanOnEnter is the "on_enter" span: The agent's `on_enter` hook. Kind: internal. +const SpanOnEnter = "on_enter" + +// SpanOnExit is the "on_exit" span: The agent's `on_exit` hook. Kind: internal. +const SpanOnExit = "on_exit" + +// SpanOnSessionEnd is the "on_session_end" span: The session-end hook. Kind: internal. +const SpanOnSessionEnd = "on_session_end" + +// SpanOnUserTurnCompleted is the "on_user_turn_completed" span: The `on_user_turn_completed` hook. Kind: internal. +const SpanOnUserTurnCompleted = "on_user_turn_completed" + +// SpanPauseAgentActivity is the "pause_agent_activity" span: Pausing an agent activity. Kind: internal. +const SpanPauseAgentActivity = "pause_agent_activity" + +// SpanPublishAudioOutput is the "publish_audio_output" span: Publishing the agent's audio track. Kind: internal. +const SpanPublishAudioOutput = "publish_audio_output" + +// SpanRealtimeInference is the "realtime_inference" span: One realtime-model generation. Kind: client. +const SpanRealtimeInference = "realtime_inference" + +// SpanRealtimeMetrics is the "realtime_metrics" span: Realtime-model metrics attached to a turn. Kind: internal. +const SpanRealtimeMetrics = "realtime_metrics" + +// SpanResumeAgentActivity is the "resume_agent_activity" span: Resuming an agent activity. Kind: internal. +const SpanResumeAgentActivity = "resume_agent_activity" + +// SpanRoomConnect is the "room_connect" span: Connecting the job to its room. Kind: client. +const SpanRoomConnect = "room_connect" + +// SpanRoomDisconnect is the "room_disconnect" span: Disconnecting from the room. Kind: client. +const SpanRoomDisconnect = "room_disconnect" + +// SpanRpcCall is the "rpc_call" span: An outgoing RPC. Kind: client. +const SpanRpcCall = "rpc_call" + +// SpanRpcHandler is the "rpc_handler" span: An incoming RPC handled by the agent. Kind: server. +const SpanRpcHandler = "rpc_handler" + +// SpanSessionClose is the "session_close" span: Closing the session. Kind: internal. +const SpanSessionClose = "session_close" + +// SpanSessionEndUpload is the "session_end_upload" span: Uploading the session report. Kind: internal. +const SpanSessionEndUpload = "session_end_upload" + +// SpanSessionStart is the "session_start" span: Starting the session (room I/O, first activity). Kind: internal. +const SpanSessionStart = "session_start" + +// SpanSetupToolsets is the "setup_toolsets" span: Initializing the agent's tool sets. Kind: internal. +const SpanSetupToolsets = "setup_toolsets" + +// SpanShutdownCallback is the "shutdown_callback" span: One shutdown callback. Kind: internal. +const SpanShutdownCallback = "shutdown_callback" + +// SpanStartAgentActivity is the "start_agent_activity" span: Starting an agent activity. Kind: internal. +const SpanStartAgentActivity = "start_agent_activity" + +// SpanTtsFallbackAdapter is the "tts_fallback_adapter" span: The TTS fallback adapter choosing an instance. Kind: internal. +const SpanTtsFallbackAdapter = "tts_fallback_adapter" + +// SpanTtsNode is the "tts_node" span: The agent's TTS node for one generation. Kind: internal. +const SpanTtsNode = "tts_node" + +// SpanTtsRequest is the "tts_request" span: One TTS request. Kind: client. +const SpanTtsRequest = "tts_request" + +// SpanTtsRequestRun is the "tts_request_run" span: The TTS request's stream being consumed. Kind: internal. +const SpanTtsRequestRun = "tts_request_run" + +// SpanTtsStream is the "tts_stream" span: The Node binding driving `Tts::stream` (the duplex path). Kind: internal. +const SpanTtsStream = "tts_stream" + +// SpanTtsStreamAdapter is the "tts_stream_adapter" span: The sentence-splitting adapter over a non-streaming TTS. Kind: internal. +const SpanTtsStreamAdapter = "tts_stream_adapter" + +// SpanTtsSynthesize is the "tts_synthesize" span: The Node binding driving `Tts::synthesize` (the simplex path). Kind: internal. +const SpanTtsSynthesize = "tts_synthesize" + +// SpanUpdateAgent is the "update_agent" span: Replacing the session's agent. Kind: internal. +const SpanUpdateAgent = "update_agent" + +// SpanUserSpeaking is the "user_speaking" span: The user speaking (VAD). Kind: internal. +const SpanUserSpeaking = "user_speaking" + +// SpanUserTurn is the "user_turn" span: One user turn, from speech to the turn decision. Kind: internal. +const SpanUserTurn = "user_turn" + +// SpanWaitForAudioTrack is the "wait_for_audio_track" span: Waiting for the participant's audio track. Kind: internal. +const SpanWaitForAudioTrack = "wait_for_audio_track" + +// SpanWaitForParticipant is the "wait_for_participant" span: Waiting for the participant to link to. Kind: internal. +const SpanWaitForParticipant = "wait_for_participant" + +// SpanWaitForVideoTrack is the "wait_for_video_track" span: Waiting for the participant's video track. Kind: internal. +const SpanWaitForVideoTrack = "wait_for_video_track" + +// Checkpoint names: span events of the spans above. `lk.reconnect` names its attempts +// `attempt ` instead. + +// CheckpointAgentStateChanged is the "agent_state_changed" checkpoint: The agent state changed (`lk.old_state` -> `lk.new_state`). +const CheckpointAgentStateChanged = "agent_state_changed" + +// CheckpointAnswerSent is the "answer_sent" checkpoint: The subscriber's SDP answer went out. +const CheckpointAnswerSent = "answer_sent" + +// CheckpointEarlyPcCreated is the "early_pc_created" checkpoint: A peer connection was created before the join response (JS port only). +const CheckpointEarlyPcCreated = "early_pc_created" + +// CheckpointEngine is the "engine" checkpoint: The RTC engine is ready (Swift stamps it with pc_connected). +const CheckpointEngine = "engine" + +// CheckpointEntrypointCancelled is the "entrypoint_cancelled" checkpoint: The entrypoint was cancelled. +const CheckpointEntrypointCancelled = "entrypoint_cancelled" + +// CheckpointEntrypointReturned is the "entrypoint_returned" checkpoint: The entrypoint returned. +const CheckpointEntrypointReturned = "entrypoint_returned" + +// CheckpointEntrypointStarted is the "entrypoint_started" checkpoint: The entrypoint started running. +const CheckpointEntrypointStarted = "entrypoint_started" + +// CheckpointEventLoopBlocked is the "event_loop_blocked" checkpoint: A synchronous block on the event loop, with `lk.blocking.duration`; mirrors the span of the same name. +const CheckpointEventLoopBlocked = "event_loop_blocked" + +// CheckpointException is the "exception" checkpoint: The OTel exception event (`exception.*`), recorded on whichever span the exception was caught on; declared here once. +const CheckpointException = "exception" + +// CheckpointFirstFrame is the "first_frame" checkpoint: The first frame arrived. +const CheckpointFirstFrame = "first_frame" + +// CheckpointFirstMedia is the "first_media" checkpoint: The first inbound stats reading with bytes; the span ends ok here. +const CheckpointFirstMedia = "first_media" + +// CheckpointGenAiClientInferenceOperationDetails is the "gen_ai.client.inference.operation.details" checkpoint: OTel GenAI inference details event (the GenAI registry defines it; events cannot be referenced +const CheckpointGenAiClientInferenceOperationDetails = "gen_ai.client.inference.operation.details" + +// CheckpointGeneration is the "generation" checkpoint: One generation started (the generation attributes). +const CheckpointGeneration = "generation" + +// CheckpointJobAccepted is the "job_accepted" checkpoint: The worker accepted the job. +const CheckpointJobAccepted = "job_accepted" + +// CheckpointJobAssigned is the "job_assigned" checkpoint: The server assigned the job. +const CheckpointJobAssigned = "job_assigned" + +// CheckpointJobReceived is the "job_received" checkpoint: The worker received the job request. +const CheckpointJobReceived = "job_received" + +// CheckpointJobStartedOnServer is the "job_started_on_server" checkpoint: The server-side job start time, as the worker learned it. +const CheckpointJobStartedOnServer = "job_started_on_server" + +// CheckpointJoinRecv is the "join_recv" checkpoint: The join response arrived. +const CheckpointJoinRecv = "join_recv" + +// CheckpointOfferSent is the "offer_sent" checkpoint: The publisher's SDP offer went out. +const CheckpointOfferSent = "offer_sent" + +// CheckpointParticipantDisconnected is the "participant_disconnected" checkpoint: The linked participant left the room, with `lk.disconnect_reason`. +const CheckpointParticipantDisconnected = "participant_disconnected" + +// CheckpointParticipantLinked is the "participant_linked" checkpoint: The session linked to its participant. +const CheckpointParticipantLinked = "participant_linked" + +// CheckpointPcConnected is the "pc_connected" checkpoint: The primary peer connection connected. +const CheckpointPcConnected = "pc_connected" + +// CheckpointPcCreated is the "pc_created" checkpoint: The peer connections exist (stamped once the join is adopted). +const CheckpointPcCreated = "pc_created" + +// CheckpointPreConnectAudio is the "pre_connect_audio" checkpoint: Pre-connect audio was replayed, with `lk.pre_connect_audio.duration`. +const CheckpointPreConnectAudio = "pre_connect_audio" + +// CheckpointPreemptiveGenerationDiscarded is the "preemptive_generation_discarded" checkpoint: A preemptive generation was discarded in favour of this one (`lk.speech_id` of the discarded handle). +const CheckpointPreemptiveGenerationDiscarded = "preemptive_generation_discarded" + +// CheckpointProcessAssigned is the "process_assigned" checkpoint: A job process was launched for it. +const CheckpointProcessAssigned = "process_assigned" + +// CheckpointRearmed is the "rearmed" checkpoint: A later trigger re-armed the wait. +const CheckpointRearmed = "rearmed" + +// CheckpointRoomConnected is the "room_connected" checkpoint: The Room reached the connected state. +const CheckpointRoomConnected = "room_connected" + +// CheckpointSignal is the "signal" checkpoint: Signaling is up (stamped with ws_open on the web and with join_recv on Swift). +const CheckpointSignal = "signal" + +// CheckpointStopResponse is the "stop_response" checkpoint: The hook stopped the response. +const CheckpointStopResponse = "stop_response" + +// CheckpointSubscribed is the "subscribed" checkpoint: The platform reported the remote track subscribed. +const CheckpointSubscribed = "subscribed" + +// CheckpointSuperseded is the "superseded" checkpoint: A newer detection superseded this one. +const CheckpointSuperseded = "superseded" + +// CheckpointTrackSubscribed is the "track_subscribed" checkpoint: The track was subscribed, with `lk.track_id` and `lk.track_source`. +const CheckpointTrackSubscribed = "track_subscribed" + +// CheckpointUserResumed is the "user_resumed" checkpoint: The user spoke again during the wait. +const CheckpointUserResumed = "user_resumed" + +// CheckpointUserStateChanged is the "user_state_changed" checkpoint: The user state changed (`lk.old_state` -> `lk.new_state`). +const CheckpointUserStateChanged = "user_state_changed" + +// CheckpointWsOpen is the "ws_open" checkpoint: The signaling WebSocket opened. +const CheckpointWsOpen = "ws_open" + +// Metric names. + +// MetricGenAiClientOperationDuration is the "gen_ai.client.operation.duration" metric: GenAI operation duration, as the GenAI registry defines it (declared here because weaver cannot import it). Instrument: histogram, unit: `s`. +const MetricGenAiClientOperationDuration = "gen_ai.client.operation.duration" + +// MetricGenAiClientOperationDurationUnit is the unit of MetricGenAiClientOperationDuration, exactly as the producer creates the instrument (empty = none). +const MetricGenAiClientOperationDurationUnit = "s" + +// MetricGenAiClientOperationTimeToFirstChunk is the "gen_ai.client.operation.time_to_first_chunk" metric: Time to the first chunk of a streaming GenAI response (deprecated upstream; declared as emitted). Instrument: histogram, unit: `s`. +const MetricGenAiClientOperationTimeToFirstChunk = "gen_ai.client.operation.time_to_first_chunk" + +// MetricGenAiClientOperationTimeToFirstChunkUnit is the unit of MetricGenAiClientOperationTimeToFirstChunk, exactly as the producer creates the instrument (empty = none). +const MetricGenAiClientOperationTimeToFirstChunkUnit = "s" + +// MetricGenAiClientTokenUsage is the "gen_ai.client.token.usage" metric: Input and output tokens used by the GenAI operation (deprecated upstream; declared as emitted). Instrument: histogram, unit: `{token}`. +const MetricGenAiClientTokenUsage = "gen_ai.client.token.usage" + +// MetricGenAiClientTokenUsageUnit is the unit of MetricGenAiClientTokenUsage, exactly as the producer creates the instrument (empty = none). +const MetricGenAiClientTokenUsageUnit = "{token}" + +// MetricLkAgentsConnectionAcquireTime is the "lk.agents.connection.acquire_time" metric: Seconds to acquire a provider connection. Instrument: histogram, unit: `s`. +const MetricLkAgentsConnectionAcquireTime = "lk.agents.connection.acquire_time" + +// MetricLkAgentsConnectionAcquireTimeUnit is the unit of MetricLkAgentsConnectionAcquireTime, exactly as the producer creates the instrument (empty = none). +const MetricLkAgentsConnectionAcquireTimeUnit = "s" + +// MetricLkAgentsEventLoopBlockedDuration is the "lk.agents.event_loop.blocked_duration" metric: Duration of synchronous blocks detected on an agent event loop. Instrument: histogram, unit: `s`. +const MetricLkAgentsEventLoopBlockedDuration = "lk.agents.event_loop.blocked_duration" + +// MetricLkAgentsEventLoopBlockedDurationUnit is the unit of MetricLkAgentsEventLoopBlockedDuration, exactly as the producer creates the instrument (empty = none). +const MetricLkAgentsEventLoopBlockedDurationUnit = "s" + +// MetricLkAgentsTurnE2eLatency is the "lk.agents.turn.e2e_latency" metric: End-to-end latency of a turn. Instrument: histogram, unit: `s`. +const MetricLkAgentsTurnE2eLatency = "lk.agents.turn.e2e_latency" + +// MetricLkAgentsTurnE2eLatencyUnit is the unit of MetricLkAgentsTurnE2eLatency, exactly as the producer creates the instrument (empty = none). +const MetricLkAgentsTurnE2eLatencyUnit = "s" + +// MetricLkAgentsTurnEndOfTurnDelay is the "lk.agents.turn.end_of_turn_delay" metric: Delay from the end of speech to the turn decision. Instrument: histogram, unit: `s`. +const MetricLkAgentsTurnEndOfTurnDelay = "lk.agents.turn.end_of_turn_delay" + +// MetricLkAgentsTurnEndOfTurnDelayUnit is the unit of MetricLkAgentsTurnEndOfTurnDelay, exactly as the producer creates the instrument (empty = none). +const MetricLkAgentsTurnEndOfTurnDelayUnit = "s" + +// MetricLkAgentsTurnLlmTtft is the "lk.agents.turn.llm_ttft" metric: Time to the first LLM token. Instrument: histogram, unit: `s`. +const MetricLkAgentsTurnLlmTtft = "lk.agents.turn.llm_ttft" + +// MetricLkAgentsTurnLlmTtftUnit is the unit of MetricLkAgentsTurnLlmTtft, exactly as the producer creates the instrument (empty = none). +const MetricLkAgentsTurnLlmTtftUnit = "s" + +// MetricLkAgentsTurnOnUserTurnCompletedDelay is the "lk.agents.turn.on_user_turn_completed_delay" metric: Duration of the `on_user_turn_completed` hook. Instrument: histogram, unit: `s`. +const MetricLkAgentsTurnOnUserTurnCompletedDelay = "lk.agents.turn.on_user_turn_completed_delay" + +// MetricLkAgentsTurnOnUserTurnCompletedDelayUnit is the unit of MetricLkAgentsTurnOnUserTurnCompletedDelay, exactly as the producer creates the instrument (empty = none). +const MetricLkAgentsTurnOnUserTurnCompletedDelayUnit = "s" + +// MetricLkAgentsTurnTranscriptionDelay is the "lk.agents.turn.transcription_delay" metric: Delay from the end of speech to the final transcript. Instrument: histogram, unit: `s`. +const MetricLkAgentsTurnTranscriptionDelay = "lk.agents.turn.transcription_delay" + +// MetricLkAgentsTurnTranscriptionDelayUnit is the unit of MetricLkAgentsTurnTranscriptionDelay, exactly as the producer creates the instrument (empty = none). +const MetricLkAgentsTurnTranscriptionDelayUnit = "s" + +// MetricLkAgentsTurnTtsTtfb is the "lk.agents.turn.tts_ttfb" metric: Time to the first TTS byte. Instrument: histogram, unit: `s`. +const MetricLkAgentsTurnTtsTtfb = "lk.agents.turn.tts_ttfb" + +// MetricLkAgentsTurnTtsTtfbUnit is the unit of MetricLkAgentsTurnTtsTtfb, exactly as the producer creates the instrument (empty = none). +const MetricLkAgentsTurnTtsTtfbUnit = "s" + +// MetricLkAgentsUsageInterruptionNumRequests is the "lk.agents.usage.interruption_num_requests" metric: Interruption-detector requests. Instrument: counter, unit: “. +const MetricLkAgentsUsageInterruptionNumRequests = "lk.agents.usage.interruption_num_requests" + +// MetricLkAgentsUsageInterruptionNumRequestsUnit is the unit of MetricLkAgentsUsageInterruptionNumRequests, exactly as the producer creates the instrument (empty = none). +const MetricLkAgentsUsageInterruptionNumRequestsUnit = "" + +// MetricLkAgentsUsageLlmInputAudioTokens is the "lk.agents.usage.llm_input_audio_tokens" metric: Realtime-model audio input tokens. Instrument: counter, unit: “. +const MetricLkAgentsUsageLlmInputAudioTokens = "lk.agents.usage.llm_input_audio_tokens" + +// MetricLkAgentsUsageLlmInputAudioTokensUnit is the unit of MetricLkAgentsUsageLlmInputAudioTokens, exactly as the producer creates the instrument (empty = none). +const MetricLkAgentsUsageLlmInputAudioTokensUnit = "" + +// MetricLkAgentsUsageLlmInputCachedTokens is the "lk.agents.usage.llm_input_cached_tokens" metric: LLM cached input tokens. Instrument: counter, unit: “. +const MetricLkAgentsUsageLlmInputCachedTokens = "lk.agents.usage.llm_input_cached_tokens" + +// MetricLkAgentsUsageLlmInputCachedTokensUnit is the unit of MetricLkAgentsUsageLlmInputCachedTokens, exactly as the producer creates the instrument (empty = none). +const MetricLkAgentsUsageLlmInputCachedTokensUnit = "" + +// MetricLkAgentsUsageLlmInputTextTokens is the "lk.agents.usage.llm_input_text_tokens" metric: Realtime-model text input tokens. Instrument: counter, unit: “. +const MetricLkAgentsUsageLlmInputTextTokens = "lk.agents.usage.llm_input_text_tokens" + +// MetricLkAgentsUsageLlmInputTextTokensUnit is the unit of MetricLkAgentsUsageLlmInputTextTokens, exactly as the producer creates the instrument (empty = none). +const MetricLkAgentsUsageLlmInputTextTokensUnit = "" + +// MetricLkAgentsUsageLlmInputTokens is the "lk.agents.usage.llm_input_tokens" metric: LLM input tokens. Instrument: counter, unit: “. +const MetricLkAgentsUsageLlmInputTokens = "lk.agents.usage.llm_input_tokens" + +// MetricLkAgentsUsageLlmInputTokensUnit is the unit of MetricLkAgentsUsageLlmInputTokens, exactly as the producer creates the instrument (empty = none). +const MetricLkAgentsUsageLlmInputTokensUnit = "" + +// MetricLkAgentsUsageLlmOutputAudioTokens is the "lk.agents.usage.llm_output_audio_tokens" metric: Realtime-model audio output tokens. Instrument: counter, unit: “. +const MetricLkAgentsUsageLlmOutputAudioTokens = "lk.agents.usage.llm_output_audio_tokens" + +// MetricLkAgentsUsageLlmOutputAudioTokensUnit is the unit of MetricLkAgentsUsageLlmOutputAudioTokens, exactly as the producer creates the instrument (empty = none). +const MetricLkAgentsUsageLlmOutputAudioTokensUnit = "" + +// MetricLkAgentsUsageLlmOutputTextTokens is the "lk.agents.usage.llm_output_text_tokens" metric: Realtime-model text output tokens. Instrument: counter, unit: “. +const MetricLkAgentsUsageLlmOutputTextTokens = "lk.agents.usage.llm_output_text_tokens" + +// MetricLkAgentsUsageLlmOutputTextTokensUnit is the unit of MetricLkAgentsUsageLlmOutputTextTokens, exactly as the producer creates the instrument (empty = none). +const MetricLkAgentsUsageLlmOutputTextTokensUnit = "" + +// MetricLkAgentsUsageLlmOutputTokens is the "lk.agents.usage.llm_output_tokens" metric: LLM output tokens. Instrument: counter, unit: “. +const MetricLkAgentsUsageLlmOutputTokens = "lk.agents.usage.llm_output_tokens" + +// MetricLkAgentsUsageLlmOutputTokensUnit is the unit of MetricLkAgentsUsageLlmOutputTokens, exactly as the producer creates the instrument (empty = none). +const MetricLkAgentsUsageLlmOutputTokensUnit = "" + +// MetricLkAgentsUsageLlmSessionDuration is the "lk.agents.usage.llm_session_duration" metric: Realtime-model session seconds. Instrument: counter, unit: `s`. +const MetricLkAgentsUsageLlmSessionDuration = "lk.agents.usage.llm_session_duration" + +// MetricLkAgentsUsageLlmSessionDurationUnit is the unit of MetricLkAgentsUsageLlmSessionDuration, exactly as the producer creates the instrument (empty = none). +const MetricLkAgentsUsageLlmSessionDurationUnit = "s" + +// MetricLkAgentsUsageSttAudioDuration is the "lk.agents.usage.stt_audio_duration" metric: Seconds of audio transcribed. Instrument: counter, unit: `s`. +const MetricLkAgentsUsageSttAudioDuration = "lk.agents.usage.stt_audio_duration" + +// MetricLkAgentsUsageSttAudioDurationUnit is the unit of MetricLkAgentsUsageSttAudioDuration, exactly as the producer creates the instrument (empty = none). +const MetricLkAgentsUsageSttAudioDurationUnit = "s" + +// MetricLkAgentsUsageTtsAudioDuration is the "lk.agents.usage.tts_audio_duration" metric: Seconds of audio synthesized. Instrument: counter, unit: `s`. +const MetricLkAgentsUsageTtsAudioDuration = "lk.agents.usage.tts_audio_duration" + +// MetricLkAgentsUsageTtsAudioDurationUnit is the unit of MetricLkAgentsUsageTtsAudioDuration, exactly as the producer creates the instrument (empty = none). +const MetricLkAgentsUsageTtsAudioDurationUnit = "s" + +// MetricLkAgentsUsageTtsCharacters is the "lk.agents.usage.tts_characters" metric: Characters synthesized. Instrument: counter, unit: “. +const MetricLkAgentsUsageTtsCharacters = "lk.agents.usage.tts_characters" + +// MetricLkAgentsUsageTtsCharactersUnit is the unit of MetricLkAgentsUsageTtsCharacters, exactly as the producer creates the instrument (empty = none). +const MetricLkAgentsUsageTtsCharactersUnit = "" + +// RenamedKeys maps a legacy attribute key to the canonical key that replaces it, from the +// `renamed_from` annotations on the shared keys. A consumer (such as the collector) uses it to +// normalize a legacy key read from an older capture to the key this registry defines. The legacy +// keys are never registered, so they appear only here. +var RenamedKeys = map[string]string{ + "lk.disconnect.reason": "lk.disconnect_reason", + "lk.participant.sid": "lk.participant_id", + "lk.participant.identity": "lk.pii.participant_identity", + "lk.participant.remote_identity": "lk.pii.remote_participant_identity", + "lk.room.name": "lk.pii.room_name", + "lk.room.sid": "lk.room_id", + "lk.track.sid": "lk.track_id", + "lk.track.source": "lk.track_source", +} + +// RenamedValues maps a legacy attribute key to its legacy-value -> canonical-value mapping, for the +// shared keys whose enum values were also renamed. A renamed key whose values did not change is +// absent here; look it up in RenamedKeys only. +var RenamedValues = map[string]map[string]string{ + "lk.disconnect.reason": { + "agent_error": "AGENT_ERROR", + "client_initiated": "CLIENT_INITIATED", + "connection_timeout": "CONNECTION_TIMEOUT", + "duplicate_identity": "DUPLICATE_IDENTITY", + "join_failure": "JOIN_FAILURE", + "media_failure": "MEDIA_FAILURE", + "migration": "MIGRATION", + "participant_removed": "PARTICIPANT_REMOVED", + "reconnect_failed": "RECONNECT_FAILED", + "room_closed": "ROOM_CLOSED", + "room_deleted": "ROOM_DELETED", + "server_shutdown": "SERVER_SHUTDOWN", + "signal_close": "SIGNAL_CLOSE", + "sip_trunk_failure": "SIP_TRUNK_FAILURE", + "state_mismatch": "STATE_MISMATCH", + "unknown": "UNKNOWN_REASON", + "user_rejected": "USER_REJECTED", + "user_unavailable": "USER_UNAVAILABLE", + }, + "lk.track.source": { + "camera": "SOURCE_CAMERA", + "microphone": "SOURCE_MICROPHONE", + "screen_share": "SOURCE_SCREENSHARE", + "screen_share_audio": "SOURCE_SCREENSHARE_AUDIO", + "unknown": "SOURCE_UNKNOWN", + }, +} diff --git a/otel/generate.sh b/otel/generate.sh index 2eb56c336..8e5d0d28f 100755 --- a/otel/generate.sh +++ b/otel/generate.sh @@ -7,7 +7,11 @@ set -euo pipefail cd "$(dirname "$0")" W=${WEAVER:-weaver} tmp=$(mktemp -d) && trap 'rm -rf "$tmp"' EXIT -for target in rust:rust typescript:ts python:python markdown:docs; do +for target in go:go rust:rust typescript:ts python:python markdown:docs; do "$W" registry generate --v2 -r model -p policies -t templates "${target%%:*}" "$tmp/gen/${target#*:}" done +# The Go output is gofmt-canonical, so the committed file matches `gofmt`/`go fmt` and stays +# diff-stable. weaver emits unaligned const and map literals that gofmt would otherwise rewrite; +# the other targets need no such pass. gofmt fails loudly on a template that emits invalid Go. +gofmt -w "$tmp/gen/go" rm -rf gen && mv "$tmp/gen" gen diff --git a/otel/gotest/semconv_test.go b/otel/gotest/semconv_test.go new file mode 100644 index 000000000..36bb5aead --- /dev/null +++ b/otel/gotest/semconv_test.go @@ -0,0 +1,112 @@ +// Copyright 2026 LiveKit, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Package gotest verifies the Weaver-generated Go semantic conventions in +// github.com/livekit/protocol/otel/gen/go. It lives outside otel/gen so otel/generate.sh, which +// replaces otel/gen whole, never deletes it. It encodes the invariants a consumer (such as the +// collector) relies on, so a model or template change that breaks them fails `go test` rather than +// surfacing downstream. +package gotest + +import ( + "testing" + + semconv "github.com/livekit/protocol/otel/gen/go" +) + +// TestConstants spot-checks that representative constants carry the exact OTLP wire strings, so a +// template rename of a Go identifier cannot silently change the value a producer sends. +func TestConstants(t *testing.T) { + cases := map[string]string{ + "AttrLkRoomID": semconv.AttrLkRoomId, + "AttrLkParticipantID": semconv.AttrLkParticipantId, + "AttrLkTrackID": semconv.AttrLkTrackId, + "AttrLkTrackSource": semconv.AttrLkTrackSource, + "AttrLkDisconnectReason": semconv.AttrLkDisconnectReason, + "TrackSourceCamera": semconv.LkTrackSourceSourceCamera, + "SpanLkConnect": semconv.SpanLkConnect, + "EventLkRoomDisconnected": semconv.EventLkRoomDisconnected, + } + want := map[string]string{ + "AttrLkRoomID": "lk.room_id", + "AttrLkParticipantID": "lk.participant_id", + "AttrLkTrackID": "lk.track_id", + "AttrLkTrackSource": "lk.track_source", + "AttrLkDisconnectReason": "lk.disconnect_reason", + "TrackSourceCamera": "SOURCE_CAMERA", + "SpanLkConnect": "lk.connect", + "EventLkRoomDisconnected": "lk.room.disconnected", + } + for name, got := range cases { + if got != want[name] { + t.Errorf("%s = %q, want %q", name, got, want[name]) + } + } +} + +// TestRenamedKeys checks the legacy-key alias map against the eight documented client renames, and +// its structural invariants: a legacy key is never empty, maps to a non-empty canonical key, and is +// never equal to its own canonical key (a rename changes the spelling). +func TestRenamedKeys(t *testing.T) { + want := map[string]string{ + "lk.room.sid": semconv.AttrLkRoomId, + "lk.participant.sid": semconv.AttrLkParticipantId, + "lk.track.sid": semconv.AttrLkTrackId, + "lk.room.name": semconv.AttrLkPiiRoomName, + "lk.participant.identity": semconv.AttrLkPiiParticipantIdentity, + "lk.participant.remote_identity": semconv.AttrLkPiiRemoteParticipantIdentity, + "lk.track.source": semconv.AttrLkTrackSource, + "lk.disconnect.reason": semconv.AttrLkDisconnectReason, + } + if len(semconv.RenamedKeys) != len(want) { + t.Fatalf("RenamedKeys has %d entries, want %d: %v", len(semconv.RenamedKeys), len(want), semconv.RenamedKeys) + } + for legacy, canonical := range want { + got, ok := semconv.RenamedKeys[legacy] + if !ok { + t.Errorf("RenamedKeys is missing legacy key %q", legacy) + continue + } + if got != canonical { + t.Errorf("RenamedKeys[%q] = %q, want %q", legacy, got, canonical) + } + } + for legacy, canonical := range semconv.RenamedKeys { + if legacy == "" || canonical == "" { + t.Errorf("RenamedKeys has an empty mapping %q -> %q", legacy, canonical) + } + if legacy == canonical { + t.Errorf("RenamedKeys[%q] maps to itself", legacy) + } + } +} + +// TestRenamedValues checks the two enums whose values were also renamed, and that every key in +// RenamedValues is also in RenamedKeys (a value remapping implies a key remapping). +func TestRenamedValues(t *testing.T) { + if got := semconv.RenamedValues["lk.track.source"]["camera"]; got != semconv.LkTrackSourceSourceCamera { + t.Errorf("RenamedValues track.source camera = %q, want %q", got, semconv.LkTrackSourceSourceCamera) + } + if got := semconv.RenamedValues["lk.track.source"]["screen_share"]; got != semconv.LkTrackSourceSourceScreenshare { + t.Errorf("RenamedValues track.source screen_share = %q, want %q", got, semconv.LkTrackSourceSourceScreenshare) + } + if got := semconv.RenamedValues["lk.disconnect.reason"]["client_initiated"]; got != semconv.LkDisconnectReasonClientInitiated { + t.Errorf("RenamedValues disconnect.reason client_initiated = %q, want %q", got, semconv.LkDisconnectReasonClientInitiated) + } + for legacy := range semconv.RenamedValues { + if _, ok := semconv.RenamedKeys[legacy]; !ok { + t.Errorf("RenamedValues key %q is not in RenamedKeys", legacy) + } + } +} diff --git a/otel/templates/registry/go/semconv.go.j2 b/otel/templates/registry/go/semconv.go.j2 new file mode 100644 index 000000000..b1cae56f2 --- /dev/null +++ b/otel/templates/registry/go/semconv.go.j2 @@ -0,0 +1,88 @@ +{#- A Go double-quoted string literal: the same escapes as the Rust and Python templates, which Go + reads identically (\\ \" \r \n \t). -#} +{%- macro lit(s) -%} +"{{ s | replace("\\", "\\\\") | replace("\"", "\\\"") | replace("\r", "\\r") | replace("\n", "\\n") | replace("\t", "\\t") }}" +{%- endmacro -%} +{#- One `//` doc line: a newline would break the comment. -#} +{%- macro line(s) -%} +{{ s | trim | replace("\r", " ") | replace("\n", " ") }} +{%- endmacro -%} +{%- macro doc(a) -%} +{{ line(a.brief) }}{% if a.annotations and a.annotations.livekit and a.annotations.livekit.sensitivity == "pii" %} PII: redacted by the collector.{% endif %}{% if a.annotations and a.annotations.livekit and a.annotations.livekit.unit %} Unit: `{{ line(a.annotations.livekit.unit) }}`.{% endif %} +{%- endmacro -%} +{#- An attribute key constant. Go has no namespaces, so an enum's or shipped-value key's values each + become a top-level constant named , next to the key constant. -#} +{%- macro attr(a) -%} +{%- set name = "Attr" ~ (a.key | pascal_case) -%} +// {{ name }} is the {{ lit(a.key) }} attribute: {{ doc(a) }} +const {{ name }} = {{ lit(a.key) }} +{% for m in (a.type.members if a.type is mapping else []) %} +// {{ a.key | pascal_case }}{{ m.id | pascal_case }} is a value of {{ name }}: {{ line(m.brief) or line("`" ~ m.value ~ "`.") }} +const {{ a.key | pascal_case }}{{ m.id | pascal_case }} = {{ lit(m.value) }} +{% endfor %}{% for v in a.shipped_values or [] %} +// {{ a.key | pascal_case }}{{ v.id | pascal_case }} is a value of {{ name }}: {{ line(v.brief) }} Sent by LiveKit, not an upstream value. +const {{ a.key | pascal_case }}{{ v.id | pascal_case }} = {{ lit(v.value) }} +{% endfor %} +{%- endmacro -%} +// Code generated by weaver from livekit/protocol otel/model. DO NOT EDIT. + +// Package semconv is the LiveKit telemetry semantic conventions as Go constants: the attribute +// keys, enum values, event names, span names, checkpoints and metric names LiveKit producers send +// over OTLP, and the legacy-key and legacy-value aliases a consumer uses to normalize an older +// capture to the canonical names (see RenamedKeys and RenamedValues). +package semconv + +{% for a in ctx.attributes %} +{{ attr(a) }}{% endfor %} +// Upstream OTel keys that LiveKit signals reference (defined by the registry's dependencies, never +// here), so a producer can name them from one place. +{% for a in ctx.upstream %} +{{ attr(a) }}{% endfor %}{% if ctx.upstream_metrics %} +// Upstream metrics that LiveKit producers create, imported from the registry's dependencies. +{% for m in ctx.upstream_metrics %} +// Metric{{ m.name | pascal_case }} is the {{ lit(m.name) }} metric: {{ line(m.brief) }} Instrument: {{ m.instrument }}, unit: `{{ line(m.unit or "") }}`. +const Metric{{ m.name | pascal_case }} = {{ lit(m.name) }} + +// Metric{{ m.name | pascal_case }}Unit is the unit of Metric{{ m.name | pascal_case }}, as the upstream definition gives it (empty = none). +const Metric{{ m.name | pascal_case }}Unit = {{ lit(m.unit or "") }} +{% endfor %}{% endif %} +// Event names (OTLP LogRecord.event_name). +{% for e in ctx.events %} +// Event{{ e.name | pascal_case }} is the {{ lit(e.name) }} event: {{ line(e.brief) }} +const Event{{ e.name | pascal_case }} = {{ lit(e.name) }} +{% endfor %} +// Span names. +{% for s in ctx.spans %} +// Span{{ s.type | pascal_case }} is the {{ lit(s.type) }} span: {{ line(s.brief) }} Kind: {{ s.kind }}. +const Span{{ s.type | pascal_case }} = {{ lit(s.type) }} +{% endfor %} +// Checkpoint names: span events of the spans above. `lk.reconnect` names its attempts +// `attempt ` instead. +{% for c in ctx.checkpoints %} +// Checkpoint{{ c.name | pascal_case }} is the {{ lit(c.name) }} checkpoint: {{ line(c.brief) }} +const Checkpoint{{ c.name | pascal_case }} = {{ lit(c.name) }} +{% endfor %}{% if ctx.metrics %} +// Metric names. +{% for m in ctx.metrics %} +// Metric{{ m.name | pascal_case }} is the {{ lit(m.name) }} metric: {{ line(m.brief) }} Instrument: {{ m.instrument }}, unit: `{{ line(m.unit or "") }}`. +const Metric{{ m.name | pascal_case }} = {{ lit(m.name) }} + +// Metric{{ m.name | pascal_case }}Unit is the unit of Metric{{ m.name | pascal_case }}, exactly as the producer creates the instrument (empty = none). +const Metric{{ m.name | pascal_case }}Unit = {{ lit(m.unit or "") }} +{% endfor %}{% endif %} +// RenamedKeys maps a legacy attribute key to the canonical key that replaces it, from the +// `renamed_from` annotations on the shared keys. A consumer (such as the collector) uses it to +// normalize a legacy key read from an older capture to the key this registry defines. The legacy +// keys are never registered, so they appear only here. +var RenamedKeys = map[string]string{ +{% for a in ctx.attributes %}{% set from = a.annotations.livekit.renamed_from %}{% if from %} {{ lit(from.key) }}: {{ lit(a.key) }}, +{% endif %}{% endfor %}} + +// RenamedValues maps a legacy attribute key to its legacy-value -> canonical-value mapping, for the +// shared keys whose enum values were also renamed. A renamed key whose values did not change is +// absent here; look it up in RenamedKeys only. +var RenamedValues = map[string]map[string]string{ +{% for a in ctx.attributes %}{% set from = a.annotations.livekit.renamed_from %}{% if from and from["values"] %} {{ lit(from.key) }}: { +{% for old, new in from["values"] | items %} {{ lit(old) }}: {{ lit(new) }}, +{% endfor %} }, +{% endif %}{% endfor %}} diff --git a/otel/templates/registry/go/weaver.yaml b/otel/templates/registry/go/weaver.yaml new file mode 100644 index 000000000..43ea6d993 --- /dev/null +++ b/otel/templates/registry/go/weaver.yaml @@ -0,0 +1,5 @@ +templates: + - template: semconv.go.j2 + filter: '(.registry.attributes | map(.key)) as $local | {attributes: .registry.attributes | sort_by(.key), upstream: ([.registry.spans[], .registry.events[], .registry.metrics[], .registry.attribute_groups[] | (.attributes // [])[] | select(.key as $k | $local | index($k) | not)] | group_by(.key) | map(.[0] + {shipped_values: ([.[] | (.annotations.livekit.shipped_values // [])[]] | unique_by(.value))})), events: .registry.events | sort_by(.name), spans: .registry.spans | sort_by(.type), checkpoints: [.registry.spans[] | (.annotations.livekit.checkpoints // [])[]] | unique_by(.name), metrics: [.registry.metrics[] | select(.provenance.source == null)] | sort_by(.name), upstream_metrics: [.registry.metrics[] | select(.provenance.source != null)] | sort_by(.name)}' + application_mode: single + file_name: semconv.go diff --git a/otel/tests/generate.sh b/otel/tests/generate.sh index dbe9f3c1c..4bc76c05b 100755 --- a/otel/tests/generate.sh +++ b/otel/tests/generate.sh @@ -9,7 +9,9 @@ cat > "$tmp/weaver" <<'STUB' # weaver registry generate ... target=${@: -2:1} out=${@: -1} [[ $target == "${FAIL_TARGET:-}" ]] && exit 3 -mkdir -p "$out" && echo "new $target" > "$out/semconv.$target" +mkdir -p "$out" +# generate.sh runs gofmt on the go target, so the stub must emit valid Go there. +[[ $target == go ]] && echo "package semconv" > "$out/semconv.$target" || echo "new $target" > "$out/semconv.$target" STUB chmod +x "$tmp/weaver" mkdir -p "$tmp/gen/rust" "$tmp/gen/obsolete-dir" @@ -25,7 +27,7 @@ diff -r "$tmp/before" "$tmp/gen" || { echo "FAIL a failing target changed gen/" WEAVER=$tmp/weaver "$tmp/generate.sh" got=$(cd "$tmp/gen" && find . -mindepth 1 | sort | tr '\n' ' ') -want="./docs ./docs/semconv.markdown ./python ./python/semconv.python ./rust ./rust/semconv.rust ./ts ./ts/semconv.typescript " +want="./docs ./docs/semconv.markdown ./go ./go/semconv.go ./python ./python/semconv.python ./rust ./rust/semconv.rust ./ts ./ts/semconv.typescript " [[ $got == "$want" ]] || { echo "FAIL gen/ after a successful run: $got" >&2; exit 1; } [[ $(cat "$tmp/gen/rust/semconv.rust") == "new rust" ]] || { echo "FAIL gen/ kept an old output" >&2; exit 1; } echo "PASS generate: a failing target leaves gen/ unchanged, a successful run removes obsolete outputs" diff --git a/packages/javascript/build.config.js b/packages/javascript/build.config.js index 578b421ab..5e66d1fa4 100644 --- a/packages/javascript/build.config.js +++ b/packages/javascript/build.config.js @@ -3,6 +3,15 @@ import { defineBuildConfig } from "unbuild"; export default defineBuildConfig({ + // The main barrel, and the Weaver-generated OTEL semantic conventions as a separate + // `@livekit/protocol/semconv` entry. semconv.ts has no imports and no runtime cost, so a + // subpath keeps it out of the protobuf barrel's bundle: importing the constants never pulls + // in @bufbuild/protobuf. src/gen/semconv.ts is copied from otel/gen/ts/semconv.ts by the + // generate:semconv script before this runs. + entries: [ + "src/index", + { input: "src/gen/semconv", name: "semconv" }, + ], declaration: true, sourcemap: true, rollup: { diff --git a/packages/javascript/package.json b/packages/javascript/package.json index 0134b2d46..51fc9fe01 100644 --- a/packages/javascript/package.json +++ b/packages/javascript/package.json @@ -18,14 +18,25 @@ "types": "./dist/index.d.cts", "default": "./dist/index.cjs" } + }, + "./semconv": { + "import": { + "types": "./dist/semconv.d.mts", + "default": "./dist/semconv.mjs" + }, + "require": { + "types": "./dist/semconv.d.cts", + "default": "./dist/semconv.cjs" + } } }, "main": "./dist/index.mjs", "types": "./dist/index.d.mts", "scripts": { "generate:proto": "mkdir -p src/gen && protoc --es_out src/gen --es_opt target=dts+js -I=../../protobufs ../../protobufs/livekit_*.proto ../../protobufs/agent/livekit_*.proto", + "generate:semconv": "mkdir -p src/gen && cp ../../otel/gen/ts/semconv.ts src/gen/semconv.ts", "generate:version": "genversion --esm --semi src/gen/version.js", - "build": "pnpm generate:version && pnpm generate:proto && unbuild" + "build": "pnpm generate:version && pnpm generate:proto && pnpm generate:semconv && unbuild" }, "keywords": [], "author": "LiveKit",