-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtelemetry.env.example
More file actions
51 lines (44 loc) · 2.12 KB
/
Copy pathtelemetry.env.example
File metadata and controls
51 lines (44 loc) · 2.12 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
# Source this file in the shell that runs Claude Code.
#
# Exports metrics, logs, and beta traces. Claude Code emits native cost data, so
# it needs no collector-side cost estimation. OTEL_AUTH_TOKEN must match the
# collector token.
#
# Docs: https://code.claude.com/docs/en/monitoring-usage
# --- master switch ---
export CLAUDE_CODE_ENABLE_TELEMETRY=1
# --- signal exporters ---
export OTEL_METRICS_EXPORTER=otlp
export OTEL_LOGS_EXPORTER=otlp
# Traces are beta and off by default; this pair turns the span tree on.
export CLAUDE_CODE_ENHANCED_TELEMETRY_BETA=1
export OTEL_TRACES_EXPORTER=otlp
# --- transport ---
# The collector exposes OTLP HTTP only, so force http/protobuf.
# Claude Code appends /v1/metrics, /v1/logs, /v1/traces to the endpoint automatically.
export OTEL_EXPORTER_OTLP_PROTOCOL=http/protobuf
export OTEL_EXPORTER_OTLP_ENDPOINT=http://localhost:4318
export OTEL_EXPORTER_OTLP_HEADERS="Authorization=Bearer ${OTEL_AUTH_TOKEN}"
# --- temporality (REQUIRED) ---
# Claude Code defaults to delta temporality; the collector's prometheusremotewrite
# exporter silently drops delta points. Cumulative is mandatory or no metric lands.
export OTEL_EXPORTER_OTLP_METRICS_TEMPORALITY_PREFERENCE=cumulative
# --- export intervals ---
# The 10-second metric interval leaves enough samples for the dashboard's
# one-minute buckets and gives faster setup feedback.
export OTEL_METRIC_EXPORT_INTERVAL=10000
export OTEL_LOGS_EXPORT_INTERVAL=5000
# --- attribute / cardinality control ---
# Keep version on metrics for per-release comparison; leave session id on for per-session
# rollups (single-user fleet, cardinality is fine). Flip these off if cardinality grows.
export OTEL_METRICS_INCLUDE_VERSION=true
# export OTEL_METRICS_INCLUDE_SESSION_ID=false
# export OTEL_METRICS_INCLUDE_ACCOUNT_UUID=false
# --- privacy ---
# Leave these unset to keep content out of logs and trace attributes. Uncomment
# only if you accept storing that content in VictoriaLogs or VictoriaTraces.
# export OTEL_LOG_USER_PROMPTS=1
# export OTEL_LOG_ASSISTANT_RESPONSES=1
# export OTEL_LOG_TOOL_DETAILS=1
# export OTEL_LOG_TOOL_CONTENT=1
# export OTEL_LOG_RAW_API_BODIES=1