Configure Internal Prometheus Metrics Server
Block: internal.metrics
Mermin provides Prometheus metrics HTTP endpoints (default port 10250). This page documents metrics configuration.
Endpoints available:
/metrics- All metrics (standard + debug ifinternal.metrics.debug_metrics_enabledistrue)/metrics/standard- Standard metrics only (aggregated, no high-cardinality labels)/metrics/debug- Debug metrics only (returns 404 ifinternal.metrics.debug_metrics_enabledisfalse)/metrics:summary- JSON summary of all available metrics with metadata (name, type, description, labels, category)
Configuration
A full configuration example may be found in the Default Configuration.
Configuration Options
internal.metrics block
internal.metrics blockenabledattributeEnable or disable the metrics server.
Type: Boolean
Default:
trueExample: Disable metrics
internal "metrics" { enabled = false }listen_addressattributeIP address the metrics server binds to.
Type: String (IP address)
Default:
"0.0.0.0"Example: Listen on localhost only
internal "metrics" { listen_address = "127.0.0.1" }portattributeTCP port the metrics server listens on.
Type: Integer
Default:
10250Port 10250 is chosen to align with kubelet metrics port, making it familiar to Kubernetes administrators.
Example: Custom port
internal "metrics" { port = 9090 }debug_metrics_enabledattributeEnable debug metrics.
Type: Boolean
Default:
falseEnabling debug metrics can cause significant memory growth in production.
Example: Enable debug metrics
internal "metrics" { debug_metrics_enabled = true }stale_metric_ttlattributeTime-to-live for stale metrics after resource deletion.
0sapplies immediate cleanup.Type: String (duration)
Default:
"5m"Only applies when
debug_metrics_enabledistrue.Example: Cleanup after 1 minute
internal "metrics" { stale_metric_ttl = "1m" }
internal.metrics.histogram_buckets block
internal.metrics.histogram_buckets blockOptional subsection for histogram bucket overrides. Omit the block to use default buckets for all histograms. Each key is the full metric name.
Mermin provides several histogram metrics that track distributions of values (durations, batch sizes, etc.). By default, these metrics use pre-configured bucket sizes optimized for typical workloads. You can customize these bucket sizes inside a histogram_buckets block.
mermin_pipeline_duration_secondsattributeCustom buckets for the
mermin_pipeline_duration_secondshistogram metric. This metric tracks processing duration by pipeline stage (eBPF ring buffer processing, Kubernetes decoration, export operations).Type: Array of numbers
Default:
[0.00001, 0.00005, 0.0001, 0.0005, 0.001, 0.005, 0.01, 0.05, 0.1, 0.5, 1.0, 5.0, 10.0, 30.0, 60.0]The default buckets cover a range from 10μs to 60s to capture both fast operations (eBPF ring buffer processing, typically microseconds to milliseconds) and slow operations (export, which can take seconds).
Example: Focus on sub-second operations
mermin_export_batch_sizeattributeCustom buckets for the
mermin_export_batch_sizehistogram metric. This metric tracks the number of spans per export batch.Type: Array of numbers
Default:
[1, 10, 50, 100, 250, 500, 1000]The default buckets cover batch sizes from 1 to 1000 spans, which is suitable for most deployments.
Example: Custom batch size buckets
mermin_k8s_watcher_ip_index_update_duration_secondsattributeCustom buckets for the
mermin_k8s_watcher_ip_index_update_duration_secondshistogram metric. This metric tracks the duration of Kubernetes IP index updates.Type: Array of numbers
Default:
[0.001, 0.005, 0.01, 0.05, 0.1, 0.5, 1.0]The default buckets cover durations from 1ms to 1s, which is typical for IP index updates.
Example: Custom IP index update duration buckets
mermin_taskmanager_shutdown_duration_secondsattributeCustom buckets for the
mermin_taskmanager_shutdown_duration_secondshistogram metric. This metric tracks the duration of shutdown operations.Type: Array of numbers
Default:
[0.1, 0.5, 1.0, 5.0, 10.0, 30.0, 60.0, 120.0]Only present when debug metrics are enabled (
internal.metrics.debug_metrics_enabled = true).The default buckets cover durations from 100ms to 120s, which accommodates both quick shutdowns and longer graceful shutdowns.
Examples:
Custom shutdown duration buckets
Multiple bucket configurations
Bucket Configuration Best Practices
Bucket boundaries should be sorted: Buckets must be provided in ascending order. Prometheus will reject invalid configurations.
Cover your expected range: Ensure your buckets cover the full range of values you expect to observe. Values outside the bucket range will be counted in the
+Infbucket.Balance granularity and cardinality: More buckets provide finer granularity but increase metric cardinality. Typically, 5-15 buckets is sufficient.
Consider your SLOs: Align bucket boundaries with your service level objectives (SLOs) to make it easier to calculate percentiles and set alerts.
Authentication and Security
Currently, the metrics endpoints do not support neither authentication nor TLS encryption. Use network policies or service mesh policies to restrict access.
For production environments:
Use network policies to limit access
Do not expose metrics endpoints externally
Use port-forwarding for manual access:
kubectl port-forward pod/mermin-xxx 10250:10250
Troubleshooting
Metrics Not Scraped by Prometheus
Symptoms: No Mermin metrics in Prometheus
Solutions:
Verify
internal.metrics.enabled = trueCheck Prometheus configuration
Verify pod annotations or
ServiceMonitor(or another K8s CRD responsible for scraping configuration)Test manual scrape:
curl http://pod-ip:10250/metricsCheck network policies
High Metrics Cardinality
Symptoms: Too many unique metric series
Solutions:
Limit labels in metrics
Use aggregation in queries
Adjust Prometheus retention
Next Steps
Explore All Internal Metrics: Complete metrics reference
Configure Internal Server: Health checks and endpoints
Diagnose Performance Issues: Use metrics to identify bottlenecks
Tune the Pipeline: Optimize based on metrics
Need Help?
GitHub Discussions: Share monitoring dashboards and alerting configurations
Last updated