flink-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Julio Biason <julio.bia...@azion.com>
Subject [Docs] Can't add metrics to RichFilterFunction
Date Thu, 14 Dec 2017 12:56:41 GMT
Hello,

I'm trying to add a metric to a filter function, but following the example
in the docs is not working.

So I have this class:

```
class LogBrokenFilter extends RichFilterFunction[LineData] {
  private val logger = LoggerFactory.getLogger(this.getClass)
  @transient private var counter:Counter

  override def open(parameters:Configuration):Unit = {
    counter = getRuntimeContext
      .getMetricGroup()
      .counter("brokenLogs")
  }

  // and then I override `filter` to do filter events out and count those.
```

The problem is that, when compiling, I get the following errors:

abstract member may not have private modifier
[error]   @transient private var counter:Counter

and

no valid targets for annotation on method counter - it is discarded unused.
You may specify targets with meta-annotations, e.g. @(transient @getter)
[warn]   @transient private var counter:Counter
[warn]    ^

Any ideas? Are the docs wrong?

-- 
*Julio Biason*, Sofware Engineer
*AZION*  |  Deliver. Accelerate. Protect.
Office: +55 51 3083 8101 <callto:+555130838101>  |  Mobile: +55 51
<callto:+5551996209291>*99907 0554*

Mime
View raw message