Skip to content

Add the ability to specify labels as a dict of labelname->labelvalue. #26

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

Merged
merged 1 commit into from
Apr 13, 2015

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