Java Code Examples for org.apache.flink.runtime.rest.messages.job.metrics.AggregatedMetricsResponseBody#getMetrics()
The following examples show how to use
org.apache.flink.runtime.rest.messages.job.metrics.AggregatedMetricsResponseBody#getMetrics() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: AggregatingMetricsHandlerTestBase.java From flink with Apache License 2.0 | 6 votes |
@Test public void testDefaultAggregation() throws Exception { Map<String, List<String>> queryParams = new HashMap<>(4); queryParams.put("get", Collections.singletonList("abc.metric1")); HandlerRequest<EmptyRequestBody, P> request = new HandlerRequest<>( EmptyRequestBody.getInstance(), handler.getMessageHeaders().getUnresolvedMessageParameters(), pathParameters, queryParams ); AggregatedMetricsResponseBody response = handler.handleRequest(request, MOCK_DISPATCHER_GATEWAY) .get(); Collection<AggregatedMetric> aggregatedMetrics = response.getMetrics(); assertEquals(1, aggregatedMetrics.size()); AggregatedMetric aggregatedMetric = aggregatedMetrics.iterator().next(); assertEquals("abc.metric1", aggregatedMetric.getId()); assertEquals(1.0, aggregatedMetric.getMin(), 0.1); assertEquals(3.0, aggregatedMetric.getMax(), 0.1); assertEquals(2.0, aggregatedMetric.getAvg(), 0.1); assertEquals(4.0, aggregatedMetric.getSum(), 0.1); }
Example 2
Source File: AggregatingMetricsHandlerTestBase.java From Flink-CEPplus with Apache License 2.0 | 6 votes |
@Test public void testDefaultAggregation() throws Exception { Map<String, List<String>> queryParams = new HashMap<>(4); queryParams.put("get", Collections.singletonList("abc.metric1")); HandlerRequest<EmptyRequestBody, P> request = new HandlerRequest<>( EmptyRequestBody.getInstance(), handler.getMessageHeaders().getUnresolvedMessageParameters(), pathParameters, queryParams ); AggregatedMetricsResponseBody response = handler.handleRequest(request, MOCK_DISPATCHER_GATEWAY) .get(); Collection<AggregatedMetric> aggregatedMetrics = response.getMetrics(); assertEquals(1, aggregatedMetrics.size()); AggregatedMetric aggregatedMetric = aggregatedMetrics.iterator().next(); assertEquals("abc.metric1", aggregatedMetric.getId()); assertEquals(1.0, aggregatedMetric.getMin(), 0.1); assertEquals(3.0, aggregatedMetric.getMax(), 0.1); assertEquals(2.0, aggregatedMetric.getAvg(), 0.1); assertEquals(4.0, aggregatedMetric.getSum(), 0.1); }
Example 3
Source File: AggregatingMetricsHandlerTestBase.java From flink with Apache License 2.0 | 6 votes |
@Test public void testDefaultAggregation() throws Exception { Map<String, List<String>> queryParams = new HashMap<>(4); queryParams.put("get", Collections.singletonList("abc.metric1")); HandlerRequest<EmptyRequestBody, P> request = new HandlerRequest<>( EmptyRequestBody.getInstance(), handler.getMessageHeaders().getUnresolvedMessageParameters(), pathParameters, queryParams ); AggregatedMetricsResponseBody response = handler.handleRequest(request, MOCK_DISPATCHER_GATEWAY) .get(); Collection<AggregatedMetric> aggregatedMetrics = response.getMetrics(); assertEquals(1, aggregatedMetrics.size()); AggregatedMetric aggregatedMetric = aggregatedMetrics.iterator().next(); assertEquals("abc.metric1", aggregatedMetric.getId()); assertEquals(1.0, aggregatedMetric.getMin(), 0.1); assertEquals(3.0, aggregatedMetric.getMax(), 0.1); assertEquals(2.0, aggregatedMetric.getAvg(), 0.1); assertEquals(4.0, aggregatedMetric.getSum(), 0.1); }
Example 4
Source File: AggregatingMetricsHandlerTestBase.java From flink with Apache License 2.0 | 5 votes |
@Test public void testAvgAggregation() throws Exception { Map<String, List<String>> queryParams = new HashMap<>(4); queryParams.put("get", Collections.singletonList("abc.metric1")); queryParams.put("agg", Collections.singletonList("avg")); HandlerRequest<EmptyRequestBody, P> request = new HandlerRequest<>( EmptyRequestBody.getInstance(), handler.getMessageHeaders().getUnresolvedMessageParameters(), pathParameters, queryParams ); AggregatedMetricsResponseBody response = handler.handleRequest(request, MOCK_DISPATCHER_GATEWAY) .get(); Collection<AggregatedMetric> aggregatedMetrics = response.getMetrics(); assertEquals(1, aggregatedMetrics.size()); AggregatedMetric aggregatedMetric = aggregatedMetrics.iterator().next(); assertEquals("abc.metric1", aggregatedMetric.getId()); assertEquals(2.0, aggregatedMetric.getAvg(), 0.1); assertNull(aggregatedMetric.getMin()); assertNull(aggregatedMetric.getMax()); assertNull(aggregatedMetric.getSum()); }
Example 5
Source File: AggregatingMetricsHandlerTestBase.java From flink with Apache License 2.0 | 5 votes |
@Test public void testMultipleAggregation() throws Exception { Map<String, List<String>> queryParams = new HashMap<>(4); queryParams.put("get", Collections.singletonList("abc.metric1")); queryParams.put("agg", Arrays.asList("min", "max", "avg")); HandlerRequest<EmptyRequestBody, P> request = new HandlerRequest<>( EmptyRequestBody.getInstance(), handler.getMessageHeaders().getUnresolvedMessageParameters(), pathParameters, queryParams ); AggregatedMetricsResponseBody response = handler.handleRequest(request, MOCK_DISPATCHER_GATEWAY) .get(); Collection<AggregatedMetric> aggregatedMetrics = response.getMetrics(); assertEquals(1, aggregatedMetrics.size()); AggregatedMetric aggregatedMetric = aggregatedMetrics.iterator().next(); assertEquals("abc.metric1", aggregatedMetric.getId()); assertEquals(1.0, aggregatedMetric.getMin(), 0.1); assertEquals(3.0, aggregatedMetric.getMax(), 0.1); assertEquals(2.0, aggregatedMetric.getAvg(), 0.1); assertNull(aggregatedMetric.getSum()); }
Example 6
Source File: AggregatingMetricsHandlerTestBase.java From flink with Apache License 2.0 | 5 votes |
@Test public void testAvgAggregation() throws Exception { Map<String, List<String>> queryParams = new HashMap<>(4); queryParams.put("get", Collections.singletonList("abc.metric1")); queryParams.put("agg", Collections.singletonList("avg")); HandlerRequest<EmptyRequestBody, P> request = new HandlerRequest<>( EmptyRequestBody.getInstance(), handler.getMessageHeaders().getUnresolvedMessageParameters(), pathParameters, queryParams ); AggregatedMetricsResponseBody response = handler.handleRequest(request, MOCK_DISPATCHER_GATEWAY) .get(); Collection<AggregatedMetric> aggregatedMetrics = response.getMetrics(); assertEquals(1, aggregatedMetrics.size()); AggregatedMetric aggregatedMetric = aggregatedMetrics.iterator().next(); assertEquals("abc.metric1", aggregatedMetric.getId()); assertEquals(2.0, aggregatedMetric.getAvg(), 0.1); assertNull(aggregatedMetric.getMin()); assertNull(aggregatedMetric.getMax()); assertNull(aggregatedMetric.getSum()); }
Example 7
Source File: AggregatingMetricsHandlerTestBase.java From flink with Apache License 2.0 | 5 votes |
@Test public void testSumAggregation() throws Exception { Map<String, List<String>> queryParams = new HashMap<>(4); queryParams.put("get", Collections.singletonList("abc.metric1")); queryParams.put("agg", Collections.singletonList("sum")); HandlerRequest<EmptyRequestBody, P> request = new HandlerRequest<>( EmptyRequestBody.getInstance(), handler.getMessageHeaders().getUnresolvedMessageParameters(), pathParameters, queryParams ); AggregatedMetricsResponseBody response = handler.handleRequest(request, MOCK_DISPATCHER_GATEWAY) .get(); Collection<AggregatedMetric> aggregatedMetrics = response.getMetrics(); assertEquals(1, aggregatedMetrics.size()); AggregatedMetric aggregatedMetric = aggregatedMetrics.iterator().next(); assertEquals("abc.metric1", aggregatedMetric.getId()); assertEquals(4.0, aggregatedMetric.getSum(), 0.1); assertNull(aggregatedMetric.getMin()); assertNull(aggregatedMetric.getMax()); assertNull(aggregatedMetric.getAvg()); }
Example 8
Source File: AggregatingMetricsHandlerTestBase.java From flink with Apache License 2.0 | 5 votes |
@Test public void testMaxAggregation() throws Exception { Map<String, List<String>> queryParams = new HashMap<>(4); queryParams.put("get", Collections.singletonList("abc.metric1")); queryParams.put("agg", Collections.singletonList("max")); HandlerRequest<EmptyRequestBody, P> request = new HandlerRequest<>( EmptyRequestBody.getInstance(), handler.getMessageHeaders().getUnresolvedMessageParameters(), pathParameters, queryParams ); AggregatedMetricsResponseBody response = handler.handleRequest(request, MOCK_DISPATCHER_GATEWAY) .get(); Collection<AggregatedMetric> aggregatedMetrics = response.getMetrics(); assertEquals(1, aggregatedMetrics.size()); AggregatedMetric aggregatedMetric = aggregatedMetrics.iterator().next(); assertEquals("abc.metric1", aggregatedMetric.getId()); assertEquals(3.0, aggregatedMetric.getMax(), 0.1); assertNull(aggregatedMetric.getMin()); assertNull(aggregatedMetric.getSum()); assertNull(aggregatedMetric.getAvg()); }
Example 9
Source File: AggregatingMetricsHandlerTestBase.java From flink with Apache License 2.0 | 5 votes |
@Test public void testMinAggregation() throws Exception { Map<String, List<String>> queryParams = new HashMap<>(4); queryParams.put("get", Collections.singletonList("abc.metric1")); queryParams.put("agg", Collections.singletonList("min")); HandlerRequest<EmptyRequestBody, P> request = new HandlerRequest<>( EmptyRequestBody.getInstance(), handler.getMessageHeaders().getUnresolvedMessageParameters(), pathParameters, queryParams ); AggregatedMetricsResponseBody response = handler.handleRequest(request, MOCK_DISPATCHER_GATEWAY) .get(); Collection<AggregatedMetric> aggregatedMetrics = response.getMetrics(); assertEquals(1, aggregatedMetrics.size()); AggregatedMetric aggregatedMetric = aggregatedMetrics.iterator().next(); assertEquals("abc.metric1", aggregatedMetric.getId()); assertEquals(1.0, aggregatedMetric.getMin(), 0.1); assertNull(aggregatedMetric.getMax()); assertNull(aggregatedMetric.getSum()); assertNull(aggregatedMetric.getAvg()); }
Example 10
Source File: AggregatingMetricsHandlerTestBase.java From flink with Apache License 2.0 | 5 votes |
@Test public void testMultipleAggregation() throws Exception { Map<String, List<String>> queryParams = new HashMap<>(4); queryParams.put("get", Collections.singletonList("abc.metric1")); queryParams.put("agg", Arrays.asList("min", "max", "avg")); HandlerRequest<EmptyRequestBody, P> request = new HandlerRequest<>( EmptyRequestBody.getInstance(), handler.getMessageHeaders().getUnresolvedMessageParameters(), pathParameters, queryParams ); AggregatedMetricsResponseBody response = handler.handleRequest(request, MOCK_DISPATCHER_GATEWAY) .get(); Collection<AggregatedMetric> aggregatedMetrics = response.getMetrics(); assertEquals(1, aggregatedMetrics.size()); AggregatedMetric aggregatedMetric = aggregatedMetrics.iterator().next(); assertEquals("abc.metric1", aggregatedMetric.getId()); assertEquals(1.0, aggregatedMetric.getMin(), 0.1); assertEquals(3.0, aggregatedMetric.getMax(), 0.1); assertEquals(2.0, aggregatedMetric.getAvg(), 0.1); assertNull(aggregatedMetric.getSum()); }
Example 11
Source File: AggregatingMetricsHandlerTestBase.java From Flink-CEPplus with Apache License 2.0 | 5 votes |
@Test public void testMinAggregation() throws Exception { Map<String, List<String>> queryParams = new HashMap<>(4); queryParams.put("get", Collections.singletonList("abc.metric1")); queryParams.put("agg", Collections.singletonList("min")); HandlerRequest<EmptyRequestBody, P> request = new HandlerRequest<>( EmptyRequestBody.getInstance(), handler.getMessageHeaders().getUnresolvedMessageParameters(), pathParameters, queryParams ); AggregatedMetricsResponseBody response = handler.handleRequest(request, MOCK_DISPATCHER_GATEWAY) .get(); Collection<AggregatedMetric> aggregatedMetrics = response.getMetrics(); assertEquals(1, aggregatedMetrics.size()); AggregatedMetric aggregatedMetric = aggregatedMetrics.iterator().next(); assertEquals("abc.metric1", aggregatedMetric.getId()); assertEquals(1.0, aggregatedMetric.getMin(), 0.1); assertNull(aggregatedMetric.getMax()); assertNull(aggregatedMetric.getSum()); assertNull(aggregatedMetric.getAvg()); }
Example 12
Source File: AggregatingMetricsHandlerTestBase.java From flink with Apache License 2.0 | 5 votes |
@Test public void testSumAggregation() throws Exception { Map<String, List<String>> queryParams = new HashMap<>(4); queryParams.put("get", Collections.singletonList("abc.metric1")); queryParams.put("agg", Collections.singletonList("sum")); HandlerRequest<EmptyRequestBody, P> request = new HandlerRequest<>( EmptyRequestBody.getInstance(), handler.getMessageHeaders().getUnresolvedMessageParameters(), pathParameters, queryParams ); AggregatedMetricsResponseBody response = handler.handleRequest(request, MOCK_DISPATCHER_GATEWAY) .get(); Collection<AggregatedMetric> aggregatedMetrics = response.getMetrics(); assertEquals(1, aggregatedMetrics.size()); AggregatedMetric aggregatedMetric = aggregatedMetrics.iterator().next(); assertEquals("abc.metric1", aggregatedMetric.getId()); assertEquals(4.0, aggregatedMetric.getSum(), 0.1); assertNull(aggregatedMetric.getMin()); assertNull(aggregatedMetric.getMax()); assertNull(aggregatedMetric.getAvg()); }
Example 13
Source File: AggregatingMetricsHandlerTestBase.java From flink with Apache License 2.0 | 5 votes |
@Test public void testMaxAggregation() throws Exception { Map<String, List<String>> queryParams = new HashMap<>(4); queryParams.put("get", Collections.singletonList("abc.metric1")); queryParams.put("agg", Collections.singletonList("max")); HandlerRequest<EmptyRequestBody, P> request = new HandlerRequest<>( EmptyRequestBody.getInstance(), handler.getMessageHeaders().getUnresolvedMessageParameters(), pathParameters, queryParams ); AggregatedMetricsResponseBody response = handler.handleRequest(request, MOCK_DISPATCHER_GATEWAY) .get(); Collection<AggregatedMetric> aggregatedMetrics = response.getMetrics(); assertEquals(1, aggregatedMetrics.size()); AggregatedMetric aggregatedMetric = aggregatedMetrics.iterator().next(); assertEquals("abc.metric1", aggregatedMetric.getId()); assertEquals(3.0, aggregatedMetric.getMax(), 0.1); assertNull(aggregatedMetric.getMin()); assertNull(aggregatedMetric.getSum()); assertNull(aggregatedMetric.getAvg()); }
Example 14
Source File: AggregatingMetricsHandlerTestBase.java From flink with Apache License 2.0 | 5 votes |
@Test public void testMinAggregation() throws Exception { Map<String, List<String>> queryParams = new HashMap<>(4); queryParams.put("get", Collections.singletonList("abc.metric1")); queryParams.put("agg", Collections.singletonList("min")); HandlerRequest<EmptyRequestBody, P> request = new HandlerRequest<>( EmptyRequestBody.getInstance(), handler.getMessageHeaders().getUnresolvedMessageParameters(), pathParameters, queryParams ); AggregatedMetricsResponseBody response = handler.handleRequest(request, MOCK_DISPATCHER_GATEWAY) .get(); Collection<AggregatedMetric> aggregatedMetrics = response.getMetrics(); assertEquals(1, aggregatedMetrics.size()); AggregatedMetric aggregatedMetric = aggregatedMetrics.iterator().next(); assertEquals("abc.metric1", aggregatedMetric.getId()); assertEquals(1.0, aggregatedMetric.getMin(), 0.1); assertNull(aggregatedMetric.getMax()); assertNull(aggregatedMetric.getSum()); assertNull(aggregatedMetric.getAvg()); }
Example 15
Source File: AggregatingMetricsHandlerTestBase.java From Flink-CEPplus with Apache License 2.0 | 5 votes |
@Test public void testMultipleAggregation() throws Exception { Map<String, List<String>> queryParams = new HashMap<>(4); queryParams.put("get", Collections.singletonList("abc.metric1")); queryParams.put("agg", Arrays.asList("min", "max", "avg")); HandlerRequest<EmptyRequestBody, P> request = new HandlerRequest<>( EmptyRequestBody.getInstance(), handler.getMessageHeaders().getUnresolvedMessageParameters(), pathParameters, queryParams ); AggregatedMetricsResponseBody response = handler.handleRequest(request, MOCK_DISPATCHER_GATEWAY) .get(); Collection<AggregatedMetric> aggregatedMetrics = response.getMetrics(); assertEquals(1, aggregatedMetrics.size()); AggregatedMetric aggregatedMetric = aggregatedMetrics.iterator().next(); assertEquals("abc.metric1", aggregatedMetric.getId()); assertEquals(1.0, aggregatedMetric.getMin(), 0.1); assertEquals(3.0, aggregatedMetric.getMax(), 0.1); assertEquals(2.0, aggregatedMetric.getAvg(), 0.1); assertNull(aggregatedMetric.getSum()); }
Example 16
Source File: AggregatingMetricsHandlerTestBase.java From Flink-CEPplus with Apache License 2.0 | 5 votes |
@Test public void testAvgAggregation() throws Exception { Map<String, List<String>> queryParams = new HashMap<>(4); queryParams.put("get", Collections.singletonList("abc.metric1")); queryParams.put("agg", Collections.singletonList("avg")); HandlerRequest<EmptyRequestBody, P> request = new HandlerRequest<>( EmptyRequestBody.getInstance(), handler.getMessageHeaders().getUnresolvedMessageParameters(), pathParameters, queryParams ); AggregatedMetricsResponseBody response = handler.handleRequest(request, MOCK_DISPATCHER_GATEWAY) .get(); Collection<AggregatedMetric> aggregatedMetrics = response.getMetrics(); assertEquals(1, aggregatedMetrics.size()); AggregatedMetric aggregatedMetric = aggregatedMetrics.iterator().next(); assertEquals("abc.metric1", aggregatedMetric.getId()); assertEquals(2.0, aggregatedMetric.getAvg(), 0.1); assertNull(aggregatedMetric.getMin()); assertNull(aggregatedMetric.getMax()); assertNull(aggregatedMetric.getSum()); }
Example 17
Source File: AggregatingMetricsHandlerTestBase.java From Flink-CEPplus with Apache License 2.0 | 5 votes |
@Test public void testSumAggregation() throws Exception { Map<String, List<String>> queryParams = new HashMap<>(4); queryParams.put("get", Collections.singletonList("abc.metric1")); queryParams.put("agg", Collections.singletonList("sum")); HandlerRequest<EmptyRequestBody, P> request = new HandlerRequest<>( EmptyRequestBody.getInstance(), handler.getMessageHeaders().getUnresolvedMessageParameters(), pathParameters, queryParams ); AggregatedMetricsResponseBody response = handler.handleRequest(request, MOCK_DISPATCHER_GATEWAY) .get(); Collection<AggregatedMetric> aggregatedMetrics = response.getMetrics(); assertEquals(1, aggregatedMetrics.size()); AggregatedMetric aggregatedMetric = aggregatedMetrics.iterator().next(); assertEquals("abc.metric1", aggregatedMetric.getId()); assertEquals(4.0, aggregatedMetric.getSum(), 0.1); assertNull(aggregatedMetric.getMin()); assertNull(aggregatedMetric.getMax()); assertNull(aggregatedMetric.getAvg()); }
Example 18
Source File: AggregatingMetricsHandlerTestBase.java From Flink-CEPplus with Apache License 2.0 | 5 votes |
@Test public void testMaxAggregation() throws Exception { Map<String, List<String>> queryParams = new HashMap<>(4); queryParams.put("get", Collections.singletonList("abc.metric1")); queryParams.put("agg", Collections.singletonList("max")); HandlerRequest<EmptyRequestBody, P> request = new HandlerRequest<>( EmptyRequestBody.getInstance(), handler.getMessageHeaders().getUnresolvedMessageParameters(), pathParameters, queryParams ); AggregatedMetricsResponseBody response = handler.handleRequest(request, MOCK_DISPATCHER_GATEWAY) .get(); Collection<AggregatedMetric> aggregatedMetrics = response.getMetrics(); assertEquals(1, aggregatedMetrics.size()); AggregatedMetric aggregatedMetric = aggregatedMetrics.iterator().next(); assertEquals("abc.metric1", aggregatedMetric.getId()); assertEquals(3.0, aggregatedMetric.getMax(), 0.1); assertNull(aggregatedMetric.getMin()); assertNull(aggregatedMetric.getSum()); assertNull(aggregatedMetric.getAvg()); }