Class DbClientSpanNameExtractor<REQUEST>

java.lang.Object
io.opentelemetry.instrumentation.api.incubator.semconv.db.DbClientSpanNameExtractor<REQUEST>
All Implemented Interfaces:
io.opentelemetry.instrumentation.api.instrumenter.SpanNameExtractor<REQUEST>

public abstract class DbClientSpanNameExtractor<REQUEST> extends Object implements io.opentelemetry.instrumentation.api.instrumenter.SpanNameExtractor<REQUEST>
  • Method Details

    • create

      public static <REQUEST> io.opentelemetry.instrumentation.api.instrumenter.SpanNameExtractor<REQUEST> create(DbClientAttributesGetter<REQUEST,?> getter)
      Returns a SpanNameExtractor that constructs the span name according to DB semantic conventions.
    • create

      public static <REQUEST> io.opentelemetry.instrumentation.api.instrumenter.SpanNameExtractor<REQUEST> create(SqlClientAttributesGetter<REQUEST,?> getter)
      Returns a SpanNameExtractor that constructs the span name according to DB semantic conventions.
    • computeSpanName

      protected String computeSpanName(@Nullable String namespace, @Nullable String operationName, @Nullable String collectionName, @Nullable String storedProcedureName)
    • computeSpanNameStable

      protected String computeSpanNameStable(DbClientAttributesGetter<REQUEST,?> getter, REQUEST request, @Nullable String operation, @Nullable String collectionName, @Nullable String storedProcedureName)
      Computes the span name following stable semconv fallback order.

      Fallback order:

      1. {db.operation.name} {target} if operation is available
      2. {target} if only target is available
      3. {db.system.name} if nothing else is available

      Target fallback order:

      1. {db.collection.name}
      2. {db.stored_procedure.name}
      3. {db.namespace}
      4. {server.address:server.port}