Add Usage
This commit is contained in:
38
README.md
38
README.md
@ -1,6 +1,7 @@
|
|||||||
# promql_java_client
|
# Prometheus Query API Java Client Usage
|
||||||
# Usage
|
***
|
||||||
## Make API URL
|
## Build API URL
|
||||||
|
***
|
||||||
### RangeQuery
|
### RangeQuery
|
||||||
```
|
```
|
||||||
RangeQueryBuilder rangeQueryBuilder = QueryBuilderType.RangeQuery.newInstance(TARGET_SERVER);
|
RangeQueryBuilder rangeQueryBuilder = QueryBuilderType.RangeQuery.newInstance(TARGET_SERVER);
|
||||||
@ -35,4 +36,35 @@ URI targetUri = rangeQueryBuilder.withQuery("irate(received_api_call_total[60s])
|
|||||||
AlertManagerMetaQueryBuilder ammqb = QueryBuilderType.AlertManagerMetadaQuery.newInstance(TARGET_SERVER);
|
AlertManagerMetaQueryBuilder ammqb = QueryBuilderType.AlertManagerMetadaQuery.newInstance(TARGET_SERVER);
|
||||||
URI targetUri = ammqb.build();
|
URI targetUri = ammqb.build();
|
||||||
```
|
```
|
||||||
|
***
|
||||||
|
## Parse Result
|
||||||
|
***
|
||||||
|
### Parse Matrix Type Query Result
|
||||||
|
```
|
||||||
|
DefaultQueryResult<MatrixData> result = ConvertUtil.convertQueryResultString(rtVal);
|
||||||
|
```
|
||||||
|
### Parse Vector Type Query Result
|
||||||
|
```
|
||||||
|
DefaultQueryResult<VectorData> result = ConvertUtil.convertQueryResultString(rtVal);
|
||||||
|
```
|
||||||
|
### Parse Scalar Type Query Result
|
||||||
|
```
|
||||||
|
DefaultQueryResult<ScalaData> result = ConvertUtil.convertQueryResultString(rtVal);
|
||||||
|
```
|
||||||
|
### Parse Label API Result
|
||||||
|
```
|
||||||
|
DefaultLabelResult result = ConvertUtil.convertLabelResultString(rtVal);
|
||||||
|
```
|
||||||
|
### Parse Status(Config) API Result
|
||||||
|
```
|
||||||
|
DefaultConfigResult result = ConvertUtil.convertConfigResultString(rtVal);
|
||||||
|
```
|
||||||
|
### Parse Targets API Result
|
||||||
|
```
|
||||||
|
DefaultTargetResult result = ConvertUtil.convertTargetResultString(rtVal);
|
||||||
|
```
|
||||||
|
### Parse AlertManager API Result
|
||||||
|
```
|
||||||
|
DefaultAlertManagerResult result = ConvertUtil.convertAlertManagerResultString(rtVal);
|
||||||
|
```
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user