-
Notifications
You must be signed in to change notification settings - Fork 94
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
feat(spans): Reintroduce OTLP endpoint #4223
Merged
Merged
Changes from 11 commits
Commits
Show all changes
17 commits
Select commit
Hold shift + click to select a range
5a2d43e
Revert "ref(spans): Remove the otel spans endpoint (#3973)"
jjbayer 2f630de
fix test
jjbayer 15d18d1
ref: remove parsing from endpoint
jjbayer b1eeca4
wip: span-like trait
jjbayer cff6e55
Revert "wip: span-like trait"
jjbayer 7bc1c31
wip
jjbayer 69246fd
wip
jjbayer b3079f0
basics
jjbayer d0a5870
rename
jjbayer d35cd5f
max endpoint size = max envelope size
jjbayer bcbc4cb
lint
jjbayer d74014a
prefix endpoint
jjbayer be740a7
review comments
jjbayer ea95b59
log debug
jjbayer 02dc926
doc: changelog
jjbayer 64eb035
Merge remote-tracking branch 'origin/master' into feat/spans-otel-end…
jjbayer 40e8559
fix: Consider otel traces data as span quantity, even if quantity() i…
jjbayer File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
use axum::extract::{DefaultBodyLimit, Request}; | ||
use axum::http::StatusCode; | ||
use axum::response::IntoResponse; | ||
use axum::routing::{post, MethodRouter}; | ||
use axum::RequestExt; | ||
use bytes::Bytes; | ||
use relay_config::Config; | ||
use relay_dynamic_config::Feature; | ||
|
||
use crate::endpoints::common; | ||
use crate::envelope::{ContentType, Envelope, Item, ItemType}; | ||
use crate::extractors::{RawContentType, RequestMeta}; | ||
use crate::service::ServiceState; | ||
|
||
async fn handle( | ||
state: ServiceState, | ||
content_type: RawContentType, | ||
meta: RequestMeta, | ||
request: Request, | ||
) -> axum::response::Result<impl IntoResponse> { | ||
let content_type @ (ContentType::Json | ContentType::Protobuf) = | ||
ContentType::from(content_type.as_ref()) | ||
else { | ||
return Ok(StatusCode::UNSUPPORTED_MEDIA_TYPE); | ||
}; | ||
let payload: Bytes = request.extract().await?; | ||
let mut envelope = Envelope::from_request(None, meta); | ||
envelope.require_feature(Feature::OtelEndpoint); | ||
|
||
envelope.add_item({ | ||
let mut item = Item::new(ItemType::OtelTracesData); | ||
item.set_payload(content_type, payload); | ||
item | ||
}); | ||
|
||
common::handle_envelope(&state, envelope).await?; | ||
|
||
Ok(StatusCode::ACCEPTED) | ||
} | ||
|
||
pub fn route(config: &Config) -> MethodRouter<ServiceState> { | ||
post(handle).route_layer(DefaultBodyLimit::max(config.max_envelope_size())) | ||
} |
Oops, something went wrong.
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Rename to
/traces/
to be consistent with https://opentelemetry.io/docs/languages/sdk-configuration/otlp-exporter/#otel_exporter_otlp_traces_protocol?There was a problem hiding this comment.
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"?
There was a problem hiding this comment.
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.https://opentelemetry.io/docs/languages/sdk-configuration/otlp-exporter/#otel_exporter_otlp_endpoint