TracingConfig#

pydantic model ray.serve.schema.TracingConfig[source]#

Tracing config schema for configuring distributed tracing on Serve components.

Example

from ray import serve
from ray.serve.schema import TracingConfig

# Enable tracing with default exporter
serve.start(tracing_config=TracingConfig(enabled=True))

Tracing configuration is fixed when Serve starts. To change it, shut down and restart Serve with the new config.

Fields you don’t set default from the RAY_SERVE_TRACING_* environment variables of the Serve controller, which can be set through controller_options.runtime_env.env_vars.

PublicAPI (alpha): This API is in alpha and may change before becoming stable.

field enabled: bool [Optional]#

Whether tracing is enabled. Defaults to True when the RAY_SERVE_TRACING_EXPORTER_IMPORT_PATH environment variable is set. When enabled, spans will be exported using the configured exporter.

field exporter_import_path: str [Optional]#

Import path to a tracing exporter function. Defaults to the RAY_SERVE_TRACING_EXPORTER_IMPORT_PATH environment variable, or the built-in file-based exporter if it isn’t set. Must not be empty. A custom exporter takes no arguments and returns a list of SpanProcessors. When Serve starts, the controller calls it once to validate it and then shuts the returned processors down, so it must return promptly.

field sampling_ratio: float [Optional]#

Sampling ratio for traces (0.0 to 1.0). Defaults to the RAY_SERVE_TRACING_SAMPLING_RATIO environment variable (0.01, i.e. 1%).

validator validate_exporter_import_path  »  exporter_import_path[source]#
validator validate_sampling_ratio  »  sampling_ratio[source]#