Skip to content

Footgun when retrieving multiple metrics from the same family #300

@huntc

Description

@huntc

Another footgun that I discovered the hard way (production) is to get_or_create multiple metrics within a family and assign to multiple variables and then deadlock. It isn't apparent that a lock is held and returned. Perhaps renaming get_or_create to get_or_create_with_lock would be an improvement, or provide a closure to get_or_create.

This then keeps the scope of the lock to local.

I realise there is Rustdoc on this, but that's easy to be missed.

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