metrics: Prometheus text exposition for /metrics
/metrics was Prometheus-ish name/value text with a custom banner and text/plain Content-Type, so strict scrapers could fail. Emit Prometheus text 0.0.4 (# HELP, # TYPE, counter|gauge) with stable metric names, and set Content-Type to text/plain; version=0.0.4; charset=utf-8.
This commit is contained in:
@@ -562,6 +562,12 @@ func TestMetrics(t *testing.T) {
|
||||
if !bytes.Contains(rec.Body.Bytes(), []byte("negative_cache_hits")) {
|
||||
t.Error("WriteText output missing negative_cache_hits")
|
||||
}
|
||||
if !bytes.Contains(rec.Body.Bytes(), []byte("# HELP total_requests")) {
|
||||
t.Error("WriteText output missing # HELP total_requests")
|
||||
}
|
||||
if !bytes.Contains(rec.Body.Bytes(), []byte("# TYPE total_requests counter")) {
|
||||
t.Error("WriteText output missing # TYPE total_requests counter")
|
||||
}
|
||||
}
|
||||
|
||||
// Removed old TestKeyGeneration - replaced with TestURLHashing that uses SHA256
|
||||
@@ -1128,6 +1134,12 @@ func TestDiskOnlyDelayedAttach(t *testing.T) {
|
||||
if !bytes.Contains(rec.Body.Bytes(), []byte("capacity_pressure_events")) {
|
||||
t.Errorf("WriteText output missing capacity_pressure_events: %q", rec.Body.String())
|
||||
}
|
||||
if !bytes.Contains(rec.Body.Bytes(), []byte("# TYPE disk_tier_ready gauge")) {
|
||||
t.Errorf("WriteText output missing # TYPE disk_tier_ready gauge: %q", rec.Body.String())
|
||||
}
|
||||
if !bytes.Contains(rec.Body.Bytes(), []byte("# TYPE capacity_pressure_events counter")) {
|
||||
t.Errorf("WriteText output missing # TYPE capacity_pressure_events counter: %q", rec.Body.String())
|
||||
}
|
||||
}
|
||||
|
||||
// TestDiskTierSignalMemoryOnly covers memory-only mode: DiskTierReady=1 (N/A, not
|
||||
|
||||
Reference in New Issue
Block a user