Skip to content

Commit 9ae653c

Browse files
committed
chore: reduce symbol visibility and streamlime symbol reexporting
1 parent 4a07716 commit 9ae653c

File tree

6 files changed

+23
-19
lines changed

6 files changed

+23
-19
lines changed

libdd-data-pipeline-ffi/src/error.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// Copyright 2024-Present Datadog, Inc. https://www.datadoghq.com/
22
// SPDX-License-Identifier: Apache-2.0
33

4-
use libdd_data_pipeline::trace_exporter::error::{
4+
use libdd_data_pipeline::trace_exporter::{
55
AgentErrorKind, BuilderErrorKind, InternalErrorKind, NetworkErrorKind, TraceExporterError,
66
};
77
use std::ffi::{c_char, CString};

libdd-data-pipeline-ffi/src/response.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
//! Define FFI compatible AgentResponse struct
55
6-
use libdd_data_pipeline::trace_exporter::agent_response::AgentResponse;
6+
use libdd_data_pipeline::trace_exporter::AgentResponse;
77
use std::ptr::null;
88

99
/// Structure containing the agent response to a trace payload

libdd-data-pipeline-ffi/src/trace_exporter.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ use libdd_common_ffi::{
1111
};
1212

1313
#[cfg(feature = "telemetry")]
14-
use libdd_data_pipeline::telemetry::TelemetryConfig;
14+
use libdd_data_pipeline::trace_exporter::TelemetryConfig;
1515
use libdd_data_pipeline::trace_exporter::{
1616
TraceExporter as GenericTraceExporter, TraceExporterInputFormat, TraceExporterOutputFormat,
1717
};

libdd-data-pipeline/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ pub(crate) mod otlp;
1616
#[cfg(not(target_arch = "wasm32"))]
1717
mod pausable_worker;
1818
#[allow(missing_docs)]
19-
pub mod stats_exporter;
19+
pub(crate) mod stats_exporter;
2020
pub mod telemetry;
2121
#[allow(missing_docs)]
2222
pub mod trace_exporter;

libdd-data-pipeline/src/stats_exporter.rs

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,6 @@ use tokio::select;
2121
use tokio_util::sync::CancellationToken;
2222
use tracing::error;
2323

24-
const STATS_ENDPOINT_PATH: &str = "/v0.6/stats";
25-
2624
/// An exporter that concentrates and sends stats to the agent.
2725
///
2826
/// `H` is the HTTP client implementation, see [`HttpClientTrait`]. Leaf crates
@@ -193,13 +191,6 @@ fn encode_stats_payload(
193191
}
194192
}
195193

196-
/// Return the stats endpoint url to send stats to the agent at `agent_url`
197-
pub fn stats_url_from_agent_url(agent_url: &str) -> anyhow::Result<http::Uri> {
198-
let mut parts = agent_url.parse::<http::Uri>()?.into_parts();
199-
parts.path_and_query = Some(http::uri::PathAndQuery::from_static(STATS_ENDPOINT_PATH));
200-
Ok(http::Uri::from_parts(parts)?)
201-
}
202-
203194
#[cfg(test)]
204195
mod tests {
205196
use super::*;
@@ -211,11 +202,21 @@ mod tests {
211202
use time::Duration;
212203
use time::SystemTime;
213204

205+
const STATS_ENDPOINT_PATH: &str = "/v0.6/stats";
206+
214207
fn is_send<T: Send>() {}
215208
fn is_sync<T: Sync>() {}
216209

217210
const BUCKETS_DURATION: Duration = Duration::from_secs(10);
218211

212+
/// Return the stats endpoint url to send stats to the agent at `agent_url`
213+
fn stats_url_from_agent_url(agent_url: &str) -> anyhow::Result<http::Uri> {
214+
let mut parts = agent_url.parse::<http::Uri>()?.into_parts();
215+
parts.path_and_query = Some(http::uri::PathAndQuery::from_static(STATS_ENDPOINT_PATH));
216+
Ok(http::Uri::from_parts(parts)?)
217+
}
218+
219+
219220
/// Fails to compile if stats exporter is not Send and Sync
220221
#[test]
221222
fn test_stats_exporter_sync_send() {

libdd-data-pipeline/src/trace_exporter/mod.rs

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,18 @@
33
pub mod agent_response;
44
pub mod builder;
55
pub mod error;
6-
pub mod metrics;
7-
pub mod stats;
6+
pub(crate) mod metrics;
7+
pub(crate) mod stats;
88
mod trace_serializer;
99

10-
// Re-export the builder
10+
// Re-export commonly used types for convenience
11+
pub use agent_response::AgentResponse;
1112
pub use builder::TraceExporterBuilder;
13+
pub use crate::telemetry::TelemetryConfig;
14+
pub use error::{
15+
AgentErrorKind, BuilderErrorKind, InternalErrorKind, NetworkErrorKind, TraceExporterError,
16+
};
1217

13-
use self::agent_response::AgentResponse;
1418
use self::metrics::MetricsEmitter;
1519
use self::stats::StatsComputationStatus;
1620
use self::trace_serializer::TraceSerializer;
@@ -22,8 +26,7 @@ use crate::telemetry::{SendPayloadTelemetry, TelemetryClient};
2226
use crate::trace_exporter::agent_response::{
2327
AgentResponsePayloadVersion, DATADOG_RATES_PAYLOAD_VERSION,
2428
};
25-
use crate::trace_exporter::error::InternalErrorKind;
26-
use crate::trace_exporter::error::{RequestError, TraceExporterError};
29+
use crate::trace_exporter::error::RequestError;
2730
use crate::{
2831
agent_info::{self, schema::AgentInfo},
2932
health_metrics,

0 commit comments

Comments
 (0)