Install telemetry¶
Point the pod at an OpenTelemetry collector, then install the alerts and Grafana dashboard. Telemetry lists the metrics and alerts.
Before you start¶
-
You need an OTLP collector (
http/protobuf) and, on the cluster that holds Grafana, the grafana-operator with itsGrafanaFolderandGrafanaDashboardkinds. -
You need a ruler that reads
VMRule, orPrometheusRulewithalerts.format: prometheusrule. -
The chart refuses a non-http(s) endpoint, an
extraEnvname without theOTEL_prefix, andOTEL_EXPORTER_OTLP_ENDPOINTinextraEnv;helm templatenames the key. -
extraEnvrenders as plain values; putOTEL_EXPORTER_OTLP_HEADERSwith a token in a Secret viasecretEnv. -
Alerts and dashboards are separate releases: each renders only its own objects.
Steps¶
- Add this to the release values, then
helm templateandhelm upgrade; an emptyendpointrenders nothing.
telemetry:
otlp:
endpoint: http://otlp-gateway.observability.svc:4318
protocol: http/protobuf # the default
extraEnv: # any other OTEL_* variable
OTEL_TRACES_SAMPLER: parentbased_traceidratio # optional: a tenth of root traces
OTEL_TRACES_SAMPLER_ARG: "0.1"
- Install the alerts.
alerts.ruleLabelsadds labels to every rule beside itsseverity;alerts.rules.<rule>.labelsto one rule.alerts.runbookBaseUrlsets the runbook link (empty: none). Thresholds arealerts.rules.<rule>.*.
# alerts.yaml
renders: alerts
alerts:
namespace: sluis # where the service runs; on Lambda: lambda,
# namespaceLabel: k8s_namespace_name # with this label, for the function's series
ruleLabels:
k8s_cluster_name: prod # for the Alertmanager routing tree
helm template sluis-alerts oci://ghcr.io/truvity/charts/sluis --version X.Y.Z -n monitoring -f alerts.yaml
helm install sluis-alerts oci://ghcr.io/truvity/charts/sluis --version X.Y.Z -n monitoring -f alerts.yaml
- Install the dashboards in namespace
sluison the cluster that holds Grafana.
# dashboards.yaml
renders: dashboards
dashboards:
clusterFolderUID: prod # folder.uid of the observability-cluster chart; at most 25 characters
datasources:
metrics: prod-metrics # the uids of the Grafana's datasources
logs: prod-logs # read by the sluis-lambda dashboard
# instanceSelector: {} # the shared Grafana by default
The uids end -sluis-overview, -sluis-audit and -sluis-lambda.
helm install sluis-dashboards oci://ghcr.io/truvity/charts/sluis --version X.Y.Z -n sluis -f dashboards.yaml
Verify¶
-
The pod has the
OTEL_*variables; after a minutesluis_http_requests_totalhas series. -
The ruler lists one group of twelve rules, none erroring.
-
The shared Grafana has
<cluster> / sluiswith three dashboards, each with a$clustervariable. - A log line written inside a request carries
trace_id,span_idandtrace_flags(W3C hex), the trace's own id; a line outside a span has none. Logs stay on stdout. In Lambda the OTLP layer forwards only platform events, so function logs reach CloudWatch Logs only.
A rule with no series does not fire; the platform's scrape alert covers a down service.
Roll back¶
Empty endpoint and upgrade, then helm uninstall sluis-alerts -n monitoring and helm uninstall sluis-dashboards -n sluis.