Skip to content

Prometheus Metrics

vcpkg-harbor exposes Prometheus metrics for monitoring.

Terminal window
VCPKG_METRICS_ENABLED=true
VCPKG_METRICS_PATH=/metrics
Terminal window
curl http://localhost:15151/metrics
MetricTypeDescription
vcpkg_harbor_cache_hits_totalCounterTotal cache hits
vcpkg_harbor_cache_misses_totalCounterTotal cache misses
vcpkg_harbor_uploads_totalCounterTotal uploads
vcpkg_harbor_downloads_totalCounterTotal downloads
vcpkg_harbor_errors_totalCounterTotal errors
MetricTypeDescription
vcpkg_harbor_packages_totalGaugeTotal packages in cache
vcpkg_harbor_storage_bytesGaugeTotal storage used
MetricTypeDescription
vcpkg_harbor_request_latency_secondsHistogramRequest latency

Add vcpkg-harbor to your Prometheus scrape config:

scrape_configs:
- job_name: 'vcpkg-harbor'
static_configs:
- targets: ['localhost:15151']
metrics_path: /metrics

Example Grafana dashboard queries:

rate(vcpkg_harbor_cache_hits_total[5m]) /
(rate(vcpkg_harbor_cache_hits_total[5m]) + rate(vcpkg_harbor_cache_misses_total[5m])) * 100
rate(vcpkg_harbor_request_latency_seconds_count[5m])
rate(vcpkg_harbor_request_latency_seconds_sum[5m]) /
rate(vcpkg_harbor_request_latency_seconds_count[5m])
vcpkg_harbor_storage_bytes

Example Prometheus alerting rules:

groups:
- name: vcpkg-harbor
rules:
- alert: VcpkgHarborDown
expr: up{job="vcpkg-harbor"} == 0
for: 1m
labels:
severity: critical
annotations:
summary: "vcpkg-harbor is down"
- alert: VcpkgHarborHighErrorRate
expr: rate(vcpkg_harbor_errors_total[5m]) > 0.1
for: 5m
labels:
severity: warning
annotations:
summary: "High error rate in vcpkg-harbor"
- alert: VcpkgHarborLowCacheHitRate
expr: |
rate(vcpkg_harbor_cache_hits_total[1h]) /
(rate(vcpkg_harbor_cache_hits_total[1h]) + rate(vcpkg_harbor_cache_misses_total[1h])) < 0.5
for: 1h
labels:
severity: warning
annotations:
summary: "Low cache hit rate"