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:

  1. Prometheus scraping: always on. The operator exposes a /metrics endpoint for pull-based collection.
  2. 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/metrics

If the Prometheus Operator is installed, enable a ServiceMonitor so the operator is scraped automatically:

# Helm values for the operator
serviceMonitor:
  enabled: true
  interval: 30s

OTLP 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: headers

telemetry.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 variableDescriptionExample
OTEL_EXPORTER_OTLP_ENDPOINTBase OTLP endpoint for all signals.http://otel-collector:4317
OTEL_EXPORTER_OTLP_METRICS_ENDPOINTMetrics-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_PROTOCOLTransport protocol: grpc or http/protobuf.grpc
OTEL_EXPORTER_OTLP_HEADERSComma-separated key=value headers (e.g. authentication).authorization=Bearer abc123
OTEL_EXPORTER_OTLP_METRICS_TEMPORALITY_PREFERENCEAggregation temporality: cumulative, delta, or lowmemory.delta
OTEL_METRIC_EXPORT_INTERVALExport interval: integer milliseconds, or a duration such as 30s.60000
OTEL_SERVICE_NAMEservice.name resource attribute (default spice-k8s-operator).spice-k8s-operator
OTEL_RESOURCE_ATTRIBUTESAdditional 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.

BackendRecommended temporality
Datadogdelta
AWS CloudWatchdelta
New Relicdelta
Prometheus, Grafana Mimir, Cortex, Thanos, VictoriaMetricscumulative
Memory-constrained collectorslowmemory

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