Skip to content

Commit

Permalink
Add http.route (#90)
Browse files Browse the repository at this point in the history
Adds http.route annotation, which is a patterned, low cardinality annotation, which is useful for metrics aggregation
  • Loading branch information
bplotnick committed Mar 9, 2018
1 parent 3ad4601 commit 6a2c4ff
Show file tree
Hide file tree
Showing 8 changed files with 36 additions and 372 deletions.
3 changes: 3 additions & 0 deletions pyramid_zipkin/request_helper.py
Expand Up @@ -162,9 +162,12 @@ def get_binary_annotations(request, response):
:param response: the Pyramid response object
:returns: binary annotation dict of {str: str}
"""
route = request.matched_route.pattern if request.matched_route else ''

annotations = {
'http.uri': request.path,
'http.uri.qs': request.path_qs,
'http.route': route,
'response_status_code': str(response.status_code),
}
settings = request.registry.settings
Expand Down
Empty file removed pyramid_zipkin/thrift/__init__.py
Empty file.
362 changes: 0 additions & 362 deletions pyramid_zipkin/thrift/zipkinCore.thrift

This file was deleted.

6 changes: 6 additions & 0 deletions tests/acceptance/app/__init__.py
Expand Up @@ -80,6 +80,11 @@ def some_function(a, b):
return {'result': some_function(1, 2)}


@view_config(route_name='pattern_route', renderer='json')
def pattern_route(dummy_request):
return {'result': dummy_request.matchdict['petId']}


@view_config(route_name='sample_route_child_span', renderer='json')
def sample_child_span(dummy_request):
return create_http_headers_for_new_span()
Expand Down Expand Up @@ -112,6 +117,7 @@ def main(global_config, **settings):
config.add_route('sample_route_child_span', '/sample_child_span')
config.add_route('span_context', '/span_context')
config.add_route('decorator_context', '/decorator_context')
config.add_route('pattern_route', '/pet/{petId}')

config.add_route('server_error', '/server_error')
config.add_route('client_error', '/client_error')
Expand Down

0 comments on commit 6a2c4ff

Please sign in to comment.