Skip to content
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

fix: The spec doesn't set upper limit for ec=1 if code>=500 #482

Merged
merged 1 commit into from
Dec 14, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion instana/instrumentation/aiohttp/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ async def stan_request_end(session, trace_config_ctx, params):
if custom_header in params.response.headers:
scope.span.set_tag("http.header.%s" % custom_header, params.response.headers[custom_header])

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

scope.close()
Expand Down
2 changes: 1 addition & 1 deletion instana/instrumentation/aiohttp/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ async def stan_middleware(request, handler):

if response is not None:
# Mark 500 responses as errored
if 500 <= response.status <= 511:
if 500 <= response.status:
scope.span.mark_as_errored()

scope.span.set_tag("http.status_code", response.status)
Expand Down
2 changes: 1 addition & 1 deletion instana/instrumentation/asgi.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ async def send_wrapper(response):
try:
status_code = response.get('status')
if status_code is not None:
if 500 <= int(status_code) <= 511:
if 500 <= int(status_code):
span.mark_as_errored()
span.set_tag('http.status_code', status_code)

Expand Down
2 changes: 1 addition & 1 deletion instana/instrumentation/django/middleware.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ def process_request(self, request):
def process_response(self, request, response):
try:
if request.iscope is not None:
if 500 <= response.status_code <= 511:
if 500 <= response.status_code:
request.iscope.span.assure_errored()
# for django >= 2.2
if request.resolver_match is not None and hasattr(request.resolver_match, 'route'):
Expand Down
2 changes: 1 addition & 1 deletion instana/instrumentation/fastapi_inst.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ async def instana_exception_handler(request, exc):
span = async_tracer.active_span

if span is not None:
if hasattr(exc, 'detail') and (500 <= exc.status_code <= 599):
if hasattr(exc, 'detail') and 500 <= exc.status_code:
span.set_tag('http.error', exc.detail)
span.set_tag('http.status_code', exc.status_code)
except Exception:
Expand Down
2 changes: 1 addition & 1 deletion instana/instrumentation/flask/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ def handle_user_exception_with_instana(wrapped, instance, argv, kwargs):
else:
status_code = response.status_code

if 500 <= status_code <= 511:
if 500 <= status_code:
span.log_exception(exc)

span.set_tag(ext.HTTP_STATUS_CODE, int(status_code))
Expand Down
2 changes: 1 addition & 1 deletion instana/instrumentation/flask/vanilla.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ def after_request_with_instana(response):
if scope is not None:
span = scope.span

if 500 <= response.status_code <= 511:
if 500 <= response.status_code:
span.mark_as_errored()

span.set_tag(ext.HTTP_STATUS_CODE, int(response.status_code))
Expand Down
2 changes: 1 addition & 1 deletion instana/instrumentation/flask/with_blinker.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ def request_finished_with_instana(sender, response, **extra):
if scope is not None:
span = scope.span

if 500 <= response.status_code <= 511:
if 500 <= response.status_code:
span.mark_as_errored()

span.set_tag(ext.HTTP_STATUS_CODE, int(response.status_code))
Expand Down
2 changes: 1 addition & 1 deletion instana/instrumentation/pyramid/tweens.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ def __call__(self, request):
if response:
scope.span.set_tag("http.status", response.status_int)

if 500 <= response.status_int <= 511:
if 500 <= response.status_int:
if response.exception is not None:
message = str(response.exception)
scope.span.log_exception(response.exception)
Expand Down
4 changes: 2 additions & 2 deletions instana/instrumentation/sanic_inst.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ def exception_with_instana(wrapped, instance, args, kwargs):
status_code = kwargs.get("status_code")
span = async_tracer.active_span

if all([span, status_code, message]) and (500 <= status_code <= 599):
if all([span, status_code, message]) and 500 <= status_code:
span.set_tag("http.error", message)
try:
wrapped(*args, **kwargs)
Expand All @@ -39,7 +39,7 @@ def response_details(span, response):
try:
status_code = response.status
if status_code is not None:
if 500 <= int(status_code) <= 511:
if 500 <= int(status_code):
span.mark_as_errored()
span.set_tag('http.status_code', status_code)

Expand Down
2 changes: 1 addition & 1 deletion instana/instrumentation/tornado/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ def on_finish_with_instana(wrapped, instance, argv, kwargs):
status_code = instance.get_status()

# Mark 500 responses as errored
if 500 <= status_code <= 511:
if 500 <= status_code:
scope.span.mark_as_errored()

scope.span.set_tag("http.status_code", status_code)
Expand Down
2 changes: 1 addition & 1 deletion instana/instrumentation/urllib3.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ def collect_response(scope, response):
if custom_header in response.headers:
scope.span.set_tag("http.header.%s" % custom_header, response.headers[custom_header])

if 500 <= response.status <= 599:
if 500 <= response.status:
scope.span.mark_as_errored()
except Exception:
logger.debug("collect_response", exc_info=True)
Expand Down
2 changes: 1 addition & 1 deletion instana/instrumentation/wsgi.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ def new_start_response(status, headers, exc_info=None):
res = start_response(status, headers, exc_info)

sc = status.split(' ')[0]
if 500 <= int(sc) <= 511:
if 500 <= int(sc):
self.scope.span.mark_as_errored()

self.scope.span.set_tag(tags.HTTP_STATUS_CODE, sc)
Expand Down
Loading