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:
  • service_name (str) – Identifies this dataflow in Jaeger.

  • endpoint (str) – Connection info. Takes precidence over env vars. Defaults to "127.0.0.1:6831".

  • sampling_ratio (float) – Fraction of traces to send between 0.0 and 1.0.

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:
  • service_name (str) – Identifies this dataflow in OTLP.

  • url (str) – Connection info. Defaults to "grpc:://127.0.0.1:4317".

  • sampling_ratio (float) – Fraction of traces to send between 0.0 and 1.0.

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".

Join our community Slack channel

Need some help? Join our community!

If you have any trouble with the process or have ideas about how to improve this document, come talk to us in the #questions-answered Slack channel!

Join now