Package burp.mcp.util
Class MetricsCollector
java.lang.Object
burp.mcp.util.MetricsCollector
Thread-safe metrics collector for the MCP server.
Tracks request counts, latencies (ring buffer), tool call counts,
error counts, and uptime. Supports a Prometheus-style export.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionintdoubledoublelonglonggetPercentileMs(double pct) longlonglonglonglongbooleanvoidvoidrecordLatencyMs(long ms) voidvoidvoidvoidrecordToolCall(String toolName) voidRestart the uptime clock (listener restarted from the UI).voidsetActiveConnections(int n) voidsetCacheStats(long hits, long misses) voidsetEnabled(boolean enabled) Produces a JSON-compatible map of all metrics.Produces Prometheus text format.
-
Constructor Details
-
MetricsCollector
public MetricsCollector()
-
-
Method Details
-
setEnabled
public void setEnabled(boolean enabled) -
isEnabled
public boolean isEnabled() -
recordRequest
public void recordRequest() -
recordError
public void recordError() -
recordRateLimited
public void recordRateLimited() -
recordServerBusy
public void recordServerBusy() -
recordLatencyMs
public void recordLatencyMs(long ms) -
recordToolCall
-
setCacheStats
public void setCacheStats(long hits, long misses) -
setActiveConnections
public void setActiveConnections(int n) -
getUptimeSeconds
public long getUptimeSeconds() -
resetUptime
public void resetUptime()Restart the uptime clock (listener restarted from the UI). -
getTotalRequests
public long getTotalRequests() -
getErrorCount
public long getErrorCount() -
getRateLimitedCount
public long getRateLimitedCount() -
getServerBusyCount
public long getServerBusyCount() -
getRequestsPerMinute
public long getRequestsPerMinute() -
getAvgLatencyMs
public double getAvgLatencyMs() -
getPercentileMs
public long getPercentileMs(double pct) -
getToolCounts
-
getCacheHitRate
public double getCacheHitRate() -
getActiveConnections
public int getActiveConnections() -
toMetricsMap
Produces a JSON-compatible map of all metrics. -
toPrometheusFormat
Produces Prometheus text format.
-