xa.telemetry¶
Named telemetry profiles: where a session’s OTLP trace export goes, and where its credentials live.
A profile is a [telemetry.<name>] table of ~/.config/xa/config.toml; xa spawn
--telemetry <name> (and resume) turns it into an xa.claude_env.OtlpTraces.
[telemetry.lab]
endpoint = "https://otel.example.com/v1/traces"
headers_file = "~/.config/xa/lab.keys" # KEY=VALUE lines, mode 600, yours
export_interval_ms = 5000
content = false # prompts and tool output stay out
[telemetry.lab.resource]
team = "fleet"
[telemetry.lab.headers] # header name = template over the file's keys
Authorization = "Bearer ${LAB_TOKEN}"
Credentials never leave their file. The config holds key names only; the values are
read from headers_file at the moment a pane starts, by the pane’s
own shell (_xa_h="$(xa telemetry-headers lab)" && export OTEL_EXPORTER_OTLP_HEADERS="$_xa_h"). So the
tmux command line, ps, the archive and the logs carry the expression, never the value,
and xa writes no file of its own. A missing key is an error that names the key.
Functions
|
The profile called |
|
Every |
|
Build a profile from its |
|
The |
Classes
|
One named export target: its non-secret settings plus where its headers come from. |
- class xa.telemetry.TelemetryProfile(name, endpoint, protocol='http/protobuf', content=False, resource=dict(), export_interval_ms=None, headers_file=None, headers=dict())[source]¶
Bases:
objectOne named export target: its non-secret settings plus where its headers come from.
- headers_env_value()[source]¶
The value of
OTEL_EXPORTER_OTLP_HEADERS(empty when the profile has no headers).- Return type:
- resolve_headers()[source]¶
{header: value}with each${KEY}read fromheaders_file.The keys file is the only source: a pane’s environment is the tmux server’s, not the caller’s, so an environment fallback would pass here and fail there. Raises
ValueErrornaming the missing key (never a value).- Return type:
- shell_export(*, xa_command=None)[source]¶
The shell fragment that exports the headers in the pane, or
''without headers.It holds a command substitution, never the value.
>>> p = TelemetryProfile('lab', 'http://h/v1/traces', headers={'A': '${K}'}) >>> export = p.shell_export(xa_command=['xa']) >>> export.startswith('_xa_h="$(XA_CONFIG='), 'telemetry-headers lab' in export (True, True)
- Return type:
- xa.telemetry.get_telemetry_profile(name, path=None)[source]¶
The profile called
name; an unknown name lists the known ones. Headers are checked now.Resolving them here means a missing key fails the
xa spawnthat asked, in the caller’s terminal, rather than silently in a pane that exits on start.- Return type:
- xa.telemetry.load_telemetry_profiles(path=None)[source]¶
Every
[telemetry.*]profile of the config file (empty when there is none).- Return type:
- xa.telemetry.profile_from_table(name, raw)[source]¶
Build a profile from its
[telemetry.<name>]table; unknown keys are an error (typos).- Return type: