Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion prometheus-client/src/Prometheus/Metric/Summary.hs
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ summary info quantiles_ = Metric $ do

instance Observer Summary where
-- | Adds a new observation to a summary metric.
observe s v = doIO $ withMVar (reqSketch s) (`ReqSketch.insert` v)
observe s v = doIO $ withMVarMasked (reqSketch s) (\rs -> rs `ReqSketch.insert` v)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Question: What's the motivation for adding the \rs -> rs bit?

No particular objections, just curious.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggestion: Add a comment explaining why we are masking here. Something along the lines of your PR description would be great.

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1 on adding a comment directly to the code.


-- | Retrieves a list of tuples containing a quantile and its associated value.
getSummary :: MonadIO m => Summary -> m [(Rational, Double)]
Expand Down