my-homelab-configs/apps/opentelemetry-lab
juvenal.diaz 0766e4f081
Homelab Main / validate (push) Successful in 1m16s Details
Homelab Main / running-update (push) Successful in 6s Details
Homelab Main / debian-ops (push) Failing after 8s Details
Add OpenTelemetry tracing learning lab
2026-11-09 20:56:34 -06:00
..
README.md Add OpenTelemetry tracing learning lab 2026-11-09 20:56:34 -06:00
collector.yaml Add OpenTelemetry tracing learning lab 2026-11-09 20:56:34 -06:00
grafana-datasource.yaml Add OpenTelemetry tracing learning lab 2026-11-09 20:56:34 -06:00
kustomization.yaml Add OpenTelemetry tracing learning lab 2026-11-09 20:56:34 -06:00
tempo.yaml Add OpenTelemetry tracing learning lab 2026-11-09 20:56:34 -06:00
trace-demo.yaml Add OpenTelemetry tracing learning lab 2026-11-09 20:56:34 -06:00
trace_demo.py Add OpenTelemetry tracing learning lab 2026-11-09 20:56:34 -06:00

README.md

OpenTelemetry trace lab

This small, profile-independent lab is managed by ./jeannie apps through Argo CD in the existing monitoring namespace. It adds a single OpenTelemetry Collector, a single Tempo server, a Grafana Tempo Lab datasource, and a five-minute synthetic trace job. Existing Prometheus and Loki are unchanged.

The path is synthetic trace job → OTLP/HTTP collector → OTLP/gRPC Tempo → Grafana Explore. The job emits a parent span and child span for two simulated services; it does not make real service calls or use the OpenTelemetry SDK. This isolates the first lesson—trace IDs, span IDs, parent/child relationships, collection and storage. The next step is instrumenting real applications.

Tempo stores traces in a size-limited emptyDir. Traces are disposable and disappear when the Tempo pod is replaced or the node is lost; this is not a backup or production storage. Retention is at most 24 hours while the pod and its local volume survive, subject to the storage limit. The lab adds workload resource requests and image pulls on every cluster profile. Neither endpoint is published as an Ingress or NodePort; cluster-internal OTLP is unauthenticated and unencrypted, so send only non-sensitive learning data.

After pushing the repository changes, on Debian select the intended profile and apply the apps pipeline:

cd ~/my-homelab-configs
git pull --ff-only gitea main
./jeannie cluster-profile select k3s
./jeannie apps

Use debian or pimox instead of k3s when that profile is your intended active cluster. On Debian, check the workloads and datasource:

kubectl --kubeconfig="$HOME/.kube/opi5-k3s-config" -n monitoring \
  get deployment otel-lab-collector otel-lab-tempo
kubectl --kubeconfig="$HOME/.kube/opi5-k3s-config" -n monitoring \
  get cronjob otel-lab-demo

The job runs every five minutes. In Grafana, open Explore → Tempo Lab → Search, choose jeannie-demo-frontend as the service and run the query. Open a trace to inspect its child span. The datasource relies on the Grafana datasource sidecar enabled by the platform chart. For immediate testing, create one job and inspect its trace ID:

kubectl --kubeconfig="$HOME/.kube/opi5-k3s-config" -n monitoring \
  create job --from=cronjob/otel-lab-demo otel-lab-demo-manual
kubectl --kubeconfig="$HOME/.kube/opi5-k3s-config" -n monitoring \
  logs job/otel-lab-demo-manual

The printed trace ID can be pasted into Grafana's Tempo trace-ID query. A successful generator job confirms the collector accepted the request; check Tempo and Grafana as well to establish end-to-end visibility. Manual job names must be unique, or wait for Kubernetes' job TTL to remove the previous one. ConfigMaps are mounted as files; restart the relevant deployment after changing its configuration because these binaries do not automatically reload it.