use of org.apache.beam.sdk.metrics.MetricKey in project beam by apache.
the class FlinkMetricContainerTest method testMetricNameGeneration.
@Test
public void testMetricNameGeneration() {
MetricKey key = MetricKey.create("step", MetricName.named("namespace", "name"));
String name = getFlinkMetricNameString(key);
assertThat(name, is("namespace.name"));
}
use of org.apache.beam.sdk.metrics.MetricKey in project beam by apache.
the class PortableMetrics method convertGaugeMonitoringInfoToGauge.
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);
}
Aggregations