Klasse PrometheusHTTPAsyncConsumerApi
-
Konstruktorübersicht
Konstruktoren -
Methodenübersicht
Modifizierer und TypMethodeBeschreibungRemoves deleted dataCreates Snapshot of current dataDeletes selected dataEvaluates instant queryEvaluates query over range of time.Returns metric metadataReturns current alertmanager discoveryReturns active alertsReturns label namesReturns label valuesReturns list of ExemplarsReturns currently loaded rulesReturns time seriesReturns build informationReturns configuration fileReturns flag valuesReturns runtime infoReturns statistics about TSBDReturns info about WAL replay.Returns target metadataReturns current target discovery.
-
Konstruktordetails
-
PrometheusHTTPAsyncConsumerApi
-
-
Methodendetails
-
cleanTombstones
Removes deleted dataCleanTombstones removes the deleted data from disk and cleans up the existing tombstones. This can be used after deleting series to free up space.
-
createSnapshot
public CompletableFuture<SnapshotCreateResponse> createSnapshot(Consumer<CreateSnapshotOperationSpec> spec) Creates Snapshot of current dataSnapshot creates a snapshot of all current data into
snapshots/&lt;datetime&gt;-&lt;rand&gt;
under the TSDB's data directory and returns the directory as response. It will optionally skip snapshotting data that is only present in the head block, and which has not yet been compacted to disk.- Parameter:
spec
- a consumer that creates the payload for this operation. Supports the following properties:- skipHead: Skip data present in the head block. Optional.
-
deleteSeries
Deletes selected dataDeleteSeries deletes data for a selection of series in a time range. The actual data still exists on disk and is cleaned up in future compactions or can be explicitly cleaned up by hitting the [Clean Tombstones](https://prometheus.io/docs/prometheus/latest/querying/api/#clean-tombstones) endpoint. **NOTE:** This endpoint marks samples from series as deleted, but will not necessarily prevent associated series metadata from still being returned in metadata queries for the affected time range (even after cleaning tombstones). The exact extent of metadata deletion is an implementation detail that may change in the future.
- Parameter:
spec
- a consumer that creates the payload for this operation. Supports the following properties:- match: Repeated label matcher argument that selects the series to delete. At least one match[] argument must be provided.
- start: Start timestamp. Optional and defaults to minimum possible time.
- end: End timestamp. Optional and defaults to maximum possible time. Not mentioning both start and end times would clear all the data for the matched series in the database.
-
evaluateQueryInstant
public CompletableFuture<QueryDataReadResponse> evaluateQueryInstant(Consumer<EvaluateQueryInstantOperationSpec> spec) Evaluates instant queryThe following endpoint evaluates an instant query at a single point in time You can URL-encode these parameters directly in the request body by using the
POST
method andContent-Type: application/x-www-form-urlencoded
header. This is useful when specifying a large query that may breach server-side URL character limits. The data section of the query result has the following format ` { "resultType": "matrix" | "vector" | "scalar" | "string", "result": <value> }refers to the query result data, which has varying formats depending on the
resultType`. See the [expression query result formats](https://prometheus.io/docs/prometheus/latest/querying/api/#expression-query-result-formats).- Parameter:
spec
- a consumer that creates the payload for this operation. Supports the following properties:- query: Prometheus expression query string.
- time: Evaluation timestamp. Optional. The current server time is used if the time parameter is omitted.
- timeout: Evaluation timeout. Optional. Defaults to and is capped by the value of the
-query.timeout
flag.
-
evaluateQueryRange
public CompletableFuture<ResponseQueryRange> evaluateQueryRange(Consumer<EvaluateQueryRangeOperationSpec> spec) Evaluates query over range of time.The following endpoint evaluates an expression query over a range of time You can URL-encode these parameters directly in the request body by using the
POST
method andContent-Type: application/x-www-form-urlencoded
header. This is useful when specifying a large query that may breach server-side URL character limits. The data section of the query result has the following format ` { "resultType": "matrix", "result": <value> }For the format of the
<value>` placeholder, see the [range-vector result format](https://prometheus.io/docs/prometheus/latest/querying/api/#range-vectors).- Parameter:
spec
- a consumer that creates the payload for this operation. Supports the following properties:- query: Prometheus expression query string.
- start: Start timestamp.
- end: End timestamp.
- step: Query resolution step width in
duration
format or float number of seconds. - timeout: Evaluation timeout. Optional. Defaults to and is capped by the value of the
-query.timeout
flag.
-
metricMetadataReadResponse
public CompletableFuture<MetadataReadResponse> metricMetadataReadResponse(Consumer<MetricMetadataReadResponseOperationSpec> spec) Returns metric metadataIt returns metadata about metrics currently scrapped from targets. However, it does not provide any target information. This is considered experimental and might change in the future. The data section of the query result consists of an object where each key is a metric name and each value is a list of unique metadata objects, as exposed for that metric name across all targets.
- Parameter:
spec
- a consumer that creates the payload for this operation. Supports the following properties:- limit: Maximum number of metrics to return.
- metric: A metric name to filter metadata for. All metric metadata is retrieved if left empty.
-
readAlertManagers
Returns current alertmanager discoveryReturns an overview of the current state of the Prometheus alertmanager discovery Both the active and dropped Alertmanagers are part of the response.
-
readAlerts
Returns active alertsThe /alerts endpoint returns a list of all active alerts. As the /alerts endpoint is fairly new, it does not have the same stability guarantees as the overarching API v1.
-
readLabelNames
public CompletableFuture<LabelNamesReadResponse> readLabelNames(Consumer<ReadLabelNamesOperationSpec> spec) Returns label namesThe following endpoint returns a list of label names. The
data
section of the JSON response is a list of string label names. **NOTE:** These API endpoints may return metadata for series for which there is no sample within the selected time range, and/or for series whose samples have been marked as deleted via the deletion API endpoint. The exact extent of additionally returned series metadata is an implementation detail that may change in the future.- Parameter:
spec
- a consumer that creates the payload for this operation. Supports the following properties:- start: Start timestamp.
- end: End timestamp.
- match: Repeated series selector argument that selects the series from which to read the label values. Optional.
-
readLabelValues
public CompletableFuture<LabelValuesReadResponse> readLabelValues(Consumer<ReadLabelValuesOperationSpec> spec) Returns label valuesThe following endpoint returns a list of label values for a provided label name The
data
section of the JSON response is a list of string label values. **NOTE:** These API endpoints may return metadata for series for which there is no sample within the selected time range, and/or for series whose samples have been marked as deleted via the deletion API endpoint. The exact extent of additionally returned series metadata is an implementation detail that may change in the future.- Parameter:
spec
- a consumer that creates the payload for this operation. Supports the following properties:- labelName: Label name.
- start: Start timestamp.
- end: End timestamp.
- match: Repeated series selector argument that selects the series from which to read the label values.
-
readQueryExemplars
public CompletableFuture<QueryExemplarsReadResponse> readQueryExemplars(Consumer<ReadQueryExemplarsOperationSpec> spec) Returns list of ExemplarsThis is <b>experimental</b> and might change in the future. The following endpoint returns a list of exemplars for a valid PromQL query for a specific time range
- Parameter:
spec
- a consumer that creates the payload for this operation. Supports the following properties:- query: Prometheus expression query string.
- start: Start timestamp.
- end: End timestamp.
-
readRules
Returns currently loaded rulesThe
/rules
API endpoint returns a list of alerting and recording rules that are currently loaded. In addition it returns the currently active alerts fired by the Prometheus instance of each alerting rule. As the/rules
endpoint is fairly new, it does not have the same stability guarantees as the overarching API v1.- Parameter:
spec
- a consumer that creates the payload for this operation. Supports the following properties:- type: Return only the alerting rules (e.g.
type=alert
) or the recording rules (e.g.type=record
). When the parameter is absent or empty, no filtering is done.
- type: Return only the alerting rules (e.g.
-
readSeries
public CompletableFuture<List<QueryDataResultMetric>> readSeries(Consumer<ReadSeriesOperationSpec> spec) Returns time seriesThe following endpoint returns the list of time series that match a certain label set. You can URL-encode these parameters directly in the request body by using the
POST
method andContent-Type: application/x-www-form-urlencoded
header. This is useful when specifying a large or dynamic number of series selectors that may breach server-side URL character limits. Thedata
section of the query result consists of a list of objects that contain the label name/value pairs which identify each series.- Parameter:
spec
- a consumer that creates the payload for this operation. Supports the following properties:- match: Repeated series selector argument that selects the series to return. At least one
match[]
argument must be provided. - start: Start timestamp. Optional.
- end: End timestamp. Optional.
- match: Repeated series selector argument that selects the series to return. At least one
-
readServerBuildInfo
Returns build informationThe following endpoint returns various build information properties about the Prometheus server.
-
readServerConfig
Returns configuration fileThe following endpoint returns currently loaded configuration file The config is returned as dumped YAML file. Due to limitation of the YAML library, YAML comments are not included.
-
readServerFlags
Returns flag valuesThe following endpoint returns flag values that Prometheus was configured with.
-
readServerRuntimeInfo
Returns runtime infoThe following endpoint returns various runtime information properties about the Prometheus server The returned values are of different types, depending on the nature of the runtime property --- **NOTE:** The exact returned runtime properties may change without notice between Prometheus versions. --- New in v2.14
-
readServerTSDBStatus
Returns statistics about TSBDThe following endpoint returns various cardinality statistics about the Prometheus TSDB Response Data --- **headStats:** This provides the following data about the head block of the TSDB: >**numSeries:** The number of series. **chunkCount:** The number of chunks. **minTime:** The current minimum timestamp in milliseconds. **maxTime:** The current maximum timestamp in milliseconds. **seriesCountByMetricName:** This will provide a list of metrics names and their series count. **labelValueCountByLabelName:** This will provide a list of the label names and their value count. **memoryInBytesByLabelName:** This will provide a list of the label names and memory used in bytes. Memory usage is calculated by adding the length of all values for a given label name. **seriesCountByLabelPair:** This will provide a list of label value pairs and their series count.
-
readServerWALReplayStatus
Returns info about WAL replay.The following endpoint returns information about the WAL replay Response Data --- **read:** The number of segments replayed so far. **total:** The total number segments needed to be replayed. **progress:** The progress of the replay (0 - 100%). **state:** The state of the replay. **Possible states:** - **waiting:** Waiting for the replay to start. - **in progress:** The replay is in progress. - **done:** The replay has finished. --- **NOTE:** This endpoint is available before the server has been marked ready and is updated in real time to facilitate monitoring the progress of the WAL replay. --- New in v2.28
-
readTargetMetadata
public CompletableFuture<List<MetricMetadata>> readTargetMetadata(Consumer<ReadTargetMetadataOperationSpec> spec) Returns target metadataThe following endpoint returns metadata about metrics currently scraped from targets. This is experimental and might change in the future. The
data
section of the query result consists of a list of objects that contain metric metadata and the target label set.- Parameter:
spec
- a consumer that creates the payload for this operation. Supports the following properties:- matchTarget: Label selectors that match targets by their label sets. All targets are selected if left empty.
- metric: A metric name to retrieve metadata for. All metric metadata is retrieved if left empty.
- limit: Maximum number of targets to match.
-
readTargets
public CompletableFuture<TargetDiscoveryReadResponse> readTargets(Consumer<ReadTargetsOperationSpec> spec) Returns current target discovery.Both the active and dropped targets are part of the response by default.
labels
represents the label set after relabelling has occurred.discoveredLabels
represent the unmodified labels retrieved during service discovery before relabelling has occurred.- Parameter:
spec
- a consumer that creates the payload for this operation. Supports the following properties:- state: The
state
query parameter allows the caller to filter by active or dropped targets, (e.g.,state=active
,state=dropped
,state=any
).
- state: The
-