bytewax.tracing
#
Logging and tracing configuration.
Classes#
- class TracingConfig#
Base class for tracing/logging configuration.
There defines what to do with traces and logs emitted by Bytewax.
Use a specific subclass of this to configure where you want the traces to go.
Initialization
- class JaegerConfig(service_name, endpoint=None, sampling_ratio=1.0)#
- Bases:
Configure tracing to send traces to a Jaeger instance.
The endpoint can be configured with the parameter passed to this config, or with two environment variables:
OTEL_EXPORTER_JAEGER_AGENT_HOST="127.0.0.1" OTEL_EXPORTER_JAEGER_AGENT_PORT="6831"
- Parameters:
Initialization
- property endpoint#
- property sampling_ratio#
- property service_name#
- class OtlpTracingConfig(service_name, url=None, sampling_ratio=1.0)#
- Bases:
Send traces to the OpenTelemetry collector.
See OpenTelemetry collector docs for more info.
Only supports GRPC protocol, so make sure to enable it on your OTEL configuration.
This is the recommended approach since it allows the maximum flexibility in what to do with all the data bytewax can generate.
- Parameters:
Initialization
- property sampling_ratio#
- property service_name#
- property url#
Functions#
- setup_tracing(tracing_config=None, log_level=None)#
Setup Bytewax’s internal tracing and logging.
By default it starts a tracer that logs all
ERROR
-level messages to stdout.Note: To make this work, you have to keep a reference of the returned object.
1from bytewax.tracing import setup_tracing 2 3tracer = setup_tracing()
- Parameters:
tracing_config (TracingConfig) – The specific backend you want to use.
log_level (str) – String of the log level. One of
"ERROR"
,"WARN"
,"INFO"
,"DEBUG"
,"TRACE"
. Defaults to"ERROR"
.