mirror of
https://github.com/dromara/hertzbeat.git
synced 2026-09-17 09:40:58 +00:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
67da4b68d6 |
+3
-3
@@ -55,7 +55,7 @@ public class MetricsDataQueryController {
|
||||
@Parameter(description = "Query type", example = "promql")
|
||||
@RequestParam String type,
|
||||
@Parameter(description = "Query timestamp", example = "1725854804451")
|
||||
@RequestParam long time) {
|
||||
@RequestParam Long time) {
|
||||
return ResponseEntity.ok(Message.success(queryService.query(queries, type, time)));
|
||||
}
|
||||
|
||||
@@ -67,9 +67,9 @@ public class MetricsDataQueryController {
|
||||
@Parameter(description = "Query type", example = "promql")
|
||||
@RequestParam String type,
|
||||
@Parameter(description = "Query start timestamp", example = "1725854804451")
|
||||
@RequestParam long start,
|
||||
@RequestParam Long start,
|
||||
@Parameter(description = "Query end timestamp", example = "1733630804452")
|
||||
@RequestParam long end,
|
||||
@RequestParam Long end,
|
||||
@Parameter(description = "Query step", example = "4m")
|
||||
@RequestParam String step
|
||||
) {
|
||||
|
||||
+2
-2
@@ -143,14 +143,14 @@ public abstract class PromqlQueryExecutor implements QueryExecutor {
|
||||
return http_promql(params);
|
||||
}
|
||||
|
||||
public List<Map<String, Object>> query(String queryString, long time) {
|
||||
public List<Map<String, Object>> query(String queryString, Long time) {
|
||||
Map<String, Object> params = new HashMap<>();
|
||||
params.put(HTTP_QUERY_PARAM, URLEncoder.encode(queryString, StandardCharsets.UTF_8));
|
||||
params.put(HTTP_TIME_PARAM, time);
|
||||
return http_promql(params);
|
||||
}
|
||||
|
||||
public List<Map<String, Object>> query_range(String queryString, long start, long end, String step) {
|
||||
public List<Map<String, Object>> query_range(String queryString, Long start, Long end, String step) {
|
||||
Map<String, Object> params = new HashMap<>();
|
||||
params.put(HTTP_QUERY_PARAM, URLEncoder.encode(queryString, StandardCharsets.UTF_8));
|
||||
params.put(HTTP_START_PARAM, start);
|
||||
|
||||
+2
-2
@@ -31,9 +31,9 @@ public interface QueryExecutor {
|
||||
|
||||
List<Map<String, Object>> execute(String query);
|
||||
|
||||
List<Map<String, Object>> query(String query, long time);
|
||||
List<Map<String, Object>> query(String query, Long time);
|
||||
|
||||
List<Map<String, Object>> query_range(String query, long start, long end, String step);
|
||||
List<Map<String, Object>> query_range(String query, Long start, Long end, String step);
|
||||
|
||||
boolean support(String datasource);
|
||||
}
|
||||
|
||||
+2
-2
@@ -55,9 +55,9 @@ public abstract class SqlQueryExecutor implements QueryExecutor {
|
||||
|
||||
public abstract List<Map<String, Object>> execute(String query);
|
||||
|
||||
public abstract List<Map<String, Object>> query(String query, long time);
|
||||
public abstract List<Map<String, Object>> query(String query, Long time);
|
||||
|
||||
public abstract List<Map<String, Object>> query_range(String query, long start, long end, String step);
|
||||
public abstract List<Map<String, Object>> query_range(String query, Long start, Long end, String step);
|
||||
|
||||
|
||||
public boolean support(String datasource) {
|
||||
|
||||
+2
-2
@@ -32,7 +32,7 @@ public interface MetricsDataQueryService {
|
||||
* @param time time
|
||||
* @return data
|
||||
*/
|
||||
List<MetricQueryData> query(List<String> queries, String queryType, long time);
|
||||
List<MetricQueryData> query(List<String> queries, String queryType, Long time);
|
||||
|
||||
/**
|
||||
* Query metrics data range
|
||||
@@ -42,5 +42,5 @@ public interface MetricsDataQueryService {
|
||||
* @param step step
|
||||
* @return data
|
||||
*/
|
||||
List<MetricQueryData> queryRange(List<String> queries, String queryType, long start, long end, String step);
|
||||
List<MetricQueryData> queryRange(List<String> queries, String queryType, Long start, Long end, String step);
|
||||
}
|
||||
|
||||
+2
-2
@@ -34,7 +34,7 @@ public class MetricsDataQueryServiceImpl implements MetricsDataQueryService {
|
||||
List<QueryExecutor> executors;
|
||||
|
||||
@Override
|
||||
public List<MetricQueryData> query(List<String> queries, String queryType, long time) {
|
||||
public List<MetricQueryData> query(List<String> queries, String queryType, Long time) {
|
||||
if (queries == null || executors.isEmpty()) {
|
||||
throw new IllegalArgumentException("No query executor found");
|
||||
}
|
||||
@@ -50,7 +50,7 @@ public class MetricsDataQueryServiceImpl implements MetricsDataQueryService {
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<MetricQueryData> queryRange(List<String> queries, String queryType, long start, long end, String step) {
|
||||
public List<MetricQueryData> queryRange(List<String> queries, String queryType, Long start, Long end, String step) {
|
||||
if (queries == null || executors.isEmpty()) {
|
||||
throw new IllegalArgumentException("No query executor found");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user