You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
However, the inner method returns a writer which indicates that the actual write operation does not perform yet. We should move the timer into the PrometheusMetricsWrapper and observe it after the writer is done. So the duration we collect is inaccurate.
What type of enhancement is this?
Tech debt reduction
What does the enhancement do?
The timer of
REQUESTS_DURATION_SECONDS
in the prometheus metrics layer is observed after the inner method returns.greptimedb/src/object-store/src/layers/prometheus.rs
Lines 179 to 200 in bfd3257
However, the inner method returns a writer which indicates that the actual write operation does not perform yet. We should move the timer into the
PrometheusMetricsWrapper
and observe it after the writer is done. So the duration we collect is inaccurate.Other methods also have similar issues:
read()
blocking_read()
blocking_write()
Implementation challenges
OpenDAL's metrics layer already fixed this issue. We could refer to their implementation.
https://github.com/apache/opendal/blob/50791255c6ef3ed259c88dcc04a4295fa60fa443/core/src/layers/metrics.rs#L489-L505
The
MetricWrapper
in that layer also updates the histogram indrop()
.https://github.com/apache/opendal/blob/50791255c6ef3ed259c88dcc04a4295fa60fa443/core/src/layers/metrics.rs#L765-L773
The text was updated successfully, but these errors were encountered: