Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Please keep the discussion on the mailing list rather than commenting on the wiki (wiki discussions get unwieldy fast).

Motivation

The  Metrics  registry is often used by concurrent threadsConcurrent thread may try to access the Metrics registry to create the same, instance-level metric, however it's get/create APIs are not well suited for it. A common pattern from the user that users follow today is:


Code Block
metric = metrics.metric(metricName);

if (metric == null) {
  try {
    metrics.addMetric(..)
  } catch (IllegalArgumentException e){
    // another thread may create the metric at the mean time
  }
} 

...