use of org.apache.beam.runners.dataflow.worker.counters.CounterName in project beam by apache.
the class DataflowCounterUpdateExtractorTest method testExtractUnstructuredNameCorrectly.
@Test
public void testExtractUnstructuredNameCorrectly() {
CounterName unstructuredName = CounterName.named(COUNTER_NAME);
Counter<?, ?> unstructured = counterFactory.intSum(unstructuredName);
// unstructured counter should not have a structured name
CounterUpdate counterUpdate = unstructured.extractUpdate(true, DataflowCounterUpdateExtractor.INSTANCE);
assertThat(counterUpdate, not(hasStructuredName()));
assertThat(counterUpdate, hasName(COUNTER_NAME));
}
use of org.apache.beam.runners.dataflow.worker.counters.CounterName in project beam by apache.
the class DataflowCounterUpdateExtractorTest method testExtractStructuredNameCorrectly.
@Test
public void testExtractStructuredNameCorrectly() {
CounterName unstructuredName = CounterName.named(COUNTER_NAME);
CounterName structuredOriginalName = unstructuredName.withOriginalName(nameContextForTest());
CounterName structuredSystemName = unstructuredName.withSystemName(nameContextForTest());
Counter<?, ?> structuredOriginal = counterFactory.intSum(structuredOriginalName);
Counter<?, ?> structuredSystem = counterFactory.intSum(structuredSystemName);
// Other two counters should be structured and should not conflict
assertThat(structuredOriginal.extractUpdate(true, DataflowCounterUpdateExtractor.INSTANCE), hasStructuredName(structuredOriginalName, "SUM"));
assertThat(structuredSystem.extractUpdate(true, DataflowCounterUpdateExtractor.INSTANCE), hasStructuredName(structuredSystemName, "SUM"));
}
Aggregations