Skip to main content

Observability

Overview

Since v1.1.0, OpenKruiseGame provides built-in observability support based on OpenTelemetry, including structured logging, distributed tracing, and performance profiling.

Structured Logging

OKG supports configurable log format output:

Log Format

Configure via the --log-format flag:

  • console (default): human-readable console format
  • json: structured JSON format for log aggregation systems

JSON Preset

When using JSON format, configure the field layout via --log-json-preset:

  • kibana: traditional Kibana-compatible field layout
  • otel: OpenTelemetry semantic conventions

OTLP Log Export

Enable log export to an OpenTelemetry Collector:

  • --enable-otel-logs=true: enables OTLP log export
  • Requires --otel-collector-endpoint to be configured

Distributed Tracing

OKG supports OpenTelemetry distributed tracing to track request flows across controller reconciliation cycles.

Configuration

FlagDescriptionDefault
--enable-tracingEnable OpenTelemetry tracingfalse
--otel-collector-endpointOTel Collector OTLP gRPC endpointlocalhost:4317
--otel-collector-tokenAuthentication token for OTLP endpoint (optional)""
--otel-sampling-rateSampling rate (0.0 to 1.0)1.0

Integration with OpenTelemetry Collector

Deploy an OpenTelemetry Collector in your cluster and configure kruise-game to export traces:

# Helm values example
kruiseGame:
tracing:
enabled: true
collectorEndpoint: "otel-collector.monitoring:4317"
samplingRate: 0.5

Performance Profiling (pprof)

OKG supports Go pprof for runtime performance analysis:

  • --pprof-bind-address: Set the bind address to enable pprof (e.g., :8083). Empty value disables pprof.

When enabled, access profiling data at http://<pod-ip>:8083/debug/pprof/.

Example usage:

kubectl port-forward -n kruise-game-system deploy/kruise-game-controller-manager 8083:8083
go tool pprof http://localhost:8083/debug/pprof/heap

Helm Chart Configuration

The following values.yaml parameters correspond to the observability features:

ParameterDescriptionDefault
kruiseGame.logging.formatLog output formatconsole
kruiseGame.logging.jsonPresetJSON log presetkibana
kruiseGame.logging.enableOTelLogsEnable OTLP log exportfalse
kruiseGame.tracing.enabledEnable tracingfalse
kruiseGame.tracing.collectorEndpointCollector endpointlocalhost:4317
kruiseGame.tracing.collectorTokenAuth token""
kruiseGame.tracing.samplingRateSampling rate1.0
kruiseGame.pprof.bindAddresspprof bind address""