mirror of
https://github.com/malarinv/iperf3-monitor.git
synced 2026-11-06 14:50:28 +00:00
feat(exporter): implement subprocess execution with active stall watchdog and TCP metrics (#26)
- Replace in-process iperf3 C binding with subprocess execution - Add active I/O stall detection and connect-timeout - Expose TCP retransmissions, mean RTT (ms), and exporter cycle timestamp - Upgrade Dockerfile to Python 3.12 running as non-root user (nobody) - Fix testTimeout/testDuration environment variable mapping in Helm chart - Remove dead TrueCharts prometheus-operator chart dependency - Add unit tests for exporter metric parsing and stall handling - Switch tooling from devbox to mise Co-authored-by: Malarbase <malarbase@gmail.com>
This commit is contained in:
@@ -1,34 +1,24 @@
|
||||
# Stage 1: Build stage with dependencies
|
||||
FROM python:3.9-slim as builder
|
||||
FROM python:3.12-slim AS builder
|
||||
|
||||
# Declare TARGETARCH for use in this stage
|
||||
ARG TARGETARCH
|
||||
WORKDIR /app
|
||||
|
||||
# Minimal dependencies for builder stage if any Python packages had C extensions.
|
||||
# Assuming requirements.txt does not need gcc or other build tools for now.
|
||||
# If pip install fails later, add necessary build tools (e.g., gcc, python3-dev) here.
|
||||
RUN apt-get update && \
|
||||
# apt-get install -y --no-install-recommends gcc python3-dev # Example if needed
|
||||
rm -rf /var/lib/apt/lists/*
|
||||
|
||||
# Install Python dependencies
|
||||
COPY requirements.txt .
|
||||
RUN pip install --no-cache-dir -r requirements.txt
|
||||
RUN pip install --no-cache-dir --prefix=/install -r requirements.txt
|
||||
|
||||
# Stage 2: Final runtime stage
|
||||
FROM python:3.9-slim
|
||||
FROM python:3.12-slim
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
# Install iperf3 and its runtime dependency libsctp1 directly in the final stage.
|
||||
# This simplifies the Dockerfile by removing the need to copy iperf3 components from the builder.
|
||||
# Install iperf3
|
||||
RUN apt-get update && \
|
||||
apt-get install -y --no-install-recommends iperf3 libsctp1 && \
|
||||
apt-get install -y --no-install-recommends iperf3 && \
|
||||
rm -rf /var/lib/apt/lists/*
|
||||
|
||||
# Copy installed Python packages from the builder stage
|
||||
COPY --from=builder /usr/local/lib/python3.9/site-packages /usr/local/lib/python3.9/site-packages
|
||||
COPY --from=builder /install /usr/local
|
||||
|
||||
# Copy the exporter application code
|
||||
COPY exporter.py .
|
||||
@@ -36,5 +26,9 @@ COPY exporter.py .
|
||||
# Expose the metrics port
|
||||
EXPOSE 9876
|
||||
|
||||
# Run as non-root user (nobody)
|
||||
USER 65534:65534
|
||||
|
||||
# Set the entrypoint
|
||||
CMD ["python", "exporter.py"]
|
||||
|
||||
|
||||
Reference in New Issue
Block a user