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

Reply via email to