Skip to content

Cosmos: Avoid tracing "WARN" or "ERROR" messages for user-triggered errors #4707

Description

@analogrelay

I was building some code to do a "Create Database if not exists" and the tracing is a little messy there, even if you do it right. I was properly checking the response status code for 409 and considering that "success". However, if I enable info level tracing for my entire application (including the Cosmos DB SDK, because of how RUST_LOG is inherited down), I get ERROR logs because we get non-200s back from the service.

We should consider either:

  1. Not logging errors for response status codes at all, just log DEBUG level.
  2. Log errors only for 500-class errors.

My leaning here is option 1, since I actually don't think we should be logging errors unless there are true error situations and we just can't know 100% for sure how an app wants to treat individual HTTP errors.

Metadata

Metadata

Labels

CosmosThe azure_cosmos crate

Type

No type

Projects

Status
Needs Review

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions