diff --git a/.github/workflows/core-build-checks.yml b/.github/workflows/core-build-checks.yml index 283bdb9..fa5588a 100644 --- a/.github/workflows/core-build-checks.yml +++ b/.github/workflows/core-build-checks.yml @@ -16,37 +16,7 @@ jobs: - name: Set up Docker Buildx uses: docker/setup-buildx-action@v3 - - - name: Install Rust toolchain - uses: dtolnay/rust-toolchain@master - with: - toolchain: nightly - components: rust-src - - - name: Install BPF dependencies - run: | - sudo apt-get update - sudo apt-get install -y \ - clang \ - llvm \ - libelf-dev \ - libpcap-dev \ - build-essential \ - libbpf-dev \ - linux-tools-generic \ - linux-tools-common \ - protobuf-compiler - - - name: Install bindgen-cli and bpf-linker - run: | - cargo install bindgen-cli - cargo install bpf-linker - - - name: Setup bpftool symlink - run: | - sudo ln -sf /usr/lib/linux-tools/*/bpftool /usr/local/bin/bpftool || \ - sudo ln -sf /usr/lib/linux-tools-*/bpftool /usr/local/bin/bpftool - + - name: Build CortexFlow Agent run: | cd core @@ -57,18 +27,18 @@ jobs: - name: Build CortexFlow Identity run: | - cd core/src/components/identity - chmod +x build-identity.sh + cd core + chmod +x identity-build.sh echo "🚀 Starting CortexFlow Identity build..." - ./build-identity.sh || { echo "❌ Identity build failed"; exit 1; } + ./identity-build.sh || { echo "❌ Identity build failed"; exit 1; } echo "✅ Identity build completed" - + - name: Build CortexFlow Metrics run: | - cd core/src/components/metrics - chmod +x build-metrics.sh + cd core + chmod +x metrics-build.sh echo "🚀 Starting CortexFlow Metrics build..." - ./build-metrics.sh || { echo "❌ Metrics build failed"; exit 1; } + ./metrics-build.sh || { echo "❌ Metrics build failed"; exit 1; } echo "✅ Metrics build completed" - name: Verify Docker images were built @@ -108,4 +78,4 @@ jobs: - name: Cleanup build artifacts run: | - docker system prune -f \ No newline at end of file + docker system prune -f diff --git a/build-all.sh b/build-all.sh index 4a0675f..d914a78 100755 --- a/build-all.sh +++ b/build-all.sh @@ -1,24 +1,19 @@ #!/bin/bash -set -e +set -euo pipefail -echo "Building CortexFlow Agent" -pushd ./core -./agent-api-build.sh -popd +ROOT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" +CORE_DIR="$ROOT_DIR/core" -sleep 1 +echo "Building CortexFlow Agent" +"$CORE_DIR/agent-api-build.sh" +echo "" echo "Building CortexFlow Identity" -pushd ./core/src/components/identity -./build-identity.sh -popd - -sleep 1 +"$CORE_DIR/src/components/identity/build-identity.sh" +echo "" echo "Building CortexFlow Metrics" -pushd ./core/src/components/metrics -./build-metrics.sh -popd +"$CORE_DIR/src/components/metrics/build-metrics.sh" sleep 1 diff --git a/core/agent-api-build.sh b/core/agent-api-build.sh index 96e6a0d..eac2da3 100755 --- a/core/agent-api-build.sh +++ b/core/agent-api-build.sh @@ -1,16 +1,8 @@ #!/bin/bash +set -euo pipefail -echo "Building the conntracker files" -pushd src/components/conntracker -./build-conntracker.sh -popd +SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" -echo "Copying connection tracker binaries" -cp -r target/bpfel-unknown-none/release/conntracker conntracker - -# Run docker build +echo "Building cortexflow-agent image from core workspace context" +cd "$SCRIPT_DIR" docker build -f api/Dockerfile -t cortexflow-agent:0.0.1 --provenance=false --sbom=false . - -# Cleanup -echo "Cleaning building files" -rm -rf conntracker diff --git a/core/api/Dockerfile b/core/api/Dockerfile index 3946f3f..628373c 100644 --- a/core/api/Dockerfile +++ b/core/api/Dockerfile @@ -1,7 +1,39 @@ -# Phase 1: Build image -FROM rust:1.90 AS builder +# ============================================================================== +# PHASE 1: Build the eBPF bytecode (Kernel-space Connection Tracker) +# ============================================================================== +FROM rust:1.90 AS ebpf-builder -# Install system dependencies including protoc +RUN apt-get update && apt-get install -y \ + clang \ + libclang-dev \ + llvm \ + bpftool \ + && rm -rf /var/lib/apt/lists/* + +RUN cargo install --locked bindgen-cli +RUN cargo install --locked bpf-linker +RUN rustup toolchain install nightly --component rust-src + +WORKDIR /usr/src/app +COPY . . + +# Generate bindings from local Linux VM host kernel definitions +RUN bpftool btf dump file /sys/kernel/btf/vmlinux format c > src/components/conntracker/vmlinux.h \ + && bindgen src/components/conntracker/vmlinux.h \ + -o src/components/conntracker/src/bindings.rs \ + --use-core \ + --allowlist-type 'sk_buff' + +# Compile the raw eBPF connection tracker target +RUN cargo +nightly build -Z build-std=core --target bpfel-unknown-none --release -p conntracker + + +# ============================================================================== +# PHASE 2: Build the Userspace Binaries (agent-api & cortexflow_identity) +# ============================================================================== +FROM rust:1.90 AS app-builder + +# Install system dependencies including protoc for gRPC/Protobuf generation RUN apt-get update && apt-get install -y \ build-essential \ libprotobuf-dev \ @@ -16,19 +48,18 @@ RUN apt-get update && apt-get install -y \ ENV PROTOC=/usr/bin/protoc ENV PROTOC_INCLUDE=/usr/include -# Set working directory -WORKDIR /usr/src/app/agent - -# Copy Cargo manifest and sources +WORKDIR /usr/src/app COPY . . -COPY common ../common -# Fetch dependencies and build release -RUN cargo fetch +# Fetch dependencies and build release components +RUN cargo fetch RUN cargo build -p cortexflow_agent_api --release RUN cargo build -p cortexflow_identity --release -# Phase 2: Final minimal image + +# ============================================================================== +# PHASE 3: Final Minimal Production Runtime Image +# ============================================================================== FROM ubuntu:24.04 # Install runtime dependencies @@ -43,12 +74,12 @@ ENV PATH="/root/.cargo/bin:/usr/local/bin:${PATH}" # Create working directory WORKDIR /usr/src/cortexbrain-agent -# Copy the compiled binary -COPY --from=builder /usr/src/app/agent/target/release/agent-api /usr/local/bin/agent-api -COPY --from=builder /usr/src/app/agent/target/release/cortexflow_identity /usr/local/bin/cortexflow_identity +# 1. Copy the compiled binaries from Phase 2 (App Builder) +COPY --from=app-builder /usr/src/app/target/release/agent-api /usr/local/bin/agent-api +COPY --from=app-builder /usr/src/app/target/release/cortexflow_identity /usr/local/bin/cortexflow_identity -# Copy configuration files -COPY conntracker /usr/src/cortexbrain-agent/conntracker +# 2. Copy ONLY the compiled raw eBPF binary from Phase 1 (eBPF Builder) +COPY --from=ebpf-builder /usr/src/app/target/bpfel-unknown-none/release/conntracker /usr/src/cortexbrain-agent/conntracker # Set env vars for your app ENV BPF_PATH="/usr/src/cortexbrain-agent/conntracker" @@ -56,4 +87,4 @@ ENV PIN_MAP_PATH="/sys/fs/bpf/cortexbrain-identity-service/" ENV PIN_BLOCKLIST_MAP_PATH="/sys/fs/bpf/cortexbrain-agent/" # Default command -CMD ["agent-api"] +CMD ["agent-api"] \ No newline at end of file diff --git a/core/common/src/logger.rs b/core/common/src/logger.rs index ab06f79..c2dab2c 100644 --- a/core/common/src/logger.rs +++ b/core/common/src/logger.rs @@ -44,18 +44,67 @@ use opentelemetry_otlp::{LogExporter, WithExportConfig}; use opentelemetry_sdk::Resource; use opentelemetry_sdk::logs::SdkLoggerProvider; +const OTEL_SERVICE_NAME: &str = "OTEL_SERVICE_NAME"; +const OTEL_EXPORTER_OTLP_ENDPOINT: &str = "OTEL_EXPORTER_OTLP_ENDPOINT"; +const OTEL_EXPORTER_OTLP_PROTOCOL: &str = "OTEL_EXPORTER_OTLP_PROTOCOL"; +const DEFAULT_OTLP_GRPC_ENDPOINT: &str = "http://localhost:4317"; +const DEFAULT_OTLP_HTTP_ENDPOINT: &str = "http://localhost:4318"; + +fn resolved_otlp_endpoint() -> String { + if let Ok(endpoint) = std::env::var(OTEL_EXPORTER_OTLP_ENDPOINT) + && !endpoint.trim().is_empty() + { + return endpoint; + } + + let default = match std::env::var(OTEL_EXPORTER_OTLP_PROTOCOL) + .ok() + .map(|value| value.to_ascii_lowercase()) + .as_deref() + { + Some("http/protobuf") | Some("http/json") => DEFAULT_OTLP_HTTP_ENDPOINT, + _ => DEFAULT_OTLP_GRPC_ENDPOINT, + }; + + default.to_string() +} + +fn resolved_service_name(default_service_name: String) -> String { + match std::env::var(OTEL_SERVICE_NAME) { + Ok(service_name) if !service_name.trim().is_empty() => service_name, + _ => default_service_name, + } +} + +fn resolved_otlp_protocol() -> String { + std::env::var(OTEL_EXPORTER_OTLP_PROTOCOL) + .ok() + .map(|value| value.to_ascii_lowercase()) + .filter(|value| !value.trim().is_empty()) + .unwrap_or_else(|| "grpc".to_string()) +} + pub fn otlp_logger_init(service_name: String) -> SdkLoggerProvider { - //exporter and provider initialization - let otlp_endpoint = std::env::var("OTEL_EXPORTER_OTLP_ENDPOINT") - .unwrap_or_else(|_| "http://localhost:4317".to_string()); + // exporter and provider initialization + let otlp_endpoint = resolved_otlp_endpoint(); + let otlp_protocol = resolved_otlp_protocol(); + + let exporter = match otlp_protocol.as_str() { + "http/protobuf" | "http/json" => LogExporter::builder() + .with_http() + .with_endpoint(otlp_endpoint) + .build() + .expect("Failed to create OTLP HTTP exporter"), + _ => LogExporter::builder() + .with_tonic() + .with_endpoint(otlp_endpoint) + .build() + .expect("Failed to create OTLP gRPC exporter"), + }; - let exporter = LogExporter::builder() - .with_tonic() - .with_endpoint(otlp_endpoint) - .build() - .expect("Failed to create OTLP exporter"); + // Resource::builder() automatically reads OTEL_RESOURCE_ATTRIBUTES. + let service_name = resolved_service_name(service_name); - //needs a service name let provider = SdkLoggerProvider::builder() .with_resource(Resource::builder().with_service_name(service_name).build()) .with_batch_exporter(exporter) diff --git a/core/identity-build.sh b/core/identity-build.sh new file mode 100755 index 0000000..4493afa --- /dev/null +++ b/core/identity-build.sh @@ -0,0 +1,9 @@ +#! /bin/bash +set -euo pipefail + +SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" + +echo "Building cortexflow-identity image from core workspace context" +cd "$SCRIPT_DIR" + +docker build -f src/components/identity/Dockerfile -t identity:0.0.1 --provenance=false --sbom=false . diff --git a/core/metrics-build.sh b/core/metrics-build.sh new file mode 100755 index 0000000..49ee922 --- /dev/null +++ b/core/metrics-build.sh @@ -0,0 +1,9 @@ +#! /bin/bash +set -euo pipefail + +SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" + +echo "Building cortexflow-metrics image from core workspace context" +cd "$SCRIPT_DIR" + +docker build -f src/components/metrics/Dockerfile -t metrics:0.0.1 --provenance=false --sbom=false . diff --git a/core/src/components/identity/Dockerfile b/core/src/components/identity/Dockerfile index 30feb4e..4dd8366 100644 --- a/core/src/components/identity/Dockerfile +++ b/core/src/components/identity/Dockerfile @@ -1,37 +1,61 @@ -# Phase 1: Build image -FROM rust:1.90 AS builder +# Build this Dockerfile from the `core` directory as context: +# docker build -f src/components/identity/Dockerfile -t identity:0.0.1 \ +# --provenance=false --sbom=false . -# Set working directory -WORKDIR /usr/src/app/identity-service +# ============================================================================== +# PHASE 1: Build the eBPF bytecode (Kernel-space) +# ============================================================================== +FROM rust:1.90 AS ebpf-builder -# Copy Cargo manifest and sources -COPY Cargo.toml . -COPY src ./src -COPY common ../../../common +RUN apt-get update && apt-get install -y \ + clang \ + libclang-dev \ + llvm \ + bpftool \ + && rm -rf /var/lib/apt/lists/* + +RUN cargo install --locked bindgen-cli +RUN cargo install --locked bpf-linker +RUN rustup toolchain install nightly --component rust-src + +WORKDIR /usr/src/app +COPY . . + +RUN bpftool btf dump file /sys/kernel/btf/vmlinux format c > src/components/conntracker/vmlinux.h \ + && bindgen src/components/conntracker/vmlinux.h \ + -o src/components/conntracker/src/bindings.rs \ + --use-core \ + --allowlist-type 'sk_buff' + +RUN cargo +nightly build -Z build-std=core --target bpfel-unknown-none --release -p conntracker -# Fetch dependencies and build release -RUN cargo fetch && cargo build --release -# Phase 2: Final minimal image +# ============================================================================== +# PHASE 2: Build the Main Identity Service Application (User-space) +# ============================================================================== +FROM rust:1.90 AS app-builder + +WORKDIR /usr/src/app +COPY . . + +RUN cargo build --release -p cortexflow_identity + + +# ============================================================================== +# PHASE 3: Final minimal image (Production Runtime) +# ============================================================================== FROM ubuntu:24.04 -# Install runtime dependencies RUN apt-get update && apt-get install -y \ ca-certificates \ && rm -rf /var/lib/apt/lists/* -# Create working directory WORKDIR /usr/src/cortexbrain-identity-service -# Copy the compiled binary -COPY --from=builder /usr/src/app/identity-service/target/release/cortexflow_identity /usr/local/bin/cortexflow-identity-service - -# Copy configuration files -COPY conntracker /usr/src/cortexbrain-identity-service/conntracker +COPY --from=app-builder /usr/src/app/target/release/cortexflow_identity /usr/local/bin/cortexflow-identity-service +COPY --from=ebpf-builder /usr/src/app/target/bpfel-unknown-none/release/conntracker /usr/src/cortexbrain-identity-service/conntracker -# Set environment variable ENV BPF_PATH="/usr/src/cortexbrain-identity-service/conntracker" ENV PIN_MAP_PATH="/sys/fs/bpf/maps" -# Default command CMD ["cortexflow-identity-service"] diff --git a/core/src/components/metrics/Dockerfile b/core/src/components/metrics/Dockerfile index 8b22aae..7feac2d 100644 --- a/core/src/components/metrics/Dockerfile +++ b/core/src/components/metrics/Dockerfile @@ -1,37 +1,62 @@ -# Phase 1: Build image -FROM rust:1.90 AS builder +# Build this Dockerfile from the `core` directory as context: +# docker build -f src/components/metrics/Dockerfile -t metrics:0.0.1 \ +# --provenance=false --sbom=false . -# Set working directory -WORKDIR /usr/src/app/metrics +# ============================================================================== +# PHASE 1: Build the eBPF bytecode (Kernel-space Metrics Tracer) +# ============================================================================== +FROM rust:1.90 AS ebpf-builder -# Copy Cargo manifest and sources -COPY Cargo.toml . -COPY src ./src -COPY common ../../../common +RUN apt-get update && apt-get install -y \ + clang \ + libclang-dev \ + llvm \ + bpftool \ + && rm -rf /var/lib/apt/lists/* + +RUN cargo install --locked bindgen-cli +RUN cargo install --locked bpf-linker +RUN rustup toolchain install nightly --component rust-src + +WORKDIR /usr/src/app +COPY . . + +RUN bpftool btf dump file /sys/kernel/btf/vmlinux format c > src/components/metrics_tracer/vmlinux.h \ + && bindgen src/components/metrics_tracer/vmlinux.h \ + -o src/components/metrics_tracer/src/bindings.rs \ + --use-core \ + --allowlist-type 'sk_buff' \ + --allowlist-type 'sock_common' \ + --allowlist-type 'in6_addr' -# Fetch dependencies and build release -RUN cargo fetch && cargo build --release +RUN cargo +nightly build -Z build-std=core --target bpfel-unknown-none --release -p metrics_tracer -# Phase 2: Final minimal image +# ============================================================================== +# PHASE 2: Build the Main Metrics Service Application (User-space) +# ============================================================================== +FROM rust:1.90 AS app-builder + +WORKDIR /usr/src/app +COPY . . + +RUN cargo build --release -p metrics + + +# ============================================================================== +# PHASE 3: Final minimal image (Production Runtime) +# ============================================================================== FROM ubuntu:24.04 -# Install runtime dependencies RUN apt-get update && apt-get install -y \ ca-certificates \ && rm -rf /var/lib/apt/lists/* -# Create working directory WORKDIR /usr/src/cortexbrain-metrics -# Copy the compiled binary -COPY --from=builder /usr/src/app/metrics/target/release/metrics /usr/local/bin/cortexflow-metrics - -# Copy configuration files -COPY metrics_tracer /usr/src/cortexbrain-metrics/metrics_tracer +COPY --from=app-builder /usr/src/app/target/release/metrics /usr/local/bin/cortexflow-metrics +COPY --from=ebpf-builder /usr/src/app/target/bpfel-unknown-none/release/metrics_tracer /usr/src/cortexbrain-metrics/metrics_tracer -# Set environment variable ENV BPF_PATH="/usr/src/cortexbrain-metrics/metrics_tracer" ENV PIN_MAP_PATH="/sys/fs/bpf/trace_maps" -# Default command -CMD ["cortexflow-metrics"] +CMD ["cortexflow-metrics"] \ No newline at end of file diff --git a/core/src/components/metrics/build-metrics.sh b/core/src/components/metrics/build-local-metrics.sh similarity index 100% rename from core/src/components/metrics/build-metrics.sh rename to core/src/components/metrics/build-local-metrics.sh diff --git a/core/src/components/metrics/src/otel_init.rs b/core/src/components/metrics/src/otel_init.rs index e472c7e..349c41b 100644 --- a/core/src/components/metrics/src/otel_init.rs +++ b/core/src/components/metrics/src/otel_init.rs @@ -2,7 +2,7 @@ //! This module configures and bootstraps the OpenTelemetry SDK (OTel SDK) //! within the `metrics` binary. Its goal is to expose a [`Meter`] --- the //! primary entry-point for creating counters, gauges and histograms --- -//! backed by an **OTLP/gRPC** metric exporter. +//! backed by an OTLP metric exporter (gRPC or HTTP, depending on configuration). //! //! # Relationship to the rest of the crate //! @@ -28,18 +28,38 @@ use std::time::Duration; /// Environment variable that holds the OTLP collector endpoint. /// -/// Expected format: `"http://collector:4317"` (gRPC transport). +/// Expected format: `"http://collector:4317"` for gRPC or `"http://collector:4318"` for HTTP. /// pub const OTEL_EXPORTER_OTLP_ENDPOINT: &str = "OTEL_EXPORTER_OTLP_ENDPOINT"; +pub const OTEL_EXPORTER_OTLP_PROTOCOL: &str = "OTEL_EXPORTER_OTLP_PROTOCOL"; -/// Default OTLP endpoint used when [`OTEL_EXPORTER_OTLP_ENDPOINT`] is not +/// Default OTLP endpoints used when [`OTEL_EXPORTER_OTLP_ENDPOINT`] is not /// present in the environment. /// -/// Points to a locally-running OpenTelemetry Collector on the standard -/// **gRPC** port `4317`. Note that OTLP over HTTP typically uses `4318` --- -/// make sure your Collector is actually listening for **gRPC** traffic on the -/// port you configure. -pub const DEFAULT_OTLP_ENDPOINT: &str = "http://localhost:4317"; +/// `DEFAULT_OTLP_GRPC_ENDPOINT` is selected for protocol `grpc` (or unknown), +/// while `DEFAULT_OTLP_HTTP_ENDPOINT` is selected for `http/protobuf` and +/// `http/json`. +pub const DEFAULT_OTLP_GRPC_ENDPOINT: &str = "http://localhost:4317"; +pub const DEFAULT_OTLP_HTTP_ENDPOINT: &str = "http://localhost:4318"; + +fn default_otlp_endpoint_from_protocol() -> &'static str { + match env::var(OTEL_EXPORTER_OTLP_PROTOCOL) + .ok() + .map(|value| value.to_ascii_lowercase()) + .as_deref() + { + Some("http/protobuf") | Some("http/json") => DEFAULT_OTLP_HTTP_ENDPOINT, + _ => DEFAULT_OTLP_GRPC_ENDPOINT, + } +} + +fn resolved_otlp_protocol() -> String { + env::var(OTEL_EXPORTER_OTLP_PROTOCOL) + .ok() + .map(|value| value.to_ascii_lowercase()) + .filter(|value| !value.trim().is_empty()) + .unwrap_or_else(|| "grpc".to_string()) +} /// Singleton that owns the concrete `SdkMeterProvider` instance. /// OnceLock guarantees single initialisation, we avoid accidentally creating two providers (and @@ -52,13 +72,14 @@ pub const DEFAULT_OTLP_ENDPOINT: &str = "http://localhost:4317"; /// or Tokio task once populated. static METER_PROVIDER: OnceLock = OnceLock::new(); /// docs: -/// Initialise the OpenTelemetry SDK, wire up the OTLP/gRPC exporter, and +/// Initialise the OpenTelemetry SDK, wire up the OTLP exporter, and /// return a [`Meter`] ready for instrumenting the `metrics` crate. /// /// 1. Read the endpoint from [`OTEL_EXPORTER_OTLP_ENDPOINT`] with the -/// hard-coded default [`DEFAULT_OTLP_ENDPOINT`]. -/// 2. Build a `MetricExporter` using the Tonic / gRPC transport: -/// - with_tonic()` enables the Tonic-based gRPC client. +/// protocol-aware defaults [`DEFAULT_OTLP_GRPC_ENDPOINT`] and +/// [`DEFAULT_OTLP_HTTP_ENDPOINT`]. +/// 2. Build a `MetricExporter` using the transport resolved by +/// `OTEL_EXPORTER_OTLP_PROTOCOL`. /// - `with_endpoint()` sets the target Collector URL. /// - `with_timeout(Duration::from_secs(10))` caps each export RPC to 10 /// seconds; if the Collector is unreachable the RPC aborts instead of @@ -82,14 +103,22 @@ static METER_PROVIDER: OnceLock = OnceLock::new(); /// * The provider already having been initialised /// pub fn init_opentelemetry() -> Result { - let endpoint = - env::var(OTEL_EXPORTER_OTLP_ENDPOINT).unwrap_or_else(|_| DEFAULT_OTLP_ENDPOINT.to_string()); + let endpoint = env::var(OTEL_EXPORTER_OTLP_ENDPOINT) + .unwrap_or_else(|_| default_otlp_endpoint_from_protocol().to_string()); + let protocol = resolved_otlp_protocol(); - let exporter = MetricExporter::builder() - .with_tonic() - .with_endpoint(endpoint) - .with_timeout(Duration::from_secs(10)) - .build()?; + let exporter = match protocol.as_str() { + "http/protobuf" | "http/json" => MetricExporter::builder() + .with_http() + .with_endpoint(endpoint) + .with_timeout(Duration::from_secs(10)) + .build()?, + _ => MetricExporter::builder() + .with_tonic() + .with_endpoint(endpoint) + .with_timeout(Duration::from_secs(10)) + .build()?, + }; let reader = PeriodicReader::builder(exporter) .with_interval(Duration::from_secs(5)) diff --git a/core/src/components/metrics_tracer/build-metrics-tracer.sh b/core/src/components/metrics_tracer/build-local-metrics-tracer.sh similarity index 100% rename from core/src/components/metrics_tracer/build-metrics-tracer.sh rename to core/src/components/metrics_tracer/build-local-metrics-tracer.sh diff --git a/core/src/testing/agent.yaml b/core/src/testing/agent.yaml index 4633408..17f33b9 100644 --- a/core/src/testing/agent.yaml +++ b/core/src/testing/agent.yaml @@ -42,6 +42,15 @@ spec: echo "Running application..." exec /usr/local/bin/agent-api || echo "Application exited with code $?" + env: + - name: OTEL_SERVICE_NAME + value: cortexflow-agent + - name: OTEL_EXPORTER_OTLP_ENDPOINT + value: http://localhost:4317 + - name: OTEL_EXPORTER_OTLP_PROTOCOL + value: grpc + - name: OTEL_RESOURCE_ATTRIBUTES + value: service.namespace=cortexflow,service.version=0.1.5 volumeMounts: - name: bpf mountPath: /sys/fs/bpf diff --git a/core/src/testing/metrics.yaml b/core/src/testing/metrics.yaml index 8a6c7d8..fcae71b 100644 --- a/core/src/testing/metrics.yaml +++ b/core/src/testing/metrics.yaml @@ -36,6 +36,15 @@ spec: echo "Running application..." exec /usr/local/bin/cortexflow-metrics || echo "Application exited with code $?" + env: + - name: OTEL_SERVICE_NAME + value: cortexflow-metrics + - name: OTEL_EXPORTER_OTLP_ENDPOINT + value: http://localhost:4317 + - name: OTEL_EXPORTER_OTLP_PROTOCOL + value: grpc + - name: OTEL_RESOURCE_ATTRIBUTES + value: service.namespace=cortexflow,service.version=0.1.5 volumeMounts: - name: bpf mountPath: /sys/fs/bpf