Skip to content

Failure metrics

Each failure increments a Beam counter, visible in the runner UI (e.g. the job metrics of Dataflow) and queryable from the pipeline result:

  • namespace: asgarde-failures
  • name: the pipeline step name
final PipelineResult pipelineResult = pipeline.run();
pipelineResult.waitUntilFinish();
final MetricQueryResults metrics = pipelineResult.metrics().queryMetrics(MetricsFilter.builder()
.addNameFilter(MetricNameFilter.inNamespace(FailureMetrics.NAMESPACE))
.build());
for (MetricResult<Long> counter : metrics.getCounters()) {
System.out.println(counter.getName().getName() + ": " + counter.getAttempted() + " failures");
}

The counters apply to the MapElements/FlatMapElements steps, the Asgarde DoFn classes and the custom DoFn classes calling outputFailure(ctx, throwable). Custom exception handlers given with exceptionsVia are not counted.