use of org.apache.beam.runners.core.metrics.MetricUpdates.MetricUpdate in project beam by apache.
the class DirectMetricsTest method testPartialScopeMatchingInMetricsQuery.
@SuppressWarnings("unchecked")
@Test
public void testPartialScopeMatchingInMetricsQuery() {
metrics.updatePhysical(bundle1, MetricUpdates.create(ImmutableList.of(MetricUpdate.create(MetricKey.create("Top1/Outer1/Inner1", NAME1), 5L), MetricUpdate.create(MetricKey.create("Top1/Outer1/Inner2", NAME1), 8L)), ImmutableList.<MetricUpdate<DistributionData>>of(), ImmutableList.<MetricUpdate<GaugeData>>of()));
metrics.updatePhysical(bundle1, MetricUpdates.create(ImmutableList.of(MetricUpdate.create(MetricKey.create("Top2/Outer1/Inner1", NAME1), 12L), MetricUpdate.create(MetricKey.create("Top1/Outer2/Inner2", NAME1), 18L)), ImmutableList.<MetricUpdate<DistributionData>>of(), ImmutableList.<MetricUpdate<GaugeData>>of()));
MetricQueryResults results = metrics.queryMetrics(MetricsFilter.builder().addStep("Top1/Outer1").build());
assertThat(results.counters(), containsInAnyOrder(attemptedMetricsResult("ns1", "name1", "Top1/Outer1/Inner1", 5L), attemptedMetricsResult("ns1", "name1", "Top1/Outer1/Inner2", 8L)));
results = metrics.queryMetrics(MetricsFilter.builder().addStep("Inner2").build());
assertThat(results.counters(), containsInAnyOrder(attemptedMetricsResult("ns1", "name1", "Top1/Outer1/Inner2", 8L), attemptedMetricsResult("ns1", "name1", "Top1/Outer2/Inner2", 18L)));
}
use of org.apache.beam.runners.core.metrics.MetricUpdates.MetricUpdate in project beam by apache.
the class DirectMetricsTest method testApplyAttemptedCountersQueryOneNamespace.
@SuppressWarnings("unchecked")
@Test
public void testApplyAttemptedCountersQueryOneNamespace() {
metrics.updatePhysical(bundle1, MetricUpdates.create(ImmutableList.of(MetricUpdate.create(MetricKey.create("step1", NAME1), 5L), MetricUpdate.create(MetricKey.create("step1", NAME3), 8L)), ImmutableList.<MetricUpdate<DistributionData>>of(), ImmutableList.<MetricUpdate<GaugeData>>of()));
metrics.updatePhysical(bundle1, MetricUpdates.create(ImmutableList.of(MetricUpdate.create(MetricKey.create("step2", NAME1), 7L), MetricUpdate.create(MetricKey.create("step1", NAME3), 4L)), ImmutableList.<MetricUpdate<DistributionData>>of(), ImmutableList.<MetricUpdate<GaugeData>>of()));
MetricQueryResults results = metrics.queryMetrics(MetricsFilter.builder().addNameFilter(inNamespace("ns1")).build());
assertThat(results.counters(), containsInAnyOrder(attemptedMetricsResult("ns1", "name1", "step1", 5L), attemptedMetricsResult("ns1", "name1", "step2", 7L)));
assertThat(results.counters(), containsInAnyOrder(committedMetricsResult("ns1", "name1", "step1", 0L), committedMetricsResult("ns1", "name1", "step2", 0L)));
}
use of org.apache.beam.runners.core.metrics.MetricUpdates.MetricUpdate in project beam by apache.
the class DirectMetricsTest method testApplyAttemptedQueryCompositeScope.
@SuppressWarnings("unchecked")
@Test
public void testApplyAttemptedQueryCompositeScope() {
metrics.updatePhysical(bundle1, MetricUpdates.create(ImmutableList.of(MetricUpdate.create(MetricKey.create("Outer1/Inner1", NAME1), 5L), MetricUpdate.create(MetricKey.create("Outer1/Inner2", NAME1), 8L)), ImmutableList.<MetricUpdate<DistributionData>>of(), ImmutableList.<MetricUpdate<GaugeData>>of()));
metrics.updatePhysical(bundle1, MetricUpdates.create(ImmutableList.of(MetricUpdate.create(MetricKey.create("Outer1/Inner1", NAME1), 12L), MetricUpdate.create(MetricKey.create("Outer2/Inner2", NAME1), 18L)), ImmutableList.<MetricUpdate<DistributionData>>of(), ImmutableList.<MetricUpdate<GaugeData>>of()));
MetricQueryResults results = metrics.queryMetrics(MetricsFilter.builder().addStep("Outer1").build());
assertThat(results.counters(), containsInAnyOrder(attemptedMetricsResult("ns1", "name1", "Outer1/Inner1", 12L), attemptedMetricsResult("ns1", "name1", "Outer1/Inner2", 8L)));
assertThat(results.counters(), containsInAnyOrder(committedMetricsResult("ns1", "name1", "Outer1/Inner1", 0L), committedMetricsResult("ns1", "name1", "Outer1/Inner2", 0L)));
}
Aggregations