Skip to content

Usage of summary.time while handling exceptions #857

Closed

Description

@eranseer

Hello

Is there any option to handle exceptions while running summary.time() ?

for example

metric_m= prometheus_client.Summary('name', 'Measure method duration in seconds',
                                           ['label1', 'label2'])
metric = metric_m.labels(lablel1=label1,label2=label2)
        with metric.time():
            work()

if work() raises exception I don't have an option to know it from the metric as I have to define label values before calling to the function.

Thanks

Activity

  1. csmarchbanks commented on Nov 23, 2022

    @csmarchbanks
    Member

    Hello, I believe this feature was added in #730, we are working on improving our documentation, so hopefully it will be easier to find that functionality in the future!

    Does that functionality address the problem for you?

  2. eranseer commented on Nov 27, 2022

    @eranseer
    Author

    Yes thank you ! this makes more sense.

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