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

Suppress tracing on NotFound response #3964

Closed
MarkMpn opened this issue Jul 4, 2023 · 2 comments · Fixed by #3969
Closed

Suppress tracing on NotFound response #3964

MarkMpn opened this issue Jul 4, 2023 · 2 comments · Fixed by #3969
Assignees
Labels
Diagnostics Issues around diagnostics and troubleshooting Performance

Comments

@MarkMpn
Copy link

MarkMpn commented Jul 4, 2023

I commonly use ReadItemStreamAsync to try to get a value which might or might not exist. Although this method doesn't throw an exception if the item doesn't exist, it still logs an error via the trace listener, which fills up my logs and makes actual errors harder to find. My logs quickly fill up with entries like:

Operation will NOT be retried. Current attempt 0, Status Code: NotFound

I'd like an option to filter errors before they are logged so I can ignore these errors without turning off all error logging as I don't want to lose other error logs in case of more serious problems.

Is there something I can use within the existing code to achieve this?

@ghost ghost added the needs-investigation label Jul 4, 2023
@ealsur
Copy link
Member

ealsur commented Jul 7, 2023

Seems the trace is coming from

DefaultTrace.TraceError(
"Operation will NOT be retried. Current attempt {0}, Status Code: {1} ",
this.currentAttemptCount,
dce.StatusCode);

This trace should not be a TraceError but rather a TraceVerbose.

DefaultTrace.TraceError(
"Operation will NOT be retried. Current attempt {0}, Status Code: {1} ",
this.currentAttemptCount,
cosmosResponseMessage?.StatusCode);

Should also need to be adjusted.

@ealsur ealsur added Performance Diagnostics Issues around diagnostics and troubleshooting and removed needs-investigation labels Jul 7, 2023
@ealsur ealsur moved this to Approved in Azure Cosmos SDKs Jul 7, 2023
@ealsur
Copy link
Member

ealsur commented Jul 7, 2023

@rinatmini Could you take a look? Should be a small/straightforward change.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Diagnostics Issues around diagnostics and troubleshooting Performance
Projects
Status: Done
Development

Successfully merging a pull request may close this issue.

3 participants