Skip to content

Commit 7db92f7

Browse files
Rename try_to_path
1 parent 4740a60 commit 7db92f7

File tree

2 files changed

+12
-10
lines changed

2 files changed

+12
-10
lines changed

data-pipeline/src/trace_exporter/mod.rs

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -286,7 +286,7 @@ impl TraceExporter {
286286
stats_concentrator.clone(),
287287
self.metadata.clone(),
288288
self.endpoint
289-
.try_to_path(STATS_ENDPOINT)
289+
.try_clone_with_subpath(STATS_ENDPOINT)
290290
.context("failed to create Endpoint")?,
291291
cancellation_token.clone(),
292292
);
@@ -399,7 +399,7 @@ impl TraceExporter {
399399
data,
400400
trace_count,
401401
self.endpoint
402-
.try_to_path(self.output_format.as_path())
402+
.try_clone_with_subpath(self.output_format.as_path())
403403
.map_err(|e| {
404404
TraceExporterError::Builder(BuilderErrorKind::InvalidUri(e.to_string()))
405405
})?,
@@ -617,7 +617,7 @@ impl TraceExporter {
617617
let chunks = payload.size();
618618
let endpoint = self
619619
.endpoint
620-
.try_to_path(self.output_format.as_path())
620+
.try_clone_with_subpath(self.output_format.as_path())
621621
.map_err(|e| {
622622
TraceExporterError::Builder(BuilderErrorKind::InvalidUri(e.to_string()))
623623
})?;
@@ -939,9 +939,11 @@ impl TraceExporterBuilder {
939939
let mut stats = StatsComputationStatus::Disabled;
940940

941941
let info_fetcher = AgentInfoFetcher::new(
942-
endpoint.try_to_path(INFO_ENDPOINT).map_err(|e| {
943-
TraceExporterError::Builder(BuilderErrorKind::InvalidUri(e.to_string()))
944-
})?,
942+
endpoint
943+
.try_clone_with_subpath(INFO_ENDPOINT)
944+
.map_err(|e| {
945+
TraceExporterError::Builder(BuilderErrorKind::InvalidUri(e.to_string()))
946+
})?,
945947
Duration::from_secs(5 * 60),
946948
);
947949

@@ -1076,7 +1078,7 @@ mod tests {
10761078
assert_eq!(
10771079
exporter
10781080
.endpoint
1079-
.try_to_path(exporter.output_format.as_path())
1081+
.try_clone_with_subpath(exporter.output_format.as_path())
10801082
.unwrap()
10811083
.url
10821084
.to_string(),
@@ -1102,7 +1104,7 @@ mod tests {
11021104
assert_eq!(
11031105
exporter
11041106
.endpoint
1105-
.try_to_path(exporter.output_format.as_path())
1107+
.try_clone_with_subpath(exporter.output_format.as_path())
11061108
.unwrap()
11071109
.url
11081110
.to_string(),

ddcommon/src/lib.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -242,7 +242,7 @@ impl Endpoint {
242242
let mut p = p.strip_suffix('/').unwrap_or(p).to_owned();
243243
p.push_str(path);
244244
if let Some(q) = pq.query() {
245-
p.push_str("?");
245+
p.push('?');
246246
p.push_str(q);
247247
}
248248
PathAndQuery::from_str(p.as_str())
@@ -258,7 +258,7 @@ impl Endpoint {
258258
/// The given path must start with a slash (e.g. "/v0.4/traces").
259259
/// Returns an error if the path is not valid.
260260
/// All the other fields are copied.
261-
pub fn try_to_path(&self, path: &str) -> anyhow::Result<Self> {
261+
pub fn try_clone_with_subpath(&self, path: &str) -> anyhow::Result<Self> {
262262
let mut endpoint = self.clone();
263263
endpoint.add_path(path)?;
264264
Ok(endpoint)

0 commit comments

Comments
 (0)