Skip to content

Configuration Reference

Klag is configured via src/main/resources/application.properties, an external config file, or environment variables. Resolution order is classpath → external file → env vars (env vars win).

VariableDefaultDescription
HTTP_PORT8888HTTP server port.
KAFKA_HEALTH_CHECK_INTERVAL_MS30000Health-check interval.
VERTX_USE_VIRTUAL_THREADSfalseUse virtual threads.
VariableDefaultDescription
KAFKA_BOOTSTRAP_SERVERSlocalhost:9092Broker addresses.
KAFKA_REQUEST_TIMEOUT_MS30000Request timeout.
KAFKA_CHUNK_COUNT1Split offset requests into N batches.
KAFKA_CHUNK_DELAY_MS0Delay (ms) between batches.

For SASL/SSL, set KAFKA_SECURITY_PROTOCOL, KAFKA_SASL_MECHANISM, and KAFKA_SASL_JAAS_CONFIG. See Installation.

VariableDefaultDescription
METRICS_REPORTERnonenone, prometheus, datadog, or otlp.
METRICS_INTERVAL_MS60000How often to collect metrics.
METRICS_GROUP_FILTER*Comma-separated glob include patterns.
METRICS_GROUP_EXCLUDE(empty)Comma-separated glob exclude patterns.
METRICS_JVM_ENABLEDfalseExport JVM metrics.
LAG_TREND_DEADBAND_MSG_PER_SEC1.0STABLE band for the MCP lag-trend classifier.

A group is monitored iff it matches any include segment and no exclude segment. See Group Filtering.

VariableDefaultDescription
HOT_PARTITION_ENABLEDtrueEnable hot-partition detection.
HOT_PARTITION_SIGMA_MULTIPLIER2.0Std-devs for the outlier threshold.
HOT_PARTITION_MIN_PARTITIONS3Min partitions per topic for detection.
HOT_PARTITION_MIN_SAMPLES3Min samples for throughput calc.
HOT_PARTITION_BUFFER_SIZE20Samples retained per partition.
VariableDefaultDescription
TIME_LAG_ENABLEDtrueEnable time-based lag estimation.
TIME_LAG_MIN_MESSAGES100Min lag messages for time-to-close estimates.
TIME_LAG_INTERPOLATION_BUFFER_SIZE60Offset/timestamp points per partition.
TIME_LAG_STALE_PRODUCER_THRESHOLD_MS180000Time before a producer is considered stale.
VariableDefaultDescription
MCP_ENABLEDfalseExpose the /mcp endpoint (opt-in).
MCP_AUTH_TOKEN(empty)Require Authorization: Bearer <token> when set.
MCP_PATH/mcpHTTP path of the MCP endpoint.

See MCP Endpoint for details.

Standard OpenTelemetry variables:

VariableDescription
OTEL_EXPORTER_OTLP_ENDPOINTBase endpoint (e.g. http://localhost:4318).
OTEL_EXPORTER_OTLP_METRICS_ENDPOINTMetrics-specific endpoint (overrides base).
OTEL_EXPORTER_OTLP_HEADERSAuth headers (key1=value1,key2=value2).
OTEL_EXPORTER_OTLP_METRICS_HEADERSMetrics-specific headers.
OTEL_METRIC_EXPORT_INTERVALExport interval (ms), default 60000.
OTEL_SERVICE_NAMEService name, default klag.
OTEL_RESOURCE_ATTRIBUTESAdditional resource attributes.

Custom variables (override OTEL_*): OTLP_ENDPOINT, OTLP_STEP_MS, OTLP_HEADERS, OTLP_RESOURCE_ATTRIBUTES. Protocol is HTTP only (port 4318); temporality is cumulative. See OTLP & Grafana Cloud.

LOG_LEVEL, LOG_LEVEL_KLAG, LOG_LEVEL_KAFKA, LOG_LEVEL_HEALTH, LOG_LEVEL_METRICS set per-area log levels.