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

Add db.response.status_code attribute, deprecate db.cosmos.status_code #1424

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

lmolkova
Copy link
Contributor

@lmolkova lmolkova commented Sep 20, 2024

Introducing status code for database call based on the discussion in DB Semconv.

Most databases support a notion of a status code (usually representing an error, but also used for warnings and sometimes to differentiate success results).

E.g. SQL standard defines SQLSTATE - a string code. It, for example, appears on the java.sql.SqlException#getSQLStateType.

Databases that run on top of HTTP/gRPC/etc may also support status codes from that protocol. For example, Cosmos DB can run on top of HTTP or RNTBD (proprietary protocol), but needs one status code for both.

HBase supports HTTP, Thrift and gRPC and may report different codes depending on the protocol.


We need a place to capture DB response code that's not protocol-specific and could be reported on common metrics for all databases.

error.type does not work at least in some cases

  • Capturing exception type may give human-readable result (e.g. SQLSyntaxErrorException instead od SQLSTATE "42000", or InvalidPreparedStatementDefinition instead of "42P14", but there are no guarantees that exception type maps 1:1 to error code. So we want to capture both.
  • Unsuccessful status code does not necessarily indicate an error (e.g. database may report HTTP 409 or gRPC ALREADY_EXISTS for createIfNotExist call and it's not an error, but also useful to know if resource already existed).

Merge requirement checklist

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: In Progress
Development

Successfully merging this pull request may close these issues.

2 participants