Class PrometheusClient
java.lang.Object
de.cuioss.benchmarking.common.metrics.PrometheusClient
HTTP client for querying Prometheus API endpoints.
Supports query_range operations for time-series data retrieval during benchmark execution.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final recordRepresents a single data point in time-series data.static classException thrown when Prometheus operations fail.static final recordRepresents time-series data for a metric. -
Constructor Summary
ConstructorsConstructorDescriptionPrometheusClient(String prometheusUrl) Creates a new Prometheus client with default timeout.PrometheusClient(String prometheusUrl, Duration timeout) Creates a new Prometheus client with custom timeout. -
Method Summary
Modifier and TypeMethodDescriptionQuery Prometheus for time-series data in a specific time range.
-
Constructor Details
-
PrometheusClient
Creates a new Prometheus client with default timeout.- Parameters:
prometheusUrl- Base URL of Prometheus server (e.g.,http://localhost:9090)
-
PrometheusClient
Creates a new Prometheus client with custom timeout.- Parameters:
prometheusUrl- Base URL of Prometheus servertimeout- HTTP request timeout
-
-
Method Details
-
queryRange
public Map<String,PrometheusClient.TimeSeries> queryRange(List<String> metricNames, Instant startTime, Instant endTime, Duration step) throws PrometheusClient.PrometheusException Query Prometheus for time-series data in a specific time range.- Parameters:
metricNames- List of metric names to querystartTime- Start of time range (inclusive)endTime- End of time range (inclusive)step- Step size between data points- Returns:
- Map of metric name to time series data
- Throws:
PrometheusClient.PrometheusException- if query fails or Prometheus unavailable
-