#[non_exhaustive]pub struct TelemetryConfig {
pub otlp_endpoint: Option<String>,
pub file_path: Option<PathBuf>,
pub exporter_type: Option<OtelExporterType>,
pub source_name: Option<String>,
pub capture_content: Option<bool>,
}Expand description
OpenTelemetry configuration forwarded to the spawned GitHub Copilot CLI process.
When ClientOptions::telemetry is Some(...), the SDK sets
COPILOT_OTEL_ENABLED=true plus any populated fields below as the
corresponding OTEL_* / COPILOT_OTEL_* environment variables. The
CLI’s built-in OpenTelemetry exporter consumes these at startup. The
SDK itself takes no OpenTelemetry dependency.
Environment-variable mapping:
| Field | Variable |
|---|---|
| (any field set) | COPILOT_OTEL_ENABLED=true |
otlp_endpoint | OTEL_EXPORTER_OTLP_ENDPOINT |
file_path | COPILOT_OTEL_FILE_EXPORTER_PATH |
exporter_type | COPILOT_OTEL_EXPORTER_TYPE |
source_name | COPILOT_OTEL_SOURCE_NAME |
capture_content | OTEL_INSTRUMENTATION_GENAI_CAPTURE_MESSAGE_CONTENT |
Caller-supplied entries in ClientOptions::env override these, so a
developer can pin any individual variable to a different value while
keeping the rest of the config managed by TelemetryConfig.
Marked #[non_exhaustive] so future CLI-side telemetry knobs can be
added without breaking callers.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.otlp_endpoint: Option<String>OTLP HTTP endpoint URL for trace/metric export.
file_path: Option<PathBuf>File path for JSON-lines trace output.
exporter_type: Option<OtelExporterType>Exporter backend type. Typically OtelExporterType::OtlpHttp or
OtelExporterType::File.
source_name: Option<String>Instrumentation scope name. Useful for distinguishing this embedder’s traces from other Copilot-CLI consumers exporting to the same backend.
capture_content: Option<bool>Whether the CLI captures GenAI message content (prompts and
responses) on emitted spans. Some(true) opts in; Some(false)
opts out; None leaves the CLI default (typically off).
Implementations§
Source§impl TelemetryConfig
impl TelemetryConfig
Sourcepub fn new() -> Self
pub fn new() -> Self
Construct an empty TelemetryConfig; all fields default to
unset (is_empty() returns true).
Sourcepub fn with_otlp_endpoint(self, endpoint: impl Into<String>) -> Self
pub fn with_otlp_endpoint(self, endpoint: impl Into<String>) -> Self
Set the OTLP HTTP endpoint URL for trace/metric export.
Sourcepub fn with_file_path(self, path: impl Into<PathBuf>) -> Self
pub fn with_file_path(self, path: impl Into<PathBuf>) -> Self
Set the file path for JSON-lines trace output.
Sourcepub fn with_exporter_type(self, exporter_type: OtelExporterType) -> Self
pub fn with_exporter_type(self, exporter_type: OtelExporterType) -> Self
Set the exporter backend type.
Sourcepub fn with_source_name(self, source_name: impl Into<String>) -> Self
pub fn with_source_name(self, source_name: impl Into<String>) -> Self
Set the instrumentation scope name. Useful for distinguishing this embedder’s traces from other Copilot-CLI consumers exporting to the same backend.
Sourcepub fn with_capture_content(self, capture: bool) -> Self
pub fn with_capture_content(self, capture: bool) -> Self
Opt in or out of GenAI message content capture on emitted spans.
true opts in; false opts out. Leaving this unset preserves
the CLI default (typically off).
Sourcepub fn is_empty(&self) -> bool
pub fn is_empty(&self) -> bool
Returns true if all fields are unset. Used by Client::start
to decide whether to set COPILOT_OTEL_ENABLED.
Trait Implementations§
Source§impl Clone for TelemetryConfig
impl Clone for TelemetryConfig
Source§fn clone(&self) -> TelemetryConfig
fn clone(&self) -> TelemetryConfig
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more