Pushpendra Jaiswal
Pushpendra Jaiswal

Reputation: 470

Flink : Build is failing when I add gauge

Cannot use gauge , the build is failing:

 def open(configuration: Configuration) {
  getRuntimeContext()
    .getMetricGroup()
    .gauge("RecordConverter.latency", new Gauge[Int]() {
      @Override
      def getValue(): Int = {
        return latency;
      }
    });
   }

============================================================

error: overloaded method value gauge with alternatives:
[ERROR]   [T, G <: org.apache.flink.metrics.Gauge[T]](x$1: String,x$2: G)G <and>
[ERROR]   [T, G <: org.apache.flink.metrics.Gauge[T]](x$1: Int, x$2: G)G
[ERROR]  cannot be applied to (String, org.apache.flink.metrics.Gauge[Int])
[ERROR]         .gauge("RecordConverter.latency", new Gauge[Int]() {
[ERROR]          ^

Upvotes: 3

Views: 242

Answers (1)

Chesnay Schepler
Chesnay Schepler

Reputation: 1270

You have to explicitly set the types, like this:

 .gauge[Int, Gauge[Int]]("RecordConverter.latency"...

Upvotes: 3

Related Questions