Skip to content

Add a helper method observeExecution #42

@ns3777k

Description

@ns3777k

Hey!

What do you think about adding a helper method observeExecution to Histogram class:

public function observeExecution(callable $fn, array $labels = []): void
{
    $start = microtime(true);
    $fn();
    $duration = microtime(true) - $start;
    $this->observe($duration, $labels);
}

Can make a PR.

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