-
Notifications
You must be signed in to change notification settings - Fork 2k
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
Removing full exception trace from 404 error #24195
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -230,16 +230,8 @@ private <T> Mono<T> traceEnabledPublisher(Mono<T> resultPublisher, | |
} | ||
}).doOnError(throwable -> { | ||
if (isEnabled() && !isNestedCall) { | ||
Throwable unwrappedException = reactor.core.Exceptions.unwrap(throwable); | ||
if (unwrappedException instanceof CosmosException) { | ||
CosmosException dce = (CosmosException) unwrappedException; | ||
try { | ||
addDiagnosticsOnTracerEvent(dce.getDiagnostics(), parentContext.get()); | ||
} catch (JsonProcessingException ex) { | ||
LOGGER.warn("Error while serializing diagnostics for tracer", ex.getMessage()); | ||
} | ||
} | ||
|
||
// not adding diagnostics on trace event for exception as this information is already there as | ||
// part of exception message | ||
this.endSpan(parentContext.get(), Signal.error(throwable), ERROR_CODE); | ||
} | ||
}); | ||
|
@@ -289,10 +281,18 @@ private <T> Mono<T> publisherWithClientTelemetry(Mono<T> resultPublisher, | |
|
||
private void end(int statusCode, Throwable throwable, Context context) { | ||
if (throwable != null) { | ||
tracer.setAttribute(TracerProvider.ERROR_MSG, throwable.getMessage(), context); | ||
tracer.setAttribute(TracerProvider.ERROR_TYPE, throwable.getClass().getName(), context); | ||
if (statusCode == HttpConstants.StatusCodes.NOTFOUND) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please only remove the callstack etc. for 404 with Substatusode 0 - for any SubStatusCode != 0 (like ReadSessionNotAvailable 1002 etc.) we should leave the callstack There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yea sure will add substatus check as well. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Done, added 404/0 check |
||
tracer.setAttribute(TracerProvider.ERROR_MSG, "Not found exception", context); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I believe 404 statusCode is enough and the core tracer will populate all the info needed. Can we avoid populating custom error codes? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If we remove ERROR_TYPE/ERROR_MSG then we wont be seeing below attributes which was the initial requirement from @trask There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. since this is no longer an exception, it shouldn't have exception attributes - There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Removed error.msg and error.type |
||
tracer.setAttribute(TracerProvider.ERROR_TYPE, throwable.getClass().getName(), context); | ||
tracer.end(statusCode, null, context); | ||
} else { | ||
tracer.setAttribute(TracerProvider.ERROR_MSG, throwable.getMessage(), context); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. BTW, why are we adding those?
So we can remove all ERROR_TYPE/ERROR_MSG attributes logic? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If we remove ERROR_TYPE/ERROR_MSG then we wont be seeing below attributes which was the initial requirement from @trask There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can you please add screenshot for non-404 case? There will be standard otel attributes recorded for exception ( @trask I believe you wanted to have otel semantic exception attributes attached, they have changed and now we are populating new ones + old ones. Are you ok with cosmos removing There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. yes, I think we should remove those, I had similar thought a few weeks ago but got distracted from opening PR 😓: trask@af44c69 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @trask Removed error.msg and error.type. |
||
tracer.setAttribute(TracerProvider.ERROR_TYPE, throwable.getClass().getName(), context); | ||
tracer.end(statusCode, throwable, context); | ||
} | ||
} else { | ||
tracer.end(statusCode, null, context); | ||
} | ||
tracer.end(statusCode, throwable, context); | ||
} | ||
|
||
private void fillClientTelemetry(CosmosAsyncClient cosmosAsyncClient, | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
shouldn't we do the same thing for 409s (ResourceAlreadyExists) as well?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
And 412
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We talked through all these and decided 404 is more regular business scenario then others. We will wait and watch for other error on customer demand basis