glide_shared.opentelemetry
OpenTelemetry configuration classes shared between async and sync clients.
OpenTelemetry can only be initialized once per process. Calling OpenTelemetry.init() more than once will be ignored. If you need to change configuration, restart the process with new settings.
OpenTelemetry Configuration
OpenTelemetryConfig: Main configuration object for OpenTelemetry exporters and options.
-
traces: (optional) Configure trace exporting using OpenTelemetryTracesConfig.
-
endpoint: The collector endpoint for traces. Supported protocols: http://, https:// for HTTP/HTTPS, grpc:// for gRPC, file:// for local file export
-
sample_percentage: (optional) The percentage of requests to sample (0-100). Defaults to 1. Note: Higher sampling percentages impact performance. Recommended: 1-5% in production.
-
metrics: (optional) Configure metrics exporting using OpenTelemetryMetricsConfig.
-
endpoint: The collector endpoint for metrics. Same protocol rules as above.
-
flush_interval_ms: (optional) Interval in milliseconds for flushing data. Defaults to 5000ms.
File Exporter Details
For file:// endpoints:
- Path must start with file:// (e.g., file:///tmp/otel or file:///tmp/otel/traces.json)
- If path is a directory or lacks extension, data is written to signals.json in that directory
- If path includes filename with extension, that file is used as-is
- Parent directory must exist; otherwise initialization fails with InvalidInput error
- If target file exists, new data is appended (not overwritten)
Validation Rules
- flush_interval_ms must be a positive integer
- sample_percentage must be between 0 and 100
- File exporter paths must start with file:// and have an existing parent directory
- Invalid configuration will throw an error when calling OpenTelemetry.init()
OpenTelemetryTracesConfig
Configuration for exporting OpenTelemetry traces.
Source code in doc-gen/valkey-glide/python/glide-shared/glide_shared/opentelemetry.py
51 52 53 54 55 56 57 58 59 60 61 62 63 64 | |
OpenTelemetryMetricsConfig
Configuration for exporting OpenTelemetry metrics.
Source code in doc-gen/valkey-glide/python/glide-shared/glide_shared/opentelemetry.py
67 68 69 70 71 72 73 74 | |
OpenTelemetryConfig
Configuration for OpenTelemetry integration.
Source code in doc-gen/valkey-glide/python/glide-shared/glide_shared/opentelemetry.py
77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 | |