Replace transmission-exporter with homegrown Python exporter #283
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "feature/transmission-exporter-python"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
metalmatze/transmission-exporter:mastersidecar with a homegrown Python exporterprometheus_client+transmission-rpcwith collect-on-scrape pattern (fresh metrics per scrape, no stale labels)uvfor dependency management, followsgrafana-sidecarDockerfile patternChanges
containers/transmission-exporter/exporter.py— single-file exporter (~130 lines)containers/transmission-exporter/Dockerfile— multi-stage Alpine build with uvargocd/manifests/torrent/deployment.yaml— swap sidecar image referenceargocd/manifests/torrent/kustomization.yaml— add image tag entryservice-versions.yaml— add transmission-exporter entryDeployment and Testing
mise run container-build-and-release transmission-exporterargocd app set torrent --revision feature/transmission-exporter-python && argocd app sync torrentkubectl -n torrent --context=minikube-indri port-forward svc/transmission 19091:19091thencurl localhost:19091/metrics | grep transmission_argocd app set torrent --revision main && argocd app sync torrent@ -12,2 +12,4 @@- name: registry.ops.eblu.me/blumeops/transmissionnewTag: v4.1.1-r1-ab34cbd- name: registry.ops.eblu.me/blumeops/transmission-exporternewTag: v1.0.0just checking, you probably know this already, but you'll need to include the sha of the commit as well once this is built.
@ -0,0 +3,4 @@ARG CONTAINER_APP_VERSION=1.0.0FROM python:3.12-alpine3.22 AS baseLet's use the latest stable python and alpine if possible, no reason to start out behind the curve on this greenfield project
@ -0,0 +9,4 @@WORKDIR /appCOPY --from=ghcr.io/astral-sh/uv:latest /uv /usr/local/bin/uvCOPY exporter.py .RUN uv venv .venv && \I actually dont think you even need to uv pip install anything or venv anything. Just use a uv run --script shebang on the python script, uv will take care of the rest at runtime
@ -0,0 +1,154 @@# /// scriptyes as mentioned above, please use a shebang line like the mise-tasks use to run
uv run --scripthere@ -0,0 +2,4 @@# requires-python = ">=3.12"# dependencies = [# "prometheus-client>=0.24,<1.0",# "transmission-rpc>=7.0,<8.0",and for these deps, either unpin them or at least make sure we're using the most recent versions (that will work).
@ -0,0 +147,4 @@# Block foreverimport threadingthreading.Event().wait()wait really, is this idiomatic for transmission's start_http_server func? You need to just block the caller forever... not like await an async or poll an event loop or something?