Custom OTLP File Exporter + opentelemetry updates #909
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.
As mentioned in #907, there was an upstream change to
opentelemetry-stdout
's exporter: open-telemetry/opentelemetry-rust#2040. With that change, the exporter lost the ability to send telemetry to a generic writer (like a buffer or file), and also lostjsonl
serialization. This means we can't export in the correct format with newer versions of theopentelemetry
libraries without a new exporter. This PR adds a custom OTLP File Exporter (spec is here) for traces and updates theopentelemetry
libraries to the latest.Based on this comment, and my upstream issue, there is interest in an OTLP File Exporter upstream, so this custom exporter shouldn't live here forever.
This exporter probably isn't quite good enough to upstream yet -- it supports traces, but not metrics or logs.
Bonus changes:
opentelemetry-sdk
0.28
, the batch export functionality no longer requires an async runtime (liketokio
) and instead runs in a separate background thread (some details here), which lowers the dependency overhead for us.metrics
andlogs
features fromopentelemetry
, which we don't use anywayLineWriter
rather than aBufWriter
now. The former is better for our use case -- we want to write complete lines to the file to prevent writing partial json to the file and corrupting it.opentelemetry
. Some things were moved, others renamed. Almost everything uses the builder pattern now.