(feat) decorator labels
See original GitHub issueThe setup of using @REQUEST_TIME.time()
is nice. would it make sense to extend it to support labels so you could have different metrics for different method calls / http calls.
Issue Analytics
- State:
- Created 6 years ago
- Reactions:3
- Comments:10 (5 by maintainers)
Top Results From Across the Web
Art Deco labels - 99Designs
Looking for Art Deco label ideas? We've collected thousands of professional Art Deco label designs from our global design community.
Read more >Custom Stickers & Labels | Available in 6 Sizes | MOO US
Make Stickers & Labels online with MOO. Design your own promotional Stickers and personalized Labels or use our customizable templates.
Read more >i5300 Labels | Brady - BradyID.com
i5300 Labels. (124 results). Can't find the right label? Design your own or work with Brady for customized label solutions.
Read more >Graduation labels - modern, masculine design | Zazzle
Mar 3, 2019 - FREE Design Tool on Zazzle! Shop Graduation labels - modern, masculine design created by TheStationeryShop. Personalize it with photos...
Read more >Order Personalized Return Address Labels - Walmart Checks
You'll find styles featuring Disney characters and other popular favorites, ... Just choose a design, personalize it, and we'll have your mailing labels...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Reviving this thread … it seems Guido had “a gut feeling” in disallowing the kind of decorator syntax that would allow method chaining https://mail.python.org/pipermail/python-dev/2004-August/046711.html. Mentioned in PEP 318
I hacked a fairly non-pythonic workaround:
If you can live with this, a workaround is to instantiate a Histogram object with label values and then call time() on this object. Like this:
The details after a not so deep analysis of the issue
When you create a Histogram (or any other metric) with label names like this:
REQUEST_TIME = Histogram('http_request_duration_seconds', 'help', ['method', 'endpoint', 'service'])
Instead of a Histogram object, what you get is a _LabelWrapper object.
Since you need a Histogram object to call the time() decorator factory, the workaround is to get back a Histogram object calling labels() on the _LabelWrapper object before using the decorator.