diff --git a/monitor/grafana/dashboards/ours-rp-soak-overview.json b/monitor/grafana/dashboards/ours-rp-soak-overview.json index ebe15e0..805bb56 100644 --- a/monitor/grafana/dashboards/ours-rp-soak-overview.json +++ b/monitor/grafana/dashboards/ours-rp-soak-overview.json @@ -614,6 +614,94 @@ ], "title": "Max RSS Over Time", "type": "timeseries" + }, + { + "datasource": { + "type": "prometheus", + "uid": "Prometheus" + }, + "fieldConfig": { + "defaults": { + "unit": "bytes", + "decimals": 2 + }, + "overrides": [] + }, + "gridPos": { + "x": 0, + "y": 32, + "w": 24, + "h": 8 + }, + "id": 15, + "options": { + "legend": { + "calcs": [ + "lastNotNull", + "max" + ], + "displayMode": "table", + "placement": "bottom", + "showLegend": true + }, + "tooltip": { + "mode": "multi", + "sort": "none" + } + }, + "targets": [ + { + "expr": "ours_rp_state_db_size_bytes", + "legendFormat": "{{db}}", + "refId": "A" + } + ], + "title": "State DB Size Over Time", + "type": "timeseries" + }, + { + "datasource": { + "type": "prometheus", + "uid": "Prometheus" + }, + "fieldConfig": { + "defaults": { + "unit": "none", + "decimals": 0 + }, + "overrides": [] + }, + "gridPos": { + "x": 0, + "y": 40, + "w": 24, + "h": 8 + }, + "id": 16, + "options": { + "legend": { + "calcs": [ + "lastNotNull", + "max" + ], + "displayMode": "table", + "placement": "bottom", + "showLegend": true + }, + "tooltip": { + "mode": "multi", + "sort": "none" + } + }, + "targets": [ + { + "expr": "ours_rp_state_db_files", + "legendFormat": "{{db}}", + "refId": "A" + } + ], + "title": "State DB File Count Over Time", + "type": "timeseries" } ], "refresh": "5s", diff --git a/src/tools/rpki_artifact_metrics.rs b/src/tools/rpki_artifact_metrics.rs index 1c15ad1..ee72b15 100644 --- a/src/tools/rpki_artifact_metrics.rs +++ b/src/tools/rpki_artifact_metrics.rs @@ -1435,6 +1435,24 @@ fn render_latest_metrics(writer: &mut PromWriter<'_>, instance: &str, latest: &L &[label("instance", instance), label("path", path)], stat.file_count as f64, ); + writer.gauge( + "ours_rp_state_db_size_bytes", + "Persistent state database size from latest run pathStats", + &[label("instance", instance), label("db", path)], + stat.total_size_bytes as f64, + ); + writer.gauge( + "ours_rp_state_db_files", + "Persistent state database file count from latest run pathStats", + &[label("instance", instance), label("db", path)], + stat.file_count as f64, + ); + writer.gauge( + "ours_rp_state_db_dirs", + "Persistent state database directory count from latest run pathStats", + &[label("instance", instance), label("db", path)], + stat.dir_count as f64, + ); } } @@ -2296,6 +2314,11 @@ mod tests { assert!(metrics.contains("ours_rp_cir_object_list_digest_present")); assert!(metrics.contains("ours_rp_cir_reject_list_digest_present_by_source")); assert!(metrics.contains("ours_rp_ccr_state_items")); + assert!( + metrics.contains(r#"ours_rp_state_db_size_bytes{instance="test",db="work-db"} 99"#) + ); + assert!(metrics.contains(r#"ours_rp_state_db_files{instance="test",db="work-db"} 2"#)); + assert!(metrics.contains(r#"ours_rp_state_db_dirs{instance="test",db="work-db"} 1"#)); assert!( metrics.contains(r#"ours_rp_cir_objects_by_source{instance="test",source="fresh"} 2"#) );