GitOps-Deployed Observability Pipelines: From Sampling to Grafana
āWe installed Grafanaā tells you almost nothing about observability. The decisions that actually matter sit behind it. Which Traces do you discard? What Metadata do you attach? Where do Traces, Metrics, and Logs live, and for how long? And does alerting actually exist?
By the time you have read up to Delivering Secrets to Kubernetes Workloads with Workload Identity and CSI, your applications already deploy declaratively. This article walks the pipeline that signals flow through on that same GitOps boundary. Storage cost and signal quality are set at each stage of that pipeline, not by which backend product you picked.
Instrumentation starts on the application side
Section titled āInstrumentation starts on the application sideāFor Java applications, attaching an agent without code changes is the lowest-cost starting point. It comes down to a handful of environment variables in the Deployment overlay.
env: - name: JDK_JAVA_OPTIONS value: "-XX:+UseContainerSupport -javaagent:/app/bin/opentelemetry-javaagent.jar" - name: OTEL_EXPORTER_OTLP_ENDPOINT value: http://otel-collector.observability:4318 - name: OTEL_SERVICE_NAME value: orders-api - name: OTEL_RESOURCE_ATTRIBUTES value: "service.namespace=orders" - name: OTEL_INSTRUMENTATION_MICROMETER_ENABLED value: "true" - name: OTEL_INSTRUMENTATION_LOGBACK_ENABLED value: "true"Three things matter. First, the exporter endpoint is an in-cluster service DNS name. The application has no idea whether the backend is Tempo or Mimir, and that ignorance is what makes backend replacement possible. Second, OTEL_SERVICE_NAME and service.namespace become the axes of every later query. Changing the naming convention afterwards severs continuity with historical data, so fix it early. Third, the agent emits Metrics and Logs over the same OTLP path as Traces, so all three signals share identical resource attributes. That is the foundation of jumping from a Trace to its Logs later.
The collector is a Deployment, not a DaemonSet
Section titled āThe collector is a Deployment, not a DaemonSetāHow you deploy the collector depends on what you are collecting.
- A DaemonSet runs one instance per node. It is required for collection that must be node-local, such as reading host log files or scraping kubelet metrics.
- A Deployment runs a few replicas behind a service. When applications push OTLP, node locality is irrelevant, and this shape suits processing that needs all spans of one Trace in one place, such as tail sampling.
This article deals with application telemetry, so it uses deployment mode. Tail sampling does introduce one constraint: if spans sharing a traceID scatter across replicas, the sampling decision fragments. Scaling out requires traceID-aware load balancing in front, or a separate sampling tier. Simply increasing the replica count is not safe scaling.
Kubernetes Metadata is attached through a preset.
mode: deployment
presets: kubernetesAttributes: enabled: true extractAllPodLabels: true extractAllPodAnnotations: falseextractAllPodLabels is convenient but not free. Labels become resource attributes verbatim, so a team that adds labels liberally quietly raises cardinality. Leaving annotations off is therefore sensible, annotations tend to hold long strings injected by deployment tooling.
The stages of the pipeline
Section titled āThe stages of the pipelineāThe key property of this diagram is that only Traces pass through filter and tail sampling. Metrics arrive pre-aggregated and are not sampling candidates, and Log reduction is a separate policy problem.
Decide what to discard first
Section titled āDecide what to discard firstāThe cheapest storage is data you never store. The filter processor is the first reduction point.
processors: filter: error_mode: ignore traces: span: - IsMatch(attributes["http.route"], ".*actuator.*") - attributes["code.function"] == "handle"Health checks and metric scrape endpoints are called every few seconds and carry almost no diagnostic value. Such spans easily account for a large share of total span volume. error_mode: ignore means a failed condition evaluation will not kill the pipeline, and that deserves scrutiny: if a condition is silently voided, data keeps flowing, so you must confirm the filter is actually working through the collectorās own metrics.
The second caution is that attribute-based removal is fragile against route renaming. A pattern like .*actuator.* silently filters nothing once the frameworkās endpoint paths change. You need a recurring check of the real span name distribution.
Tail sampling is a combination of policies
Section titled āTail sampling is a combination of policiesāHead sampling decides at Trace start, so it cannot know whether the Trace ended in an error. Tail sampling decides after the Trace has (mostly) completed, so it can selectively retain errors and slow requests.
tail_sampling: decision_wait: 10s num_traces: 1000 expected_new_traces_per_sec: 100 policies: - name: slow type: latency latency: { threshold_ms: 500 } - name: errors type: status_code status_code: { status_codes: [ERROR] } - name: baseline type: probabilistic probabilistic: { sampling_percentage: 5 }Policies combine as OR. A Trace is kept if it exceeds 500ms, or carries ERROR status, or falls in the 5% baseline sample of everything else. Each policy answers a different question. The latency policy answers ācan I investigate requests that violated the SLO?ā, the error policy answers āam I missing any failures?ā, and the probabilistic policy answers ādo I have a baseline of normal behaviour to compare against?ā. Drop the third and your Trace store contains only errors and slow requests, leaving you unable to answer what normal looked like.
These numbers are tuning inputs, not universal defaults. 500ms must come from that serviceās SLO, and 5% must come from normal traffic volume and storage budget. decision_wait: 10s means Traces slower than that can be truncated, so it must exceed the real p99 response time. num_traces and expected_new_traces_per_sec directly determine collector memory usage and must be raised alongside traffic growth, otherwise the memory limiter starts dropping data.
The resource processor handles the final cleanup.
resource: attributes: - key: service.instance.id from_attribute: k8s.pod.uid action: insertPromoting the Pod UID to an instance identifier makes āa problem that only occurs on one replicaā distinguishable. action: insert means an existing value is not overwritten, respecting anything the application set itself.
Backends differ in role and in cost structure
Section titled āBackends differ in role and in cost structureāThe reason not to put all three signals in one store is that their query patterns and retention needs are entirely different.
| Signal | Backend role | Dominant query pattern | Cost driver | Reasonable retention |
|---|---|---|---|---|
| Trace | Retrieve individual executions by traceID or attributes | Short-window deep investigation after an incident | Span count and per-span attribute size | Short (days) |
| Metric | Time-series aggregation and trends | Dashboards and long-term comparison | Number of active series, i.e. label cardinality | Long (months to years) |
| Log | Text search and context | A narrow time window arrived at from a Trace | Ingested bytes and number of indexed labels | Medium |
All three backends use object storage as their real store and keep only ingest and query components in the cluster. This separation matters because retention is then controlled at the storage layer rather than by Kubernetes.
storage: trace: backend: azure azure: container_name: trace-chunks storage_account_name: <storage-account>Splitting containers per signal lets you apply different lifecycle rules per signal: delete the Trace container after 30 days, move the Metric container to a cheaper tier, each independently. Put everything in one container and the longest retention applies to all data, with cost set by the most expensive signal.
Rather than embedding a storage account key in the backend configuration, use workload identity as described in Delivering Secrets to Kubernetes Workloads with Workload Identity and CSI. A backend component is, after all, just another workload.
What is actually provisioned in Grafana, and what is not
Section titled āWhat is actually provisioned in Grafana, and what is notāThis is the easiest place to overstate things. You have to open the actual chart configuration and see what is switched on.
Datasources are provisioned. The values contain datasource definitions, including cross-signal linking.
datasources: datasources.yaml: apiVersion: 1 datasources: - name: mimir type: prometheus url: http://mimir-gateway.mimir/prometheus - name: loki type: loki url: http://loki-gateway.loki - name: tempo type: tempo url: http://tempo-gateway.tempo jsonData: tracesToLogsV2: datasourceUid: loki spanStartTimeShift: "-10m" spanEndTimeShift: "10m" filterByTraceID: true tracesToMetrics: datasourceUid: mimirtracesToLogsV2 and tracesToMetrics are the substantive value here. From a single span you can jump in one click to the Logs of that time window or to related Metrics. This linkage works only because the instrumentation stage made all three signals share resource attributes. Decisions made at the front of the pipeline are cashed in here.
Dashboards and alerting are not provisioned. Inspection shows dashboardProviders, dashboards, and dashboardsConfigMaps all empty, the sidecarās dashboards.enabled and alerts.enabled both false, and alerting and notifiers empty. The backends match: Mimirās and Lokiās ruler are disabled, as is Alertmanager.
Stated honestly: this configuration has no automated alerting. A collection of dashboard JSON files in a repository is an export library, not provisioning, and a sentence in a document saying āthis value is dangerous when exceededā is not an alert. To claim alerting exists you need, at minimum, a ruler evaluating rules, an Alertmanager or Grafana unified alerting receiving the results, and a real contact point. Missing any of the three makes it a gap.
Development configuration versus production hardening
Section titled āDevelopment configuration versus production hardeningāThis pipeline was validated on the development cluster aks-platform-dev-01, and development-oriented simplifications appear in several places.
| Item | Development configuration | Required in production |
|---|---|---|
| Backend replicas | Mostly single replica | Redundancy on both ingest and query paths, restartable without outage |
| In-cluster transport | Plaintext HTTP over service DNS | mTLS or service-mesh-level transport protection |
| Collector scaling | A single collector deployment | traceID-aware load balancing with a separate sampling tier |
| Alerting | None | Enable the ruler, an Alertmanager or unified alerting, contact points and silence policy |
| Dashboards | Created by hand | Declarative provisioning via sidecar or provider, with change history |
| Retention policy | Defaults | Per-signal lifecycle rules and cost observation |
| Watching the collector itself | Only self-metrics exposed | Alert on dropped spans, refused data, and memory limiter activation |
That last row matters most. If the observability pipeline itself fails quietly, you cannot distinguish āthere are no incidentsā from āno data is arriving.ā Exporter failure counts and refused-data counts on the collector must be under observation.
Summary
Section titled āSummaryāObservability quality and cost are determined by naming conventions at instrumentation, the collectorās deployment shape, filter and tail sampling policy, per-signal backends and object storage lifecycle, and what is genuinely provisioned as datasources and alerts. Grafana is the last window onto this pipeline, not the pipeline itself.
And it matters not to claim what you have not verified. This configuration is declaratively complete through signal collection and cross-signal query linking, but alert automation remains a next step. Calling a gap a gap is the only way a pipeline actually gets finished.