Przeglądaj źródła

Start doing endpoint for jmx metrics

Roman Nedzvetskiy 5 lat temu
rodzic
commit
d46a39e573

+ 4 - 0
kafka-ui-api/src/main/java/com/provectus/kafka/ui/cluster/service/ClusterService.java

@@ -156,4 +156,8 @@ public class ClusterService {
                 .orElse(Flux.empty());
 
     }
+
+    public Flux<JmxMetrics> getJmxMetricsNames() {
+
+    }
 }

+ 6 - 1
kafka-ui-api/src/main/java/com/provectus/kafka/ui/rest/MetricsRestController.java

@@ -99,7 +99,12 @@ public class MetricsRestController implements ApiClustersApi {
     public Mono<ResponseEntity<Topic>> updateTopic(String clusterId, String topicName, @Valid Mono<TopicFormData> topicFormData, ServerWebExchange exchange) {
         return clusterService.updateTopic(clusterId, topicName, topicFormData).map(ResponseEntity::ok);
     }
-    
+
+    @Override
+    public Mono<ResponseEntity<Flux<JmxMetrics>>> getJmxMetricsNames(String clusterName, String brokerId, ServerWebExchange exchange){
+        return clusterService;
+    }
+
     private Mono<ConsumerPosition> parseConsumerPosition(SeekType seekType, List<String> seekTo) {
         return Mono.justOrEmpty(seekTo)
                 .defaultIfEmpty(Collections.emptyList())

+ 36 - 1
kafka-ui-contract/src/main/resources/swagger/kafka-ui-api.yaml

@@ -264,6 +264,33 @@ paths:
               schema:
                 $ref: '#/components/schemas/ConsumerGroupDetails'
 
+  /api/clusters/{clusterName}/brokers/{brokerId}:
+    get:
+      tags:
+        - /api/clusters
+      summary: get all JmxMetricsNames
+      operationId: getJmxMetricsNames
+      parameters:
+        - name: clusterName
+          in: path
+          required: true
+          schema:
+            type: string
+        - name: brokerId
+          in: path
+          required: true
+          schema:
+            type: string
+      responses:
+        200:
+          description: OK
+          content:
+            application/json:
+              schema:
+                type: array
+                items:
+                  $ref: '#/components/schemas/JmxMetrics'
+
   /api/clusters/{clusterName}/consumerGroups:
     get:
       tags:
@@ -506,4 +533,12 @@ components:
         consumers:
           type: array
           items:
-            $ref: '#/components/schemas/ConsumerTopicPartitionDetail'
+            $ref: '#/components/schemas/ConsumerTopicPartitionDetail'
+
+    JmxMetrics:
+      type: object
+      properties:
+        metricName:
+          type: array
+          items:
+            type: string