You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@beam.apache.org by "Ifat Afek (Nokia) via user" <us...@beam.apache.org> on 2024/01/30 17:05:31 UTC
Query Beam distribution metrics using a custom MetricReporter
Hi,
We are using a custom MetricReporter, in order to pass Flink and Beam metrics to our OpenTelemetry collector (we realized it has a better performance than making an HTTP call to Flink metrics endpoint).
It works great with Beam counters, but I can’t make it work with Beam Distributions.
In notifyOfAddedMetric(), I get an instance of org.apache.beam.runners.flink.metrics.FlinkMetricContainer$FlinkDistributionGauge, which extends Gauge<DistributionResult>. But when I try to down-cast the gauge’s value to DistributionResult I get the following exception:
java.lang.ClassCastException: class org.apache.beam.sdk.metrics.AutoValue_DistributionResult cannot be cast to class org.apache.beam.sdk.metrics.DistributionResult (org.apache.beam.sdk.metrics.AutoValue_DistributionResult is in unnamed module of loader org.apache.flink.util.ChildFirstClassLoader @2e396ced; org.apache.beam.sdk.metrics.DistributionResult is in unnamed module of loader 'app')
I understood that it might be related to Flink’s child-first class loader. I tried to modify it to parent-first but I got exceptions in other places.
And other solution or workaround?
Thanks,
Ifat