Skip to content

Commit aaceb7e

Browse files
feat(data-pipeline): Drop query params setter
1 parent b5248d4 commit aaceb7e

File tree

1 file changed

+5
-42
lines changed
  • data-pipeline/src/trace_exporter

1 file changed

+5
-42
lines changed

data-pipeline/src/trace_exporter/mod.rs

Lines changed: 5 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -76,18 +76,6 @@ impl TraceExporterOutputFormat {
7676
},
7777
)
7878
}
79-
80-
#[cfg(feature = "test-utils")]
81-
// This function is only intended for testing purposes so we don't need to go to all the trouble
82-
// of breaking the uri down and parsing it as rigorously as we would if we were using it in
83-
// production code.
84-
fn add_query(&self, url: &Uri, query: &str) -> Uri {
85-
let url = format!("{}?{}", url, query);
86-
87-
// TODO: Properly handle non-OK states to prevent possible panics (APMSP-18190).
88-
#[allow(clippy::expect_used)]
89-
Uri::from_str(&url).expect("Failed to create Uri from string")
90-
}
9179
}
9280

9381
/// Add a path to the URL.
@@ -208,8 +196,6 @@ pub struct TraceExporter {
208196
agent_info: AgentInfoArc,
209197
previous_info_state: ArcSwapOption<String>,
210198
telemetry: Option<TelemetryClient>,
211-
#[cfg(feature = "test-utils")]
212-
query_params: Option<String>,
213199
}
214200

215201
impl TraceExporter {
@@ -761,14 +747,6 @@ impl TraceExporter {
761747
}
762748

763749
fn get_agent_url(&self) -> Uri {
764-
#[cfg(feature = "test-utils")]
765-
{
766-
if let Some(query) = &self.query_params {
767-
let url = self.output_format.add_path(&self.endpoint.url);
768-
return self.output_format.add_query(&url, query);
769-
}
770-
}
771-
772750
self.output_format.add_path(&self.endpoint.url)
773751
}
774752
}
@@ -801,9 +779,6 @@ pub struct TraceExporterBuilder {
801779
dogstatsd_url: Option<String>,
802780
client_computed_stats: bool,
803781
client_computed_top_level: bool,
804-
#[cfg(feature = "test-utils")]
805-
/// not supported in production, but useful for interacting with the test-agent
806-
query_params: Option<String>,
807782
// Stats specific fields
808783
/// A Some value enables stats-computation, None if it is disabled
809784
stats_bucket_size: Option<Duration>,
@@ -965,14 +940,6 @@ impl TraceExporterBuilder {
965940
self
966941
}
967942

968-
#[cfg(feature = "test-utils")]
969-
/// Set query parameters to be used in the URL when communicating with the test-agent. This is
970-
/// not supported in production as the real agent doesn't accept query params.
971-
pub fn set_query_params(&mut self, query_params: &str) -> &mut Self {
972-
self.query_params = Some(query_params.to_owned());
973-
self
974-
}
975-
976943
#[allow(missing_docs)]
977944
pub fn build(self) -> Result<TraceExporter, TraceExporterError> {
978945
if !Self::is_inputs_outputs_formats_compatible(self.input_format, self.output_format) {
@@ -999,12 +966,6 @@ impl TraceExporterBuilder {
999966
TraceExporterError::Builder(BuilderErrorKind::InvalidUri(e.to_string()))
1000967
})?;
1001968

1002-
let endpoint = Endpoint {
1003-
url: agent_url,
1004-
test_token: self.test_session_token.map(|token| token.into()),
1005-
..Default::default()
1006-
};
1007-
1008969
let libdatadog_version = tag!("libdatadog_version", env!("CARGO_PKG_VERSION"));
1009970
let mut stats = StatsComputationStatus::Disabled;
1010971

@@ -1051,7 +1012,11 @@ impl TraceExporterBuilder {
10511012
}
10521013

10531014
Ok(TraceExporter {
1054-
endpoint: Endpoint::from_url(agent_url),
1015+
endpoint: Endpoint {
1016+
url: agent_url,
1017+
test_token: self.test_session_token.map(|token| token.into()),
1018+
..Default::default()
1019+
},
10551020
metadata: TracerMetadata {
10561021
tracer_version: self.tracer_version,
10571022
language_version: self.language_version,
@@ -1077,8 +1042,6 @@ impl TraceExporterBuilder {
10771042
agent_info,
10781043
previous_info_state: ArcSwapOption::new(None),
10791044
telemetry,
1080-
#[cfg(feature = "test-utils")]
1081-
query_params: self.query_params,
10821045
})
10831046
}
10841047

0 commit comments

Comments
 (0)