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).
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.
Status code does not necessarily indicate an error:
someone may want to differentiate successful responses (e.g. 206 - partial success vs 200 - full one)
unsuccessful response codes don't necessarily indicate a failure (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).
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 thejava.sql.SqlException#getSQLState
.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"42000"
, orInvalidPreparedStatementDefinition
instead of"42P14"
, but there are no guarantees that exception type maps 1:1 to error code. So we want to capture both.ALREADY_EXISTS
forcreateIfNotExist
call and it's not an error, but also useful to know if resource already existed).Merge requirement checklist
[chore]