Class PeerServiceAttributesExtractor<REQUEST,​RESPONSE>


  • public final class PeerServiceAttributesExtractor<REQUEST,​RESPONSE>
    extends io.opentelemetry.instrumentation.api.instrumenter.AttributesExtractor<REQUEST,​RESPONSE>
    Extractor of the peer.service span attribute, described in the specification.

    Peer service name mappings can be configured using the otel.instrumentation.common.peer-service-mapping configuration property. The format used is a comma-separated list of host=name pairs.

    • Method Detail

      • create

        public static <REQUEST,​RESPONSE> PeerServiceAttributesExtractor<REQUEST,​RESPONSE> create​(io.opentelemetry.instrumentation.api.instrumenter.net.NetAttributesExtractor<REQUEST,​RESPONSE> netAttributesExtractor)
        Returns a new PeerServiceAttributesExtractor that will use the passed netAttributesExtractor instance to determine the value of the peer.service attribute.
      • createUsingReflection

        public static <REQUEST,​RESPONSE> @Nullable PeerServiceAttributesExtractor<REQUEST,​RESPONSE> createUsingReflection​(String netAttributesExtractorImplClassName)
        Returns a new PeerServiceAttributesExtractor that will create a new instance of type netAttributesExtractorImplClassName (which must extend NetAttributesExtractor) and use it to determine the value of the peer.service attribute.
      • onStart

        protected void onStart​(io.opentelemetry.api.common.AttributesBuilder attributes,
                               REQUEST request)
        Specified by:
        onStart in class io.opentelemetry.instrumentation.api.instrumenter.AttributesExtractor<REQUEST,​RESPONSE>
      • onEnd

        protected void onEnd​(io.opentelemetry.api.common.AttributesBuilder attributes,
                             REQUEST request,
                             RESPONSE response)
        Specified by:
        onEnd in class io.opentelemetry.instrumentation.api.instrumenter.AttributesExtractor<REQUEST,​RESPONSE>