Interface DbClientAttributesGetter<REQUEST,RESPONSE>

All Superinterfaces:
io.opentelemetry.instrumentation.api.semconv.network.NetworkAttributesGetter<REQUEST,RESPONSE>, io.opentelemetry.instrumentation.api.semconv.network.ServerAttributesGetter<REQUEST>
All Known Subinterfaces:
SqlClientAttributesGetter<REQUEST,RESPONSE>

public interface DbClientAttributesGetter<REQUEST,RESPONSE> extends io.opentelemetry.instrumentation.api.semconv.network.NetworkAttributesGetter<REQUEST,RESPONSE>, io.opentelemetry.instrumentation.api.semconv.network.ServerAttributesGetter<REQUEST>
An interface for getting database client attributes.

Instrumentation authors will create implementations of this interface for their specific library/framework. It will be used by the DbClientAttributesExtractor to obtain the various database client attributes in a type-generic way.

If an attribute is not available in this library, it is appropriate to return null from the attribute methods, but implement as many as possible for best compliance with the OpenTelemetry specification.

  • Method Details

    • getDbQueryText

      @Nullable String getDbQueryText(REQUEST request)
    • getDbQuerySummary

      @Nullable default String getDbQuerySummary(REQUEST request)
    • getDbOperationName

      @Nullable String getDbOperationName(REQUEST request)
    • getDbSystemName

      String getDbSystemName(REQUEST request)
    • getDbSystem

      @Deprecated default String getDbSystem(REQUEST request)
      Deprecated.
      Returns the old semconv db.system value. Defaults to getDbSystemName(REQUEST) for instrumentations where the old and new values are the same.

      Implementors whose old db.system value differs from the new db.system.name value must override this method; otherwise old-semconv spans will silently emit the new value for db.system.

    • getDbNamespace

      @Nullable String getDbNamespace(REQUEST request)
    • getDbName

      @Deprecated @Nullable default String getDbName(REQUEST request)
      Deprecated.
      Returns the old db.name value. This is only used for old semantic conventions.
    • getUser

      @Deprecated @Nullable default String getUser(REQUEST request)
      Deprecated.
      There is no replacement at this time.
      Returns the database user name. This is only used for old semantic conventions.
    • getConnectionString

      @Deprecated @Nullable default String getConnectionString(REQUEST request)
      Deprecated.
      There is no replacement at this time.
      Returns the database connection string. This is only used for old semantic conventions.
    • getDbOperationBatchSize

      @Nullable default Long getDbOperationBatchSize(REQUEST request)
    • getDbQueryParameters

      default Map<String,String> getDbQueryParameters(REQUEST request)
    • getErrorType

      @Nullable default String getErrorType(REQUEST request, @Nullable RESPONSE response, @Nullable Throwable error)
      Returns a description of a class of error the operation ended with.

      If this method returns null, the exception class name (if any) will be used as error type.

      The cardinality of the error type should be low. The instrumentations implementing this method are recommended to document the custom values they support.