-
Notifications
You must be signed in to change notification settings - Fork 1.9k
feat(opentelemetry source): Add JSON support #22963
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
base: master
Are you sure you want to change the base?
Conversation
lib/opentelemetry-proto/build.rs
Outdated
| @@ -1,9 +1,100 @@ | |||
| use std::io::Error; | |||
|
|
|||
| // NOTE: Serde related attributes are copied from https://github.com/open-telemetry/opentelemetry-rust/ | |||
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.
Is this an issue wrt the CLA and licenses?
I initially started on an implementation and its ended up very similar (don't think tonic and serde offer an alternative way). Figured that copying it is easier as it makes it easier to sync if otel changes
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.
I think that if this file is copied from the elsewhere then their license needs to be pasted in there
1720078 to
ffe54be
Compare
|
Hi @fbs, I was going over open PRs. Are you still motivated to contribute this? |
This will allow us to support json in a later stage, as the content type of the reply must match what the client used in the request. This also improves error messages a bit, as its now a 415 instead of a 500. A 500 internal server error is quite confusing when debugging. There is no error with the server, its the client sending the wrong request.
This tests the expected behaviour of the Open Telemetry source wrt error handling. Currently vector mostly sends 500 Internal Server errors, which isnt that helpful when debugging. It also means some retryable errors are not retried. The source implementation is done in the next step, so all tests fail.
Reject and recover indicates that the current filter didn't match but that others might[1]. This means reject is not the appropriate tool for handling e.g. deserialization errors. This commit migrates from rejection to returning the reply directly, and at the same time updates it to the new status codes to make sure it passes the new tests. This change also makes it possible to support `application/json` in the future. The `content-type` of the reply must match that of the request, and as we now have access to the request headers we can make sure they match. [1]: seanmonstar/warp#388 (comment)
Opentelemtry allows both binary protobuf as well as JSON protobuf when using the HTTP transport. This commit adds support. The implementation is basically stolen from opentelemetry-rust[1], so all go credits to them. [1]: https://github.com/open-telemetry/opentelemetry-rust
This adds the ability to serialize, part of, Status to JSON. The main usecase is to support Opentelemetry with HTTP/JSON and is thus tailored to that. As otel doesn't currently use 'detailed' that is skipped.
Seems like both are allowed, so we need to support it
|
Hi @fbs I'll make this a draft and we can re-open it once the dependent PR gets merged |
|
Note that protobuf codecs now have new options and we also provide native OTLP support ( |
This PR builds on #22957.
Once that is accepted I'll rebase this onto that. Opening this to show how the content-type handling from #22957 fits in.
This PR 'starts at'
otel-proto: support json serializationSummary
This adds JSON Protobuf encoding support to the open telemetry source. The PR has two main parts:
Change Type
Is this a breaking change?
How did you test this PR?
Both sending actual logs as well as with test cases
Does this PR include user facing changes?
Notes
@vectordotdev/vectorto reach out to us regarding this PR.pre-pushhook, please see this template.cargo fmt --allcargo clippy --workspace --all-targets -- -D warningscargo nextest run --workspace(alternatively, you can runcargo test --all)./scripts/check_changelog_fragments.shgit merge origin masterandgit push.Cargo.lock), pleaserun
cargo vdev build licensesto regenerate the license inventory and commit the changes (if any). More details here.References
#22940
TODO
[] make sure traces and metrics have a test