Skip to content

Conversation

@korfuri
Copy link
Contributor

@korfuri korfuri commented Apr 13, 2015

This is useful for code that knows some of the labels in different places.

An example use case is a helper I'm trying to write that would work as such:

c = Counter('http_exceptions_total', 'help', ['method', 'exception_type'])
def handle_request(request):
with count_exceptions_by_type(c, {'method': request.method}):
do_something(request)

This helper only knows about the exception_type label and only passes
the other labels through.

This is useful for code that knows some of the labels in different places.

An example use case is a helper I'm trying to write that would work as such:

c = Counter('http_exceptions_total', 'help', ['method', 'exception_type'])
def handle_request(request):
    with count_exceptions_by_type(c, {'method': request.method}):
        do_something(request)

This helper only knows about the exception_type label and only passes
the other labels through.
@korfuri
Copy link
Contributor Author

korfuri commented Apr 13, 2015

per CONTRIBUTING.md, ping @brian-brazil :)

brian-brazil added a commit that referenced this pull request Apr 13, 2015
Add the ability to specify labels as a dict of labelname->labelvalue.
@brian-brazil brian-brazil merged commit 61e2412 into prometheus:master Apr 13, 2015
@korfuri korfuri deleted the labelnames branch April 13, 2015 14:17
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

Successfully merging this pull request may close these issues.

2 participants