Observability on KubeArchive
KubeArchive emits observability data using OpenTelemetry: metrics, traces and logs. Environment variables on KubeArchive’s components control the enablement and configuration of features related with observability.
Custom Metrics
KubeArchive exposes the following custom metrics:
kubearchive.cloudevents.total
Labels: result
, event_type
resource_type
Tracks the total number of Cloud Events (resource updates) received aggregated by resource_type
,
event_type
and result
.
-
result
: one ofinsert
,update
,none
,error
orno_match
.none
is returned when the Cloud Event contains data older than the one already persisted (out of order). -
resource_type
: a combination of the resourceapiVersion
andkind
. For exampleapps/v1/Deployment
,v1/Pods
ortekton.dev/v1/PipelineRun
. -
event_type
: one ofdev.knative.apiserver.resource.new
,dev.knative.apiserver.resource.update
ordev.knative.apiserver.resource.delete
.
Configuring Observability
The following environment variables present on all of the KubeArchive components and control the observability behavior:
-
KUBEARCHIVE_OTEL_MODE
: one of "enabled", "delegated" or "disabled". Defaults to "disabled". It controls when observability data is sent toOTEL_EXPORTER_OTLP_ENDPOINT
:-
"disabled": do not send traces or metrics.
-
"enabled": always send traces and metrics. Useful for observability in development.
-
"delegated": always send metrics but send traces only when the incoming request sent its traces (see W3 Trace Context
sampled
flag). Useful for observability in production.
-
-
OTEL_EXPORTER_OTLP_ENDPOINT
: an OTLP compatible endpoint where traces are sent. By default it is set to an empty string. -
KUBEARCHIVE_OTLP_SEND_LOGS
: if set to "true" logs are sent to theOTEL_EXPOTER_OTLP_ENDPOINT
and not printed to stdout. Defaults to "false", so logs are printed on stdout by default. When enabled, a single log line is printed to stdout informing that logs will be redirected.
To change these environment variables values, edit or patch KubeArchive’s
components: deployments/kubearchive-api-server
, deployments/kubearchive-sink
and deployments/kubearchive-operator
.