MCPcopy Create free account
hub / github.com/anthropics/anthropic-sdk-python / FailingProcessor

Class FailingProcessor

tests/test_open_telemetry.py:7888–7902  ·  view source on GitHub ↗

A span processor that raises when a span starts, or else when one ends.

Source from the content-addressed store, hash-verified

7886
7887
7888class FailingProcessor(SpanProcessor):
7889 """A span processor that raises when a span starts, or else when one ends."""
7890
7891 def __init__(self, failure: str) -> None:
7892 self.failure = failure
7893
7894 @override
7895 def on_start(self, span: SdkSpan, parent_context: context.Context | None = None) -> None:
7896 if self.failure == "on_start":
7897 raise RuntimeError("cannot start a span")
7898
7899 @override
7900 def on_end(self, span: ReadableSpan) -> None:
7901 if self.failure == "on_end":
7902 raise RuntimeError("cannot end a span")
7903
7904
7905class FailingSampler(sampling.Sampler):

Callers 1

failing_tracingFunction · 0.85

Calls

no outgoing calls

Tested by 1

failing_tracingFunction · 0.68