-
Notifications
You must be signed in to change notification settings - Fork 100
Initial implementation of OTLP HTTP Exporter #2070
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
Merged
albertlockett
merged 26 commits into
open-telemetry:main
from
albertlockett:albert/1145
Feb 20, 2026
Merged
Changes from 25 commits
Commits
Show all changes
26 commits
Select commit
Hold shift + click to select a range
16eba29
add OTLP http exporter
albertlockett abf8289
finished unit test for OTLP export
albertlockett 084f7a2
lots of debugging trying to figure out how I screwed up Ack/Nack
albertlockett 10cbed3
added tests for nack on non-200 and connect refuse
albertlockett ad5c4c7
added test for partial success
albertlockett f328b7c
add test for invalid decoding
albertlockett c64b7fd
finished tests aside from metrics
albertlockett 87c1400
fix clippies and tests
albertlockett 1ef4231
cleanup TODOs
albertlockett 04a69e0
document replace_bytes method
albertlockett 750298a
cargo fmt
albertlockett 7620115
changed urn to use otel_http with underscore character
albertlockett c36df31
avoid copying OTLP bytes request for body
albertlockett 1a7db4b
enforce maximum size of response body
albertlockett dba527f
Merge branch 'main' into albert/1145
lalitb 03166d9
PR feedback about dropping invalid OTAP batch on nack
albertlockett 185a2e0
add Accept header to request
albertlockett 348f9f3
generic from replace_bytes
albertlockett bd8459d
validate endpoint in constructor
albertlockett 68be325
add musl gcc to fix perf test build
albertlockett 3bb9a33
better handling for non-retryable errors
albertlockett 4479371
Removed useless assertion
albertlockett 4ad24a4
remove uneeded assertion
albertlockett 9ca950a
Update rust/otap-dataflow/crates/otap/src/otlp_http/client_settings.rs
albertlockett de60ec3
PR feedback
albertlockett d502fcb
remove comments
albertlockett 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
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
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
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
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
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
90 changes: 90 additions & 0 deletions
90
rust/otap-dataflow/crates/otap/src/otlp_http/client_settings.rs
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,90 @@ | ||
| // Copyright The OpenTelemetry Authors | ||
| // SPDX-License-Identifier: Apache-2.0 | ||
|
|
||
| //! Shared configuration for HTTP-based clients. | ||
|
|
||
| use reqwest::ClientBuilder; | ||
| use serde::Deserialize; | ||
| use std::time::Duration; | ||
| use tower::limit::ConcurrencyLimitLayer; | ||
|
|
||
| use crate::otap_grpc::client_settings::{ | ||
| default_concurrency_limit, default_connect_timeout, default_tcp_keepalive, default_tcp_nodelay, | ||
| }; | ||
|
|
||
| /// Common configuration shared across HTTP clients. | ||
| #[derive(Debug, Deserialize, Clone)] | ||
| #[serde(deny_unknown_fields)] | ||
| pub struct HttpClientSettings { | ||
| /// Maximum number of concurrent in-flight requests allowed by the transport stack. | ||
| #[serde(default = "default_concurrency_limit")] | ||
| pub concurrency_limit: usize, | ||
|
|
||
| /// Timeout for establishing TCP connections. | ||
| /// | ||
| /// When a proxy is configured, this timeout covers the entire connection process, | ||
| /// including the TCP connection to the proxy and the HTTP CONNECT handshake. | ||
| #[serde(default = "default_connect_timeout", with = "humantime_serde")] | ||
| pub connect_timeout: Duration, | ||
|
|
||
| /// Whether to enable `TCP_NODELAY`. | ||
| #[serde(default = "default_tcp_nodelay")] | ||
| pub tcp_nodelay: bool, | ||
|
|
||
| /// TCP keepalive timeout for outbound connections. | ||
| #[serde(default = "default_tcp_keepalive", with = "humantime_serde")] | ||
| pub tcp_keepalive: Option<Duration>, | ||
|
|
||
| /// Interval between TCP keepalive probes once keepalive is active. | ||
| #[serde(default, with = "humantime_serde")] | ||
| pub tcp_keepalive_interval: Option<Duration>, | ||
|
|
||
| /// Timeout for HTTP requests. If not specified, no timeout is applied. | ||
| #[serde(default, with = "humantime_serde")] | ||
| pub timeout: Option<Duration>, | ||
| } | ||
|
|
||
| impl HttpClientSettings { | ||
| /// Returns a non-zero concurrency limit. | ||
| #[must_use] | ||
| pub fn effective_concurrency_limit(&self) -> usize { | ||
| self.concurrency_limit.max(1) | ||
| } | ||
|
|
||
| /// Returns a configured client-bulder | ||
| pub fn client_builder(&self) -> ClientBuilder { | ||
| let mut client_builder = ClientBuilder::new() | ||
| .connect_timeout(self.connect_timeout) | ||
| .tcp_nodelay(self.tcp_nodelay) | ||
| .connector_layer(ConcurrencyLimitLayer::new( | ||
| self.effective_concurrency_limit(), | ||
| )); | ||
|
|
||
| if let Some(tcp_keepalive) = self.tcp_keepalive { | ||
| client_builder = client_builder.tcp_keepalive(tcp_keepalive); | ||
| } | ||
|
|
||
| if let Some(tcp_keepalive_interval) = self.tcp_keepalive_interval { | ||
| client_builder = client_builder.tcp_keepalive_interval(tcp_keepalive_interval) | ||
| } | ||
|
|
||
| if let Some(timeout) = self.timeout { | ||
| client_builder = client_builder.timeout(timeout) | ||
| } | ||
|
|
||
| client_builder | ||
| } | ||
| } | ||
|
|
||
| impl Default for HttpClientSettings { | ||
| fn default() -> Self { | ||
| Self { | ||
| concurrency_limit: default_concurrency_limit(), | ||
| connect_timeout: default_connect_timeout(), | ||
| tcp_nodelay: default_tcp_nodelay(), | ||
| tcp_keepalive: default_tcp_keepalive(), | ||
| tcp_keepalive_interval: None, | ||
| timeout: None, | ||
| } | ||
| } | ||
| } |
42 changes: 42 additions & 0 deletions
42
rust/otap-dataflow/crates/otap/src/otlp_http_exporter/config.rs
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,42 @@ | ||
| // Copyright The OpenTelemetry Authors | ||
| // SPDX-License-Identifier: Apache-2.0 | ||
|
|
||
| use std::num::NonZeroUsize; | ||
|
|
||
| use serde::Deserialize; | ||
|
|
||
| use crate::otlp_exporter::default_max_in_flight; | ||
| use crate::otlp_http::client_settings::HttpClientSettings; | ||
|
|
||
| /// Configuration for OTLP HTTP Exporter | ||
| #[derive(Debug, Deserialize)] | ||
| pub struct Config { | ||
| /// Configuration for the HTTP client that will be used by this exporter | ||
| pub http: HttpClientSettings, | ||
|
|
||
| /// The endpoint to which the exporter will send OTLP HTTP requests. This should include the | ||
| /// scheme, host and port, but not the paths (/v1/logs) as these will be appended to requests | ||
| /// automatically for each batch of signals depending on the signal type. | ||
| /// | ||
| /// Example: "http://localhost:4318" or "https://otel-collector:4318" | ||
| pub endpoint: String, | ||
|
albertlockett marked this conversation as resolved.
|
||
|
|
||
| /// Maximum allowed size for the body of OTLP HTTP responses. This is used to prevent unbounded | ||
| /// memory usage when receiving responses from the OTLP server. If a response exceeds this size, | ||
| /// the exporter will consider processing of the batch to be unsuccessful. default = 10 MiB | ||
| #[serde(default = "default_max_response_body_length")] | ||
| pub max_response_body_length: usize, | ||
|
|
||
| /// The size of the pool of HTTP clients to use for sending export requests. This allows for | ||
| /// multiple concurrent connections to the OTLP server, which can help with load balancing when | ||
| /// there are multiple receiver instances running on the same port (using SO_REUSEPORT). | ||
| pub client_pool_size: NonZeroUsize, | ||
|
|
||
| /// Maximum number of concurrent in-flight export requests. | ||
| #[serde(default = "default_max_in_flight")] | ||
| pub max_in_flight: usize, | ||
| } | ||
|
|
||
| fn default_max_response_body_length() -> usize { | ||
| 10 * 1024 * 1024 | ||
| } | ||
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.
Uh oh!
There was an error while loading. Please reload this page.