【问题标题】:Metrics getting reset after restarting dataflow pipeline重新启动数据流管道后指标被重置
【发布时间】:2018-08-10 14:45:09
【问题描述】:

我在 cloud-dataflow 中有一个流式传输管道,我将Metrics.counter 设置如下。

class SomeDoFn extends DoFn {
  val validIdCounter = Metrics.counter("user-type", "valid_ids")
  val invalidIdCounter = Metrics.counter("user-type", "invalid_ids")

  @ProcessElement
  def process(c: ProcessContext): Unit = {   
    val userId = getId(c.element) match {
    case Success(id) => 
      validIdCounter.inc()
      Some(id)
    case Failure(e) =>   
      invalidIdCounter.inc()
      None
    }
   ...
 }

我可以在 Stackdriver 监控中查看指标并为其创建警报。但是当我重新启动管道时,指标变为零。这是预期的行为吗?有没有办法可以跨作业和作业运行保留指标?

【问题讨论】:

    标签: google-cloud-dataflow google-cloud-stackdriver


    【解决方案1】:

    指标计数重置为零是预期行为。要在 Stackdriver 中保留总指标计数,请在绘制指标图表时使用计数聚合。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2018-05-01
      • 2019-08-05
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-10-09
      • 1970-01-01
      相关资源
      最近更新 更多