Class JetMetricResults
java.lang.Object
org.apache.beam.sdk.metrics.MetricResults
org.apache.beam.runners.jet.metrics.JetMetricResults
Jet specific
MetricResults
.-
Constructor Summary
ConstructorsConstructorDescriptionJetMetricResults
(com.hazelcast.map.IMap<String, org.apache.beam.runners.core.metrics.MetricUpdates> metricsAccumulator) -
Method Summary
Modifier and TypeMethodDescriptionvoid
freeze()
queryMetrics
(@Nullable MetricsFilter filter) Query for all metric values that match a given filter.Methods inherited from class org.apache.beam.sdk.metrics.MetricResults
allMetrics, toString
-
Constructor Details
-
JetMetricResults
public JetMetricResults(com.hazelcast.map.IMap<String, org.apache.beam.runners.core.metrics.MetricUpdates> metricsAccumulator)
-
-
Method Details
-
freeze
public void freeze() -
queryMetrics
Description copied from class:MetricResults
Query for all metric values that match a given filter.The
filter
may filter based on the namespace and/or name of the metric, as well as the step that reported the metric.For each type of metric, the result contains an iterable of all metrics of that type that matched the filter. Each
MetricResult
includes the name of the metric, the step in which it was reported and theMetricResult.getCommitted()
andMetricResult.getAttempted()
values.Note that runners differ in their support for committed and attempted values.
Example: Querying the metrics reported from the
SomeDoFn
example inMetrics
could be done as follows:Pipeline p = ...; p.apply("create1", Create.of("hello")).apply("myStepName1", ParDo.of(new SomeDoFn())); p.apply("create2", Create.of("world")).apply("myStepName2", ParDo.of(new SomeDoFn())); PipelineResult result = p.run(); MetricResults metrics = result.metrics(); MetricQueryResults metricResults = metrics.queryMetrics(new MetricsFilter.Builder() .addNameFilter("my-counter") .addStepFilter("myStepName1").addStepFilter("myStepName2") .build()); Iterable<MetricResult<Long>> counters = metricResults.getCounters(); // counters should contain the value of my-counter reported from each of the ParDo // applications.
- Specified by:
queryMetrics
in classMetricResults
-