Skip to content

Support resetting histogram? #55

Description

@brandonchinn178

Currently, counter and gauge can be reset with set 0, but histogram doesn't have that functionality. I'm considering defining metrics as global variables, and it would be nice to reset metrics if necessary in tests

Activity

  1. brandonchinn178 commented on Jun 26, 2026

    @brandonchinn178
    ContributorAuthor

    Prototype: 8c53715

  2. wraithm commented on Jun 29, 2026

    @wraithm
    Member

    Opened #61 to add Histogram.reset.

    It follows the approach from your prototype (zeroing the bucket counts, sum, and count while preserving the bucket bounds via 0 <$ histBuckets), with one change: it uses atomicModifyIORef' instead of modifyIORef' to match observe/observeAndSample and stay safe against concurrent observations.

  3. added a commit that references this issue on Jun 29, 2026
    d04500d
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions