Skip to content

Commit

Permalink
Return inner span processor method results
Browse files Browse the repository at this point in the history
  • Loading branch information
garryod committed Apr 18, 2024
1 parent d186a95 commit 2a4caa9
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions src/graph_energy_scan/telemetry.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,17 +18,20 @@ def __init__(self, inner: SpanProcessor, filter_types: list[str]) -> None:
super().__init__()

def on_start(self, span: Span, parent_context: trace.Context | None = None) -> None:
self.inner.on_start(span, parent_context)
return self.inner.on_start(span, parent_context)

def on_end(self, span: ReadableSpan) -> None:
if span.attributes.get("type") not in self.filter_types:
self.inner.on_end(span)
if (
span.attributes is not None
and span.attributes.get("type") not in self.filter_types
):
return self.inner.on_end(span)

def shutdown(self) -> None:
self.inner.shutdown()
return self.inner.shutdown()

def force_flush(self, timeout_millis: int = 30000) -> bool:
self.inner.force_flush(timeout_millis)
return self.inner.force_flush(timeout_millis)


def setup_telemetry(otel_collector_url: str):
Expand Down

0 comments on commit 2a4caa9

Please sign in to comment.