Skip to content

Commit

Permalink
Move agent-info to data-pipeline
Browse files Browse the repository at this point in the history
  • Loading branch information
VianneyRuhlmann committed Sep 18, 2024
1 parent a93231c commit 39c22b5
Show file tree
Hide file tree
Showing 10 changed files with 24 additions and 51 deletions.
19 changes: 4 additions & 15 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 0 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ members = [
"data-pipeline-ffi",
"ddsketch",
"tinybytes",
"agent-info",
]

default-members = [
Expand Down Expand Up @@ -70,7 +69,6 @@ default-members = [
"data-pipeline-ffi",
"ddsketch",
"tinybytes",
"agent-info",
]

# https://doc.rust-lang.org/cargo/reference/resolver.html#feature-resolver-version-2
Expand Down
24 changes: 0 additions & 24 deletions agent-info/Cargo.toml

This file was deleted.

6 changes: 6 additions & 0 deletions data-pipeline/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,13 @@ autobenches = false

[dependencies]
anyhow = { version = "1.0" }
arc-swap = "1.7.1"
futures = { version = "0.3", default-features = false }
hyper = {version = "0.14", features = ["client"], default-features = false}
log = "0.4"
rmp-serde = "1.1.1"
serde = "1.0.209"
serde_json = "1.0.127"
bytes = "1.4"
tokio = {version = "1.23", features = ["rt"], default-features = false}

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

[dev-dependencies]
criterion = "0.5.1"
datadog-trace-utils = { path = "../trace-utils", features = ["test-utils"] }
httpmock = "0.7.0"
rand = "0.8.5"
tokio = {version = "1.23", features = ["rt", "time", "test-util"], default-features = false}
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
//! Provides utilities to fetch the agent /info endpoint and an automatic fetcher to keep info
//! up-to-date

use crate::{schema::AgentInfo, AgentInfoArc};
use super::{schema::AgentInfo, AgentInfoArc};
use anyhow::{anyhow, Result};
use arc_swap::ArcSwapOption;
use ddcommon::{connector::Connector, Endpoint};
Expand Down Expand Up @@ -66,7 +66,9 @@ async fn fetch_info_with_state(
/// // Define the endpoint
/// let endpoint = ddcommon::Endpoint::from_url("http://localhost:8126/info".parse().unwrap());
/// // Fetch the info
/// let agent_info = agent_info::fetch_info(&endpoint).await.unwrap();
/// let agent_info = data_pipeline::agent_info::fetch_info(&endpoint)
/// .await
/// .unwrap();
/// println!("Agent version is {}", agent_info.info.version.unwrap());
/// # Ok(())
/// # }
Expand All @@ -92,8 +94,10 @@ pub async fn fetch_info(info_endpoint: &Endpoint) -> Result<Box<AgentInfo>> {
/// // Define the endpoint
/// let endpoint = ddcommon::Endpoint::from_url("http://localhost:8126/info".parse().unwrap());
/// // Create the fetcher
/// let fetcher =
/// agent_info::AgentInfoFetcher::new(endpoint, std::time::Duration::from_secs(5 * 60));
/// let fetcher = data_pipeline::agent_info::AgentInfoFetcher::new(
/// endpoint,
/// std::time::Duration::from_secs(5 * 60),
/// );
/// // Get the Arc to access the info
/// let agent_info_arc = fetcher.get_info();
/// // Start the runner
Expand Down
File renamed without changes.
File renamed without changes.
1 change: 1 addition & 0 deletions data-pipeline/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
//! project at this state is to provide a basic API in order to test its viability and integration
//! in different languages.

pub mod agent_info;
#[allow(missing_docs)]
pub mod span_concentrator;
#[allow(missing_docs)]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
#[cfg(test)]
mod require_test_agent {
mod fetch_info_test {
use agent_info::fetch_info;
use data_pipeline::agent_info::fetch_info;
use datadog_trace_utils::test_utils::datadog_test_agent::DatadogTestAgent;
use ddcommon::Endpoint;

Expand All @@ -26,8 +26,8 @@ mod require_test_agent {
}

mod agent_info_fetcher_test {
use agent_info::AgentInfoFetcher;
use arc_swap::access::Access;
use data_pipeline::agent_info::AgentInfoFetcher;
use datadog_trace_utils::test_utils::datadog_test_agent::DatadogTestAgent;
use ddcommon::Endpoint;
use std::time::Duration;
Expand Down
7 changes: 3 additions & 4 deletions tools/docker/Dockerfile.build
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ ENV CARGO_HOME="/root/.cargo"
WORKDIR /build

RUN apk update \
&& apk add --no-cache \
&& apk add --no-cache \
build-base \
cargo \
cmake \
Expand All @@ -33,7 +33,7 @@ RUN apk update \
unzip \
bash \
clang16-libclang \
&& mkdir /usr/local/src
&& mkdir /usr/local/src

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

FROM alpine_base as alpine_aws_cli
RUN apk add --no-cache aws-cli \
&& rm -rf /var/cache/apk/*
&& rm -rf /var/cache/apk/*

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

Expand All @@ -69,7 +69,6 @@ RUN cargo search nothing --limit 1
# create stubs to cache compilation of dependendencies
COPY [ "Cargo.lock", "Cargo.toml", "./"]
COPY "alloc/Cargo.toml" "alloc/"
COPY "agent-info/Cargo.toml" "agent-info/"
COPY "build-common/Cargo.toml" "build-common/"
COPY "crashtracker/Cargo.toml" "crashtracker/"
COPY "crashtracker-ffi/Cargo.toml" "crashtracker-ffi/"
Expand Down

0 comments on commit 39c22b5

Please sign in to comment.