Add pydocstyle to the ruff rules (#52136)
Signed-off-by: Harry Mellor <19981378+hmellor@users.noreply.github.com> Signed-off-by: Harry Mellor <hej.mellor@gmail.com> Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5
parent
804e5377aa
commit
8c1557a79c
@@ -107,9 +107,7 @@ def init_otel_worker_tracer(
|
||||
process_kind: str,
|
||||
process_name: str,
|
||||
) -> Tracer:
|
||||
"""
|
||||
Backend-specific initialization for OpenTelemetry in a worker process.
|
||||
"""
|
||||
"""Backend-specific initialization for OpenTelemetry in a worker process."""
|
||||
# Initialize the tracer if an OTLP endpoint is configured.
|
||||
# The endpoint is propagated via environment variable from the main process.
|
||||
otlp_endpoint = os.environ.get("OTEL_EXPORTER_OTLP_TRACES_ENDPOINT")
|
||||
@@ -133,7 +131,6 @@ def extract_trace_context(headers: Mapping[str, str] | None) -> Context | None:
|
||||
|
||||
def instrument_otel(func, span_name, attributes, record_exception):
|
||||
"""Internal wrapper logic for sync and async functions."""
|
||||
|
||||
# Pre-calculate static code attributes once (these don't change)
|
||||
code_attrs = {
|
||||
LoadingSpanAttributes.CODE_FUNCTION: func.__qualname__,
|
||||
@@ -214,8 +211,7 @@ def manual_instrument_otel(
|
||||
|
||||
|
||||
def _get_smart_context() -> Context | None:
|
||||
"""
|
||||
Determines the parent context.
|
||||
"""Determines the parent context.
|
||||
1. If a Span is already active in this process, use it.
|
||||
2. If not, extract from os.environ, handling the case-sensitivity mismatch.
|
||||
"""
|
||||
@@ -239,8 +235,7 @@ def _get_smart_context() -> Context | None:
|
||||
|
||||
@contextmanager
|
||||
def propagate_trace_to_env():
|
||||
"""
|
||||
Temporarily injects the current OTel context into os.environ.
|
||||
"""Temporarily injects the current OTel context into os.environ.
|
||||
This ensures that any subprocesses (like vLLM workers) spawned
|
||||
within this context inherit the correct traceparent.
|
||||
"""
|
||||
|
||||
Reference in New Issue
Block a user