Operator Metrics
Prometheus scraping and OTLP push for Spice.ai Kubernetes Operator self-telemetry.
The operator emits self-telemetry about its own behavior (controller reconcile counts and durations, Kubernetes API call latencies, managed-resource counts, and certificate expiry) through two independent readers:
- Prometheus scraping: always on. The operator exposes a
/metricsendpoint for pull-based collection. - OTLP push: opt-in. The operator pushes metrics to an OpenTelemetry collector or a compatible vendor endpoint.
Both readers can run at the same time and observe the same instruments.
Prometheus scraping
The operator serves Prometheus metrics on its metrics bind address (--metrics-bind-address, default 0.0.0.0:9090) at /metrics. This reader is always enabled.
kubectl -n spiceai-operator-system port-forward deploy/spiceai-operator 9090:9090
curl http://localhost:9090/metricsIf the Prometheus Operator is installed, enable a ServiceMonitor so the operator is scraped automatically:
# Helm values for the operator
serviceMonitor:
enabled: true
interval: 30sOTLP push
OTLP export is disabled by default. Enable it through the chart's telemetry.otlp values:
# Helm values for the operator
telemetry:
otlp:
enabled: true
endpoint: http://otel-collector.observability.svc:4317
protocol: grpc # grpc | http/protobuf
metrics:
temporality: delta # cumulative | delta | lowmemory
pushInterval: 30s # export interval (default 30s)
extraEnv:
- name: OTEL_EXPORTER_OTLP_HEADERS
valueFrom:
secretKeyRef:
name: otlp-auth # holds a value such as authorization=Bearer <token>
key: headerstelemetry.otlp.headers sends each value as written: Helm and Kubernetes do not expand ${...} in it. To read a header value from a Secret, leave it out of headers and set OTEL_EXPORTER_OTLP_HEADERS through extraEnv, as the example above does.
These values configure the operator through the standard OpenTelemetry SDK environment variables, which you can also set directly (for example via extraEnv):
| Environment variable | Description | Example |
|---|---|---|
OTEL_EXPORTER_OTLP_ENDPOINT | Base OTLP endpoint for all signals. | http://otel-collector:4317 |
OTEL_EXPORTER_OTLP_METRICS_ENDPOINT | Metrics-specific endpoint override, used as written. This example needs http/protobuf, which an unset protocol infers from http://. | http://otel-collector:4318/v1/metrics |
OTEL_EXPORTER_OTLP_PROTOCOL | Transport protocol: grpc or http/protobuf. | grpc |
OTEL_EXPORTER_OTLP_HEADERS | Comma-separated key=value headers (e.g. authentication). | authorization=Bearer abc123 |
OTEL_EXPORTER_OTLP_METRICS_TEMPORALITY_PREFERENCE | Aggregation temporality: cumulative, delta, or lowmemory. | delta |
OTEL_METRIC_EXPORT_INTERVAL | Export interval: integer milliseconds, or a duration such as 30s. | 60000 |
OTEL_SERVICE_NAME | service.name resource attribute (default spice-k8s-operator). | spice-k8s-operator |
OTEL_RESOURCE_ATTRIBUTES | Additional resource attributes as key=value pairs. | deployment.environment=prod |
Choose the right temporality
The correct aggregation temporality depends on your backend. Most hosted observability vendors expect delta, while Prometheus-compatible time-series databases expect cumulative.
| Backend | Recommended temporality |
|---|---|
| Datadog | delta |
| AWS CloudWatch | delta |
| New Relic | delta |
| Prometheus, Grafana Mimir, Cortex, Thanos, VictoriaMetrics | cumulative |
| Memory-constrained collectors | lowmemory |
lowmemory uses delta temporality for counters and histograms (which can be reset after export) while keeping gauges and up-down counters cumulative, minimizing in-process state for resource-constrained deployments.
Metric prefix
A configurable prefix is prepended to every metric name. It applies to both the Prometheus and OTLP readers, so dashboards and alerts stay consistent regardless of how metrics are collected. Set it with the Helm value telemetry.otlp.metrics.prefix (environment variable OTEL_SPICE_METRICS_PREFIX) to namespace operator metrics within a shared backend, for example spice_operator_. The chart sets the variable only when telemetry.otlp.enabled is true. To use a prefix without OTLP, set OTEL_SPICE_METRICS_PREFIX through extraEnv.
Metric whitelist (OTLP only)
The OTLP reader supports an optional allow-list to restrict which metrics are exported. Use it to limit cardinality or cost on a hosted backend. Set it with the Helm value telemetry.otlp.metrics.whitelist, a list of metric names (environment variable OTEL_SPICE_METRICS_WHITELIST, comma-separated). When set, only the named metrics are pushed over OTLP.
Example: OpenTelemetry Collector
A minimal collector configuration that receives the operator's OTLP metrics and forwards them to a backend:
receivers:
otlp:
protocols:
grpc:
endpoint: 0.0.0.0:4317
processors:
batch: {}
exporters:
prometheusremotewrite:
endpoint: https://mimir.example.com/api/v1/push
# or: datadog, awsemf, otlphttp, ...
service:
pipelines:
metrics:
receivers: [otlp]
processors: [batch]
exporters: [prometheusremotewrite]Point the operator at the collector's OTLP gRPC port (4317) and choose temporality: cumulative for the Prometheus-remote-write path above, or delta when exporting to Datadog / CloudWatch / New Relic.
Resilient initialization
An invalid telemetry setting stops the operator at startup with an error, for example an unknown OTEL_EXPORTER_OTLP_PROTOCOL or temporality value. Check the operator logs after you change telemetry.otlp.*. If the settings are valid but the OTLP exporter cannot be built, the operator logs the error and continues with the Prometheus reader. Export failures never block reconciliation, so a metrics outage cannot take down your workloads.
See also
- Overview: Helm Values: the
telemetry.otlp.*andserviceMonitor.*values. - SpicepodSet: Monitoring: telemetry properties for the Spiced runtime.