Class JaegerTracerBuilder

  • All Implemented Interfaces:
    Builder<Tracer>, TracerBuilder<JaegerTracerBuilder>, Supplier<Tracer>

    public class JaegerTracerBuilder
    extends Object
    implements TracerBuilder<JaegerTracerBuilder>
    The JaegerTracerBuilder is a convenience builder for Tracer to use with Jaeger.

    Unless You want to explicitly depend on Jaeger in Your code, please use TracerBuilder.create(String) or TracerBuilder.create(io.helidon.config.Config) that is abstracted.

    The Jaeger tracer uses environment variables and system properties to override the defaults. Except for protocol and service these are honored, unless overridden in configuration or through the builder methods. See Jaeger documentation for details.

    The following table lists jaeger specific defaults and configuration options.

    Tracer Configuration Options
    option default description
    service   Required service name
    protocol http The protocol to use. By default http is used. To switch to agent mode, use udp
    host 127.0.0.1 for http, library default for udp Host to used - used by both UDP and HTTP endpoints
    port 14268 for http, library default for udp Port to be used - used by both UDP and HTTP endpoints
    path /api/traces Path to be used when using http
    token   Authentication token to use
    username   User to use to authenticate (basic authentication)
    password   Password to use to authenticate (basic authentication)
    propagation library default Propagation type to use, supports jaeger and b3
    log-spans library default Whether reporter should log spans
    max-queue-size library default Maximal queue size of the reporter
    flush-interval-ms library default Reporter flush interval in milliseconds
    sampler-type library default Sampler type (probabilistic, ratelimiting, or remote
    sampler-param library default Numeric parameter specifying details for the sampler type (see Jaeger docs)
    sampler-manager library default host and port of the sampler manager
    tags   see TracerBuilder
    boolean-tags   see TracerBuilder
    int-tags   see TracerBuilder
    See Also:
    Jaeger configuration
    • Constructor Detail

      • JaegerTracerBuilder

        protected JaegerTracerBuilder()
        Default constructor, does not modify any state.
    • Method Detail

      • forService

        public static JaegerTracerBuilder forService​(String serviceName)
        Get a Jaeger Tracer builder for processing tracing data of a service with a given name.
        Parameters:
        serviceName - name of the service that will be using the tracer.
        Returns:
        Tracer builder for Jaeger.
      • create

        public static JaegerTracerBuilder create​(Config config)
        Create a new builder based on values in configuration. This requires at least a key "service" in the provided config.
        Parameters:
        config - configuration to load this builder from
        Returns:
        a new builder instance.
        See Also:
        config(io.helidon.config.Config)
      • enabled

        public JaegerTracerBuilder enabled​(boolean enabled)
        Description copied from interface: TracerBuilder
        When enabled, tracing will be sent. If enabled is false, tracing should use a no-op tracer.
        Specified by:
        enabled in interface TracerBuilder<JaegerTracerBuilder>
        Parameters:
        enabled - set to false to disable distributed tracing
        Returns:
        updated builder instance
      • basicAuth

        public JaegerTracerBuilder basicAuth​(String username,
                                             String password)
        Configure username and password for basic authentication.
        Parameters:
        username - username to use
        password - password to use
        Returns:
        updated builder instance
      • addPropagation

        public JaegerTracerBuilder addPropagation​(io.jaegertracing.Configuration.Propagation propagation)
        Add propagation type to use.
        Parameters:
        propagation - propagation value
        Returns:
        updated builder instance
      • config

        public JaegerTracerBuilder config​(Config config)
        Description copied from interface: TracerBuilder
        Load configuration of tracer from configuration of the application. The configuration keys are specific for each tracer integration and documented in these integration projects.
        Specified by:
        config in interface TracerBuilder<JaegerTracerBuilder>
        Parameters:
        config - configuration node of the tracer configuration
        Returns:
        updated builder instance
      • samplerMananger

        @Deprecated
        public JaegerTracerBuilder samplerMananger​(String samplerManagerHostPort)
        Deprecated.
        typo, please use samplerManager(String)
        The host name and port when using the remote controlled sampler.
        Parameters:
        samplerManagerHostPort - host and port of the sampler manager
        Returns:
        updated builder instance
      • samplerManager

        public JaegerTracerBuilder samplerManager​(String samplerManagerHostPort)
        The host name and port when using the remote controlled sampler.
        Parameters:
        samplerManagerHostPort - host and port of the sampler manager
        Returns:
        updated builder instance
      • samplerParam

        public JaegerTracerBuilder samplerParam​(Number samplerParam)
        The sampler parameter (number).
        Parameters:
        samplerParam - parameter of the sampler
        Returns:
        updated builder instance
      • samplerType

        public JaegerTracerBuilder samplerType​(io.helidon.tracing.jaeger.JaegerTracerBuilder.SamplerType samplerType)
        Sampler type.

        See Sampler types.

        Parameters:
        samplerType - type of the sampler
        Returns:
        updated builder instance
      • flushInterval

        public JaegerTracerBuilder flushInterval​(long value,
                                                 TimeUnit timeUnit)
        The reporter's flush interval.
        Parameters:
        value - amount in the unit specified
        timeUnit - the time unit
        Returns:
        updated builder instance
      • maxQueueSize

        public JaegerTracerBuilder maxQueueSize​(int maxQueueSize)
        The reporter's maximum queue size.
        Parameters:
        maxQueueSize - maximal size of the queue
        Returns:
        updated builder instance
      • logSpans

        public JaegerTracerBuilder logSpans​(boolean logSpans)
        Whether the reporter should also log the spans.
        Parameters:
        logSpans - whether to log spans
        Returns:
        updated builder instance
      • token

        public JaegerTracerBuilder token​(String token)
        Authentication token sent as a "Bearer" to the endpoint.
        Parameters:
        token - token to authenticate
        Returns:
        updated builder instance