Repository navigation
feat(ourlogs): Add otel log to sentry log transform - #5128
Merged
Merged
Conversation
AbhiPrasad
force-pushed
the
abhi-relay-otel-pkg
branch
from
September 9, 2025 20:12
3e878a7 to
939727d
Compare
AbhiPrasad
force-pushed
the
abhi-relay-otel-pkg
branch
from
September 9, 2025 20:23
939727d to
b21f64d
Compare
AbhiPrasad
force-pushed
the
abhi-relay-otel-pkg
branch
from
September 9, 2025 20:58
b21f64d to
c217662
Compare
jjbayer
reviewed
Sep 10, 2025
| use relay_otel::otel_value_to_attribute; | ||
| use relay_protocol::{Annotated, Error, Object}; | ||
|
|
||
| fn otel_value_to_string(value: Option<opentelemetry_proto::tonic::common::v1::AnyValue>) -> String { |
Member
There was a problem hiding this comment.
Should this return Option<String>? So body can later be an empty Annotated.
Comment on lines
+36
to
+38
| // Filter out nested arrays and key-value lists for safety. | ||
| // This is not usually allowed by the OTLP protocol, but we filter | ||
| // these values out before serializing for robustness. |
Member
There was a problem hiding this comment.
What's the reason we do not skip these values like we did before?
Contributor
Author
There was a problem hiding this comment.
We always had the filter_map filtering, are you referring to the added KvlistValue logic?
KvlistValue value attributes exist on logs, but not spans so this branch needed to be added.
Member
There was a problem hiding this comment.
Yep sorry, I commented on the wrong section.
jjbayer
approved these changes
Sep 11, 2025
Comment on lines
+36
to
+38
| // Filter out nested arrays and key-value lists for safety. | ||
| // This is not usually allowed by the OTLP protocol, but we filter | ||
| // these values out before serializing for robustness. |
Member
There was a problem hiding this comment.
Yep sorry, I commented on the wrong section.
github-merge-queue Bot
pushed a commit
that referenced
this pull request
Sep 15, 2025
resolves #5111 Building on top of #5128, this PR adds an OTLP endpoint for logs. Much of this approach was inspired by #4223. To use this endpoint, you'll need to provide the following environmental variables (where `DSN_PROJECT_ID` and `DSN_PUBLIC_KEY` are grabbed from the DSN) when setting up your OTEL setup. An integration test was added to `tests/integration/test_otlp_logs.py` to show this working. ```sh OTEL_EXPORTER_OTLP_LOGS_ENDPOINT="https://{HOST}/api/{DSN_PROJECT_ID}/otlp/v1/logs" OTEL_EXPORTER_OTLP_HEADERS="x-sentry-auth=sentry sentry_key={DSN_PUBLIC_KEY}" ```
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
#skip-changelog
As per #5111, we'd like to add an OTLP logs endpoint to Relay. More details on the motivation can be found in this internal notion doc: https://www.notion.so/sentry/Logs-OTLP-Endpoint-2638b10e4b5d8050a147d0dd46df1915 (contains screenshots so can't put them in GH).
Before we implement the endpoint itself, this PR adds a
otel_to_sentry_logto therelay-ourlogscrate.otel_to_sentry_logis a cleaned up version of the otel log to sentry log transform we had previously implemented and then removed in #5082.To make the
otel_to_sentry_log, I extracted out aotel_value_to_attrfrom therelay-spanscrate into arelay-otelcrate. Not sure if this is the correct level of abstraction, would appreciate feedback.Skipping changelog as this does not expose any user facing changes, only new methods and refactors. Once I add the endpoint in a future PR, I will add a changelog there.