Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Usage of summary.time while handling exceptions #857

Closed
eranseer opened this issue Nov 16, 2022 · 2 comments
Closed

Usage of summary.time while handling exceptions #857

eranseer opened this issue Nov 16, 2022 · 2 comments

Comments

@eranseer
Copy link

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

@csmarchbanks
Copy link
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?

@eranseer
Copy link
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
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants