Flink:添加仪表时构建失败

Flink : Build is failing when I add gauge

无法使用 gauge ,构建失败:

 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: String,x: G)G <and>
[ERROR]   [T, G <: org.apache.flink.metrics.Gauge[T]](x: Int, x: G)G
[ERROR]  cannot be applied to (String, org.apache.flink.metrics.Gauge[Int])
[ERROR]         .gauge("RecordConverter.latency", new Gauge[Int]() {
[ERROR]          ^

您必须明确设置类型,如下所示:

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