Skip to content

feat(spans): Reintroduce OTLP endpoint - #4223

Merged
jjbayer merged 17 commits into
masterfrom
feat/spans-otel-endpoint
Nov 19, 2024
Merged

jjbayer merged 17 commits into
masterfrom
feat/spans-otel-endpoint

Conversation

@jjbayer

@jjbayer jjbayer commented Nov 5, 2024 •

Copy link
Copy Markdown
Member

Restore the OTLP endpoint that was removed in #3973.

This PR moves the parsing of the trace data to the processor to ensure fast response times.

I also renamed the endpoint from /spans/ to /otlp/v1/traces/ to be consistent with https://opentelemetry.io/docs/languages/sdk-configuration/otlp-exporter/#otel_exporter_otlp_endpoint.

fixes: https://github.com/getsentry/team-ingest/issues/569

@jjbayer
jjbayer marked this pull request as ready for review November 6, 2024 09:21
@jjbayer
jjbayer requested a review from a team as a code owner November 6, 2024 09:21
Comment thread relay-server/src/endpoints/mod.rs Outdated
.route("/api/:project_id/minidump/", minidump::route(config))
.route("/api/:project_id/events/:event_id/attachments/", post(attachments::handle))
.route("/api/:project_id/unreal/:sentry_key/", unreal::route(config))
.route("/api/:project_id/traces-data/", traces_data::route(config))

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is it currently "traces-data"?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In the previous impl it was /spans/ i wanted to name it after the data type it accepts (TracesData) to be consistent with /minidump/, /csp-report/, etc. But reading the link above a bit more, we should maybe even name it /otel/v1/traces/ to be future proof.

For OTLP/HTTP, exporters in the SDK construct signal-specific URLs when this environment variable is set. This means that if you’re sending traces, metrics, and logs, the following URLs are constructed from the example above:

Traces: "http://my-api-endpoint/v1/traces"
Metrics: "http://my-api-endpoint/v1/metrics"
Logs: "http://my-api-endpoint/v1/logs"

https://opentelemetry.io/docs/languages/sdk-configuration/otlp-exporter/#otel_exporter_otlp_endpoint

Comment thread relay-server/src/endpoints/mod.rs Outdated
.route("/api/:project_id/minidump/", minidump::route(config))
.route("/api/:project_id/events/:event_id/attachments/", post(attachments::handle))
.route("/api/:project_id/unreal/:sentry_key/", unreal::route(config))
.route("/api/:project_id/traces-data/", traces_data::route(config))

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is it currently "traces-data"?

Comment thread relay-server/src/envelope.rs Resolved
@jjbayer
jjbayer marked this pull request as draft November 7, 2024 15:25
@jjbayer

jjbayer commented Nov 7, 2024

Copy link
Copy Markdown
Member Author

Converting back to draft, unclear if needed.

@jjbayer jjbayer removed their assignment Nov 8, 2024
@jjbayer jjbayer closed this Nov 12, 2024
@jjbayer jjbayer reopened this Nov 15, 2024
@jjbayer jjbayer self-assigned this Nov 15, 2024
@jjbayer
jjbayer marked this pull request as ready for review November 15, 2024 10:40
@jjbayer
jjbayer enabled auto-merge (squash) November 18, 2024 09:07
@jjbayer
jjbayer merged commit 1c16ca3 into master Nov 19, 2024
@jjbayer
jjbayer deleted the feat/spans-otel-endpoint branch November 19, 2024 12:03
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}"
```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants