Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Drop sampled spans #135

Merged
merged 2 commits into from
Jun 2, 2023
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 16 additions & 1 deletion troncos/tracing/_writer.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,13 +41,28 @@ def recreate(self) -> "OTELWriter":
)

def write(self, spans: list[Span] | None = None) -> None:
if not spans:
return

filtered_spans = [
span
for span in spans
# ddtrace uses sampling_priority > 0 to indicate that we
# want to ingest the span.
if span.context.sampling_priority is None
or span.context.sampling_priority > 0
]

if not filtered_spans:
return

transelated_spans = [
translate_span(
span,
default_resource=self.otel_default_resource,
ignore_attrs=self.otel_ignore_attrs,
)
for span in spans or []
for span in filtered_spans
]

for span_processor in self.otel_span_processors:
Expand Down