Skip to content

[APMSP-1765] Extract retry logic from SendData #852

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
merged 6 commits into from
Feb 10, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion data-pipeline/src/agent_info/fetcher.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ pub async fn fetch_info_with_state(
current_state_hash: Option<&str>,
) -> Result<FetchInfoStatus> {
let req = info_endpoint
.into_request_builder(concat!("Libdatadog/", env!("CARGO_PKG_VERSION")))?
.to_request_builder(concat!("Libdatadog/", env!("CARGO_PKG_VERSION")))?
.method(hyper::Method::GET)
.body(hyper::Body::empty());
let client = hyper::Client::builder().build(Connector::default());
Expand Down
2 changes: 1 addition & 1 deletion data-pipeline/src/stats_exporter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ impl StatsExporter {

let mut req_builder = self
.endpoint
.into_request_builder(concat!("Libdatadog/", env!("CARGO_PKG_VERSION")))?
.to_request_builder(concat!("Libdatadog/", env!("CARGO_PKG_VERSION")))?
.header(
hyper::header::CONTENT_TYPE,
ddcommon::header::APPLICATION_MSGPACK,
Expand Down
2 changes: 1 addition & 1 deletion ddcommon/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ impl Endpoint {
/// - User agent
/// - Api key
/// - Container Id/Entity Id
pub fn into_request_builder(&self, user_agent: &str) -> anyhow::Result<HttpRequestBuilder> {
pub fn to_request_builder(&self, user_agent: &str) -> anyhow::Result<HttpRequestBuilder> {
let mut builder = hyper::Request::builder()
.uri(self.url.clone())
.header(hyper::header::USER_AGENT, user_agent);
Expand Down
2 changes: 1 addition & 1 deletion ddtelemetry/src/worker/http_client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ pub trait HttpClient {

pub fn request_builder(c: &Config) -> anyhow::Result<HttpRequestBuilder> {
match &c.endpoint {
Some(e) => e.into_request_builder(concat!("telemetry/", env!("CARGO_PKG_VERSION"))),
Some(e) => e.to_request_builder(concat!("telemetry/", env!("CARGO_PKG_VERSION"))),
None => Err(anyhow::Error::msg(
"no valid endpoint found, can't build the request".to_string(),
)),
Expand Down
2 changes: 1 addition & 1 deletion live-debugger/src/sender.rs
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ impl PayloadSender {
url = Uri::from_parts(parts)?;

let mut req = endpoint
.into_request_builder(concat!("Tracer/", env!("CARGO_PKG_VERSION")))?
.to_request_builder(concat!("Tracer/", env!("CARGO_PKG_VERSION")))?
.method(Method::POST)
.uri(url);

Expand Down
2 changes: 1 addition & 1 deletion profiling/src/exporter/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,7 @@ impl ProfileExporter {

let builder = self
.endpoint
.into_request_builder(concat!("DDProf/", env!("CARGO_PKG_VERSION")))?
.to_request_builder(concat!("DDProf/", env!("CARGO_PKG_VERSION")))?
.method(http::Method::POST)
.header("Connection", "close")
.header("DD-EVP-ORIGIN", self.profiling_library_name.as_ref())
Expand Down
2 changes: 1 addition & 1 deletion remote-config/src/fetch/fetcher.rs
Original file line number Diff line number Diff line change
Expand Up @@ -304,7 +304,7 @@ impl<S: FileStorage> ConfigFetcher<S> {
let req = self
.state
.endpoint
.into_request_builder(concat!("Sidecar/", env!("CARGO_PKG_VERSION")))?
.to_request_builder(concat!("Sidecar/", env!("CARGO_PKG_VERSION")))?
.method(http::Method::POST)
.header(
http::header::CONTENT_TYPE,
Expand Down
1 change: 1 addition & 0 deletions trace-utils/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
pub mod config_utils;
pub mod msgpack_decoder;
pub mod send_data;
pub mod send_with_retry;
pub mod stats_utils;
#[cfg(any(test, feature = "test-utils"))]
pub mod test_utils;
Expand Down
Loading
Loading