Java Code Examples for org.apache.beam.sdk.metrics.MetricResult#create()
The following examples show how to use
org.apache.beam.sdk.metrics.MetricResult#create() .
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: PortableMetrics.java From beam with Apache License 2.0 | 5 votes |
private static MetricResult<GaugeResult> convertGaugeMonitoringInfoToGauge( MetricsApi.MonitoringInfo monitoringInfo) { Map<String, String> labelsMap = monitoringInfo.getLabelsMap(); MetricKey key = MetricKey.create( labelsMap.get(STEP_NAME_LABEL), MetricName.named(labelsMap.get(NAMESPACE_LABEL), labelsMap.get(METRIC_NAME_LABEL))); GaugeData data = decodeInt64Gauge(monitoringInfo.getPayload()); GaugeResult result = GaugeResult.create(data.value(), data.timestamp()); return MetricResult.create(key, false, result); }
Example 2
Source File: PortableMetrics.java From beam with Apache License 2.0 | 5 votes |
private static MetricResult<DistributionResult> convertDistributionMonitoringInfoToDistribution( MetricsApi.MonitoringInfo monitoringInfo) { Map<String, String> labelsMap = monitoringInfo.getLabelsMap(); MetricKey key = MetricKey.create( labelsMap.get(STEP_NAME_LABEL), MetricName.named(labelsMap.get(NAMESPACE_LABEL), labelsMap.get(METRIC_NAME_LABEL))); DistributionData data = decodeInt64Distribution(monitoringInfo.getPayload()); DistributionResult result = DistributionResult.create(data.sum(), data.count(), data.min(), data.max()); return MetricResult.create(key, false, result); }
Example 3
Source File: PortableMetrics.java From beam with Apache License 2.0 | 5 votes |
private static MetricResult<Long> convertCounterMonitoringInfoToCounter( MetricsApi.MonitoringInfo counterMonInfo) { Map<String, String> labelsMap = counterMonInfo.getLabelsMap(); MetricKey key = MetricKey.create( labelsMap.get(STEP_NAME_LABEL), MetricName.named(labelsMap.get(NAMESPACE_LABEL), labelsMap.get(METRIC_NAME_LABEL))); return MetricResult.create(key, false, decodeInt64Counter(counterMonInfo.getPayload())); }
Example 4
Source File: BeamMetricTest.java From beam with Apache License 2.0 | 5 votes |
@Test public void testRenderName() { MetricResult<Object> metricResult = MetricResult.create( MetricKey.create( "myStep.one.two(three)", MetricName.named("myNameSpace//", "myName()")), 123, 456); String renderedName = new SparkBeamMetric().renderName(metricResult); assertThat( "Metric name was not rendered correctly", renderedName, equalTo("myStep_one_two_three.myNameSpace__.myName__")); }
Example 5
Source File: SparkBeamMetricTest.java From beam with Apache License 2.0 | 5 votes |
@Test public void testRenderName() { MetricResult<Object> metricResult = MetricResult.create( MetricKey.create( "myStep.one.two(three)", MetricName.named("myNameSpace//", "myName()")), 123, 456); String renderedName = new SparkBeamMetric().renderName(metricResult); assertThat( "Metric name was not rendered correctly", renderedName, equalTo("myStep_one_two_three.myNameSpace__.myName__")); }
Example 6
Source File: JetMetricResults.java From beam with Apache License 2.0 | 4 votes |
private MetricResult<Long> toUpdateResult(Map.Entry<MetricKey, Long> entry) { MetricKey key = entry.getKey(); Long counter = entry.getValue(); return MetricResult.create(key, counter, counter); }
Example 7
Source File: JetMetricResults.java From beam with Apache License 2.0 | 4 votes |
private MetricResult<DistributionResult> toUpdateResult( Map.Entry<MetricKey, DistributionData> entry) { MetricKey key = entry.getKey(); DistributionResult distributionResult = entry.getValue().extractResult(); return MetricResult.create(key, distributionResult, distributionResult); }
Example 8
Source File: JetMetricResults.java From beam with Apache License 2.0 | 4 votes |
private MetricResult<GaugeResult> toUpdateResult(Map.Entry<MetricKey, GaugeData> entry) { MetricKey key = entry.getKey(); GaugeResult gaugeResult = entry.getValue().extractResult(); return MetricResult.create(key, gaugeResult, gaugeResult); }