Skip to content

Commit 39c22b5

Browse files
Move agent-info to data-pipeline
1 parent a93231c commit 39c22b5

File tree

10 files changed

+24
-51
lines changed

10 files changed

+24
-51
lines changed

Cargo.lock

Lines changed: 4 additions & 15 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@ members = [
3434
"data-pipeline-ffi",
3535
"ddsketch",
3636
"tinybytes",
37-
"agent-info",
3837
]
3938

4039
default-members = [
@@ -70,7 +69,6 @@ default-members = [
7069
"data-pipeline-ffi",
7170
"ddsketch",
7271
"tinybytes",
73-
"agent-info",
7472
]
7573

7674
# https://doc.rust-lang.org/cargo/reference/resolver.html#feature-resolver-version-2

agent-info/Cargo.toml

Lines changed: 0 additions & 24 deletions
This file was deleted.

data-pipeline/Cargo.toml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,13 @@ autobenches = false
1111

1212
[dependencies]
1313
anyhow = { version = "1.0" }
14+
arc-swap = "1.7.1"
1415
futures = { version = "0.3", default-features = false }
1516
hyper = {version = "0.14", features = ["client"], default-features = false}
1617
log = "0.4"
1718
rmp-serde = "1.1.1"
19+
serde = "1.0.209"
20+
serde_json = "1.0.127"
1821
bytes = "1.4"
1922
tokio = {version = "1.23", features = ["rt"], default-features = false}
2023

@@ -34,4 +37,7 @@ path = "benches/main.rs"
3437

3538
[dev-dependencies]
3639
criterion = "0.5.1"
40+
datadog-trace-utils = { path = "../trace-utils", features = ["test-utils"] }
41+
httpmock = "0.7.0"
3742
rand = "0.8.5"
43+
tokio = {version = "1.23", features = ["rt", "time", "test-util"], default-features = false}

agent-info/src/fetcher.rs renamed to data-pipeline/src/agent_info/fetcher.rs

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
//! Provides utilities to fetch the agent /info endpoint and an automatic fetcher to keep info
44
//! up-to-date
55
6-
use crate::{schema::AgentInfo, AgentInfoArc};
6+
use super::{schema::AgentInfo, AgentInfoArc};
77
use anyhow::{anyhow, Result};
88
use arc_swap::ArcSwapOption;
99
use ddcommon::{connector::Connector, Endpoint};
@@ -66,7 +66,9 @@ async fn fetch_info_with_state(
6666
/// // Define the endpoint
6767
/// let endpoint = ddcommon::Endpoint::from_url("http://localhost:8126/info".parse().unwrap());
6868
/// // Fetch the info
69-
/// let agent_info = agent_info::fetch_info(&endpoint).await.unwrap();
69+
/// let agent_info = data_pipeline::agent_info::fetch_info(&endpoint)
70+
/// .await
71+
/// .unwrap();
7072
/// println!("Agent version is {}", agent_info.info.version.unwrap());
7173
/// # Ok(())
7274
/// # }
@@ -92,8 +94,10 @@ pub async fn fetch_info(info_endpoint: &Endpoint) -> Result<Box<AgentInfo>> {
9294
/// // Define the endpoint
9395
/// let endpoint = ddcommon::Endpoint::from_url("http://localhost:8126/info".parse().unwrap());
9496
/// // Create the fetcher
95-
/// let fetcher =
96-
/// agent_info::AgentInfoFetcher::new(endpoint, std::time::Duration::from_secs(5 * 60));
97+
/// let fetcher = data_pipeline::agent_info::AgentInfoFetcher::new(
98+
/// endpoint,
99+
/// std::time::Duration::from_secs(5 * 60),
100+
/// );
97101
/// // Get the Arc to access the info
98102
/// let agent_info_arc = fetcher.get_info();
99103
/// // Start the runner
File renamed without changes.
File renamed without changes.

data-pipeline/src/lib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
//! project at this state is to provide a basic API in order to test its viability and integration
77
//! in different languages.
88
9+
pub mod agent_info;
910
#[allow(missing_docs)]
1011
pub mod span_concentrator;
1112
#[allow(missing_docs)]

agent-info/tests/test_fetch_info.rs renamed to data-pipeline/tests/test_fetch_info.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
#[cfg(test)]
55
mod require_test_agent {
66
mod fetch_info_test {
7-
use agent_info::fetch_info;
7+
use data_pipeline::agent_info::fetch_info;
88
use datadog_trace_utils::test_utils::datadog_test_agent::DatadogTestAgent;
99
use ddcommon::Endpoint;
1010

@@ -26,8 +26,8 @@ mod require_test_agent {
2626
}
2727

2828
mod agent_info_fetcher_test {
29-
use agent_info::AgentInfoFetcher;
3029
use arc_swap::access::Access;
30+
use data_pipeline::agent_info::AgentInfoFetcher;
3131
use datadog_trace_utils::test_utils::datadog_test_agent::DatadogTestAgent;
3232
use ddcommon::Endpoint;
3333
use std::time::Duration;

tools/docker/Dockerfile.build

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ ENV CARGO_HOME="/root/.cargo"
2020
WORKDIR /build
2121

2222
RUN apk update \
23-
&& apk add --no-cache \
23+
&& apk add --no-cache \
2424
build-base \
2525
cargo \
2626
cmake \
@@ -33,7 +33,7 @@ RUN apk update \
3333
unzip \
3434
bash \
3535
clang16-libclang \
36-
&& mkdir /usr/local/src
36+
&& mkdir /usr/local/src
3737

3838
# Tell docker to use bash as the default
3939
SHELL ["/bin/bash", "-c"]
@@ -45,7 +45,7 @@ SHELL ["/bin/bash", "-c"]
4545

4646
FROM alpine_base as alpine_aws_cli
4747
RUN apk add --no-cache aws-cli \
48-
&& rm -rf /var/cache/apk/*
48+
&& rm -rf /var/cache/apk/*
4949

5050
RUN aws --version # Just to make sure its installed alright
5151

@@ -69,7 +69,6 @@ RUN cargo search nothing --limit 1
6969
# create stubs to cache compilation of dependendencies
7070
COPY [ "Cargo.lock", "Cargo.toml", "./"]
7171
COPY "alloc/Cargo.toml" "alloc/"
72-
COPY "agent-info/Cargo.toml" "agent-info/"
7372
COPY "build-common/Cargo.toml" "build-common/"
7473
COPY "crashtracker/Cargo.toml" "crashtracker/"
7574
COPY "crashtracker-ffi/Cargo.toml" "crashtracker-ffi/"

0 commit comments

Comments
 (0)