Not at all clear how to add labels to the Summary(...) time() decorator pattern
See original GitHub issueIn the README, in one of the samples, we have:
# Create a metric to track time spent and requests made.
REQUEST_TIME = Summary('request_processing_seconds', 'Time spent processing request')
# Decorate function with metric.
@REQUEST_TIME.time()
def process_request(t):
But what if I want to add labels to this? I can’t figure out how to make it work. My current code which doesn’t work is:
TRADE_REQUEST_TIME = Summary(
'request_processing_seconds',
'Time spent processing a request',
labelnames=('method', 'endpoint', 'whitelabel'),
labelvalues=('get', '/trade/', settings.WHITELABEL_NAME))
@TRADE_REQUEST_TIME.time()
def render_trade_page(request, sport):
...
But I get:
@TRADE_REQUEST_TIME.time()
AttributeError: '_LabelWrapper' object has no attribute 'time'
Any advice?
Issue Analytics
- State:
- Created 7 years ago
- Reactions:4
- Comments:5 (2 by maintainers)
Top Results From Across the Web
Metric types - Prometheus.io
Alerting based on metrics. Metric types. Counter; Gauge; Histogram; Summary. The Prometheus client libraries offer four core metric types. These are currently ...
Read more >Intro to Labeling Functions - Snorkel.org
Writing Labeling Functions: We write Python programs that take as input a data point and assign labels (or abstain) using heuristics, pattern matching,...
Read more >The Details disclosure element - HTML - MDN Web Docs
The contents of the <summary> element are used as the label for the disclosure widget. Try it. HTML Demo: <details>. Reset. HTML CSS...
Read more >Organize resources using labels | Compute Engine ...
Add or update labels to existing resources. You can add labels or update existing labels on resources by using the Google Cloud console,...
Read more >Icon Usability - Nielsen Norman Group
If that object, action, or idea is not immediately clear to users, the icon is ... Icon labels should be visible at all...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
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
Unfortunately that’s not valid syntax. However, this works:
It’s probably worth pushing this down further into your serving code, so you don’t need to have the noise of all the submetric definitions.
Yes, that’s my up. The top is where the calls enter the system.