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
When a histogram is observed, the code that is being measured is sent to ObserveDuration or ObserveDurationAsync as a Func parameter.
We have a requirement where if any Prometheus operations results in an exception (ex: IncTo, ObserveDuration, etc.), that exception should be swallowed/ignored so that it doesn't interrupt the execution path where IncTo or ObserveDuration was called.
However, if the code in the Func that was passed in throws an exception, we do want that exception to bubble up.
This is an issue with ObserveDuration because both ObserveDuration and the Func are called from the same line of code. This prevents us from taking the action we've taken in the past - using a try/catch to swallow the exception - because it would swallow the exception from the Func as well.
I've taken a brief look at the source code, and it appears that this would be very possible due to the fact that there are basically only two lines of code in ObserveDuration - one that executes the Func, and one that observes the value.
Note: All of these comments apply to both ObserveDuration and ObserveDurationAsync
The text was updated successfully, but these errors were encountered:
When a histogram is observed, the code that is being measured is sent to
ObserveDuration
orObserveDurationAsync
as aFunc
parameter.We have a requirement where if any Prometheus operations results in an exception (ex:
IncTo
,ObserveDuration
, etc.), that exception should be swallowed/ignored so that it doesn't interrupt the execution path whereIncTo
orObserveDuration
was called.However, if the code in the
Func
that was passed in throws an exception, we do want that exception to bubble up.This is an issue with
ObserveDuration
because bothObserveDuration
and theFunc
are called from the same line of code. This prevents us from taking the action we've taken in the past - using a try/catch to swallow the exception - because it would swallow the exception from theFunc
as well.I've taken a brief look at the source code, and it appears that this would be very possible due to the fact that there are basically only two lines of code in
ObserveDuration
- one that executes theFunc
, and one that observes the value.Note: All of these comments apply to both
ObserveDuration
andObserveDurationAsync
The text was updated successfully, but these errors were encountered: