-
Couldn't load subscription status.
- Fork 1.4k
Description
At Mesmer project we are working on an OpenTelemetry instrumentation library for Scala applications, and we are trying to improve our implementation for integrating ZIO metrics with OpenTelemetry. Looking at https://github.com/zio/zio-metrics-connectors, it seems that there are two approaches, both based on interactions with ConcurrentMetricRegistry - Prometheus connector polls snapshots periodically and publishes the metrics, however Datadog connector adds a listener to metric updates. It seem to me that using listeners is a cleaner approach and we are thinking of going with it, but looking internally at Metric UnsafeAPI, we can see that notifyListeners is only called for update method and not modify method. At a quick glance, both of these methods seem to do the same thing, but if the metric is updated using modify method, then listeners won't be notified and, in the case of Datadog connector, metrics won't get published. This seems like a bug.
What is the difference between update and modify methods of Metrics UnsafeAPI? Should modify also notify listeners?
Also, is there a good reason why https://github.com/zio/zio-metrics-connectors is using different approaches of interacting with ConcurrentMetricRegistry that we should also consider for Mesmer?