Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
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
12 changes: 7 additions & 5 deletions sentry_sdk/integrations/opentelemetry/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -386,22 +386,24 @@ def get_trace_state(span):
options = client.options or {}

trace_state = trace_state.update(
Baggage.SENTRY_PREFIX + "trace_id", format_trace_id(span_context.trace_id)
Baggage.SENTRY_PREFIX + "trace_id",
quote(format_trace_id(span_context.trace_id)),
)

if options.get("environment"):
trace_state = trace_state.update(
Baggage.SENTRY_PREFIX + "environment", options["environment"]
Baggage.SENTRY_PREFIX + "environment", quote(options["environment"])
)

if options.get("release"):
trace_state = trace_state.update(
Baggage.SENTRY_PREFIX + "release", options["release"]
Baggage.SENTRY_PREFIX + "release", quote(options["release"])
)

if options.get("dsn"):
trace_state = trace_state.update(
Baggage.SENTRY_PREFIX + "public_key", Dsn(options["dsn"]).public_key
Baggage.SENTRY_PREFIX + "public_key",
quote(Dsn(options["dsn"]).public_key),
)

root_span = get_sentry_meta(span, "root_span")
Expand All @@ -415,7 +417,7 @@ def get_trace_state(span):
and transaction_source not in LOW_QUALITY_TRANSACTION_SOURCES
):
trace_state = trace_state.update(
Baggage.SENTRY_PREFIX + "transaction", transaction_name
Baggage.SENTRY_PREFIX + "transaction", quote(transaction_name)
)

return trace_state
Expand Down
6 changes: 1 addition & 5 deletions sentry_sdk/tracing.py
Original file line number Diff line number Diff line change
Expand Up @@ -1224,7 +1224,7 @@ def __init__(
# OTel timestamps have nanosecond precision
start_timestamp = convert_to_otel_timestamp(start_timestamp)

span_name = self._sanitize_name(name or description or op or "")
span_name = name or description or op or ""
self._otel_span = tracer.start_span(span_name, start_time=start_timestamp)

self.origin = origin or DEFAULT_SPAN_ORIGIN
Expand Down Expand Up @@ -1598,10 +1598,6 @@ def set_context(self, key, value):

self.set_attribute(f"{SentrySpanAttribute.CONTEXT}.{key}", value)

def _sanitize_name(self, name):
"""No commas and equals allowed in tracestate."""
return name.replace(",", "").replace("=", "")


if TYPE_CHECKING:

Expand Down
Loading