Struct TelemetryConfig
pub struct TelemetryConfig {
pub logging_enabled: bool,
pub log_filter: String,
pub json_logs: bool,
pub metrics_enabled: bool,
pub metrics_addr: Option<String>,
pub otel_traces: bool,
pub otel_metrics: bool,
pub otel_service_name: String,
pub otel_gcp_project: Option<String>,
}Expand description
Telemetry configuration.
Fields§
§logging_enabled: boolEnable structured logging.
log_filter: StringLog level filter (e.g., “info”, “debug”, “gemini_genai_rs=debug”).
json_logs: boolUse JSON format for logs (production). If false, uses pretty format (development).
metrics_enabled: boolEnable Prometheus metrics endpoint.
metrics_addr: Option<String>Prometheus listen address (e.g., “0.0.0.0:9090”).
otel_traces: boolEnable OTel trace export (requires otel-otlp or otel-gcp feature).
otel_metrics: boolEnable OTel metrics export (requires otel-otlp or otel-gcp feature).
otel_service_name: StringOTel service name for resource identification.
otel_gcp_project: Option<String>Google Cloud project ID for GCP-native OTel export. If None, auto-detects from ADC or environment.
Implementations§
§impl TelemetryConfig
impl TelemetryConfig
pub fn init(&self) -> Result<TelemetryGuard, Box<dyn Error>>
pub fn init(&self) -> Result<TelemetryGuard, Box<dyn Error>>
Initialize telemetry subsystems based on configuration.
When otel-otlp is enabled and otel_traces/otel_metrics are set,
this configures OTLP exporters that send data to whatever endpoint is set
via the standard OTEL_EXPORTER_OTLP_ENDPOINT env var (defaults to
http://localhost:4317 for gRPC).
When otel-gcp is enabled, use init_gcp() to set up Google Cloud-native
exporters, or configure providers manually and call init_with_tracer().
The returned TelemetryGuard must be held alive for the duration of the
application. Dropping it triggers a flush and shutdown of all exporters.
Trait Implementations§
§impl Clone for TelemetryConfig
impl Clone for TelemetryConfig
§fn clone(&self) -> TelemetryConfig
fn clone(&self) -> TelemetryConfig
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more