Skip to content

Commit 8093e9d

Browse files
author
Peter Giacomo Lombardo
authored
Custom Headers: Fix report format (#290)
* Custom Headers: Fix report format * Update tests and fix key name * Remove debug remnants; Fix long tail
1 parent 65eadeb commit 8093e9d

File tree

21 files changed

+59
-50
lines changed

21 files changed

+59
-50
lines changed

instana/instrumentation/aiohttp/client.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ async def stan_request_end(session, trace_config_ctx, params):
4444
if agent.options.extra_http_headers is not None:
4545
for custom_header in agent.options.extra_http_headers:
4646
if custom_header in params.response.headers:
47-
scope.span.set_tag("http.%s" % custom_header, params.response.headers[custom_header])
47+
scope.span.set_tag("http.header.%s" % custom_header, params.response.headers[custom_header])
4848

4949
if 500 <= params.response.status <= 599:
5050
scope.span.mark_as_errored({"http.error": params.response.reason})

instana/instrumentation/aiohttp/server.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ async def stan_middleware(request, handler):
3737
if agent.options.extra_http_headers is not None:
3838
for custom_header in agent.options.extra_http_headers:
3939
if custom_header in request.headers:
40-
scope.span.set_tag("http.%s" % custom_header, request.headers[custom_header])
40+
scope.span.set_tag("http.header.%s" % custom_header, request.headers[custom_header])
4141

4242
response = None
4343
try:

instana/instrumentation/asgi.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ def _extract_custom_headers(self, span, headers):
2020
# Headers are in the following format: b'x-header-1'
2121
for header_pair in headers:
2222
if header_pair[0].decode('utf-8').lower() == custom_header.lower():
23-
span.set_tag("http.%s" % custom_header, header_pair[1].decode('utf-8'))
23+
span.set_tag("http.header.%s" % custom_header, header_pair[1].decode('utf-8'))
2424
except Exception:
2525
logger.debug("extract_custom_headers: ", exc_info=True)
2626

instana/instrumentation/aws/triggers.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ def capture_extra_headers(event, span, extra_headers):
125125
for custom_header in extra_headers:
126126
for key in event_headers:
127127
if key.lower() == custom_header.lower():
128-
span.set_tag("http.%s" % custom_header, event_headers[key])
128+
span.set_tag("http.header.%s" % custom_header, event_headers[key])
129129
except Exception:
130130
logger.debug("capture_extra_headers: ", exc_info=True)
131131

instana/instrumentation/django/middleware.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ def process_request(self, request):
3737
# Headers are available in this format: HTTP_X_CAPTURE_THIS
3838
django_header = ('HTTP_' + custom_header.upper()).replace('-', '_')
3939
if django_header in env:
40-
request.iscope.span.set_tag("http.%s" % custom_header, env[django_header])
40+
request.iscope.span.set_tag("http.header.%s" % custom_header, env[django_header])
4141

4242
request.iscope.span.set_tag(ext.HTTP_METHOD, request.method)
4343
if 'PATH_INFO' in env:

instana/instrumentation/flask/vanilla.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ def before_request_with_instana(*argv, **kwargs):
3030
# Headers are available in this format: HTTP_X_CAPTURE_THIS
3131
header = ('HTTP_' + custom_header.upper()).replace('-', '_')
3232
if header in env:
33-
span.set_tag("http.%s" % custom_header, env[header])
33+
span.set_tag("http.header.%s" % custom_header, env[header])
3434

3535
span.set_tag(ext.HTTP_METHOD, flask.request.method)
3636
if 'PATH_INFO' in env:

instana/instrumentation/flask/with_blinker.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ def request_started_with_instana(sender, **extra):
3131
# Headers are available in this format: HTTP_X_CAPTURE_THIS
3232
header = ('HTTP_' + custom_header.upper()).replace('-', '_')
3333
if header in env:
34-
span.set_tag("http.%s" % custom_header, env[header])
34+
span.set_tag("http.header.%s" % custom_header, env[header])
3535

3636
span.set_tag(ext.HTTP_METHOD, flask.request.method)
3737
if 'PATH_INFO' in env:

instana/instrumentation/pyramid/tweens.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ def __call__(self, request):
3333
# Headers are available in this format: HTTP_X_CAPTURE_THIS
3434
h = ('HTTP_' + custom_header.upper()).replace('-', '_')
3535
if h in request.headers:
36-
scope.span.set_tag("http.%s" % custom_header, request.headers[h])
36+
scope.span.set_tag("http.header.%s" % custom_header, request.headers[h])
3737

3838
if len(request.query_string):
3939
scrubbed_params = strip_secrets_from_query(request.query_string, agent.options.secrets_matcher, agent.options.secrets_list)

instana/instrumentation/tornado/server.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ def execute_with_instana(wrapped, instance, argv, kwargs):
4444
if agent.options.extra_http_headers is not None:
4545
for custom_header in agent.options.extra_http_headers:
4646
if custom_header in instance.request.headers:
47-
scope.span.set_tag("http.%s" % custom_header, instance.request.headers[custom_header])
47+
scope.span.set_tag("http.header.%s" % custom_header, instance.request.headers[custom_header])
4848

4949
setattr(instance.request, "_instana", scope)
5050

instana/instrumentation/urllib3.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ def collect_response(scope, response):
5151
if agent.options.extra_http_headers is not None:
5252
for custom_header in agent.options.extra_http_headers:
5353
if custom_header in response.headers:
54-
scope.span.set_tag("http.%s" % custom_header, response.headers[custom_header])
54+
scope.span.set_tag("http.header.%s" % custom_header, response.headers[custom_header])
5555

5656
if 500 <= response.status <= 599:
5757
scope.span.mark_as_errored()

0 commit comments

Comments
 (0)