Package io.helidon.tracing.jaeger
Class JaegerTracerBuilder
- java.lang.Object
-
- io.helidon.tracing.jaeger.JaegerTracerBuilder
-
- All Implemented Interfaces:
Builder<Tracer>,TracerBuilder<JaegerTracerBuilder>,Supplier<Tracer>
public class JaegerTracerBuilder extends Object implements TracerBuilder<JaegerTracerBuilder>
The JaegerTracerBuilder is a convenience builder forTracerto use with Jaeger.Unless You want to explicitly depend on Jaeger in Your code, please use
TracerBuilder.create(String)orTracerBuilder.create(io.helidon.config.Config)that is abstracted.The Jaeger tracer uses environment variables and system properties to override the defaults. Except for
protocolandservicethese 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 serviceRequired service name protocolhttpThe protocol to use. By default http is used. To switch to agent mode, use udphost127.0.0.1forhttp, library default forudpHost to used - used by both UDP and HTTP endpoints port14268forhttp, library default forudpPort to be used - used by both UDP and HTTP endpoints path/api/tracesPath to be used when using httptokenAuthentication token to use usernameUser to use to authenticate (basic authentication) passwordPassword to use to authenticate (basic authentication) propagationlibrary default Propagation type to use, supports jaegerandb3log-spanslibrary default Whether reporter should log spans max-queue-sizelibrary default Maximal queue size of the reporter flush-interval-mslibrary default Reporter flush interval in milliseconds sampler-typelibrary default Sampler type ( probabilistic,ratelimiting, orremotesampler-paramlibrary default Numeric parameter specifying details for the sampler type (see Jaeger docs) sampler-manager library default host and port of the sampler manager tagssee TracerBuilderboolean-tagssee TracerBuilderint-tagssee TracerBuilder- See Also:
- Jaeger configuration
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedJaegerTracerBuilder()Default constructor, does not modify any state.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description JaegerTracerBuilderaddPropagation(io.jaegertracing.Configuration.Propagation propagation)Add propagation type to use.JaegerTracerBuilderaddTracerTag(String key, boolean value)Tracer level tags that get added to all reported spans.JaegerTracerBuilderaddTracerTag(String key, Number value)Tracer level tags that get added to all reported spans.JaegerTracerBuilderaddTracerTag(String key, String value)Tracer level tags that get added to all reported spans.JaegerTracerBuilderbasicAuth(String username, String password)Configure username and password for basic authentication.Tracerbuild()Builds theTracerfor Jaeger based on the configured parameters.TracerbuildAndRegister()Build and register as a global tracer.JaegerTracerBuildercollectorHost(String host)Host to use to connect to tracing collector.JaegerTracerBuildercollectorPath(String path)Override path to use.JaegerTracerBuildercollectorPort(int port)Port to use to connect to tracing collector.JaegerTracerBuildercollectorProtocol(String protocol)Protocol to use (such ashttporhttps) to connect to tracing collector.JaegerTracerBuilderconfig(Config config)Load configuration of tracer from configuration of the application.static JaegerTracerBuildercreate(Config config)Create a new builder based on values in configuration.JaegerTracerBuilderenabled(boolean enabled)When enabled, tracing will be sent.JaegerTracerBuilderflushInterval(long value, TimeUnit timeUnit)The reporter's flush interval.static JaegerTracerBuilderforService(String serviceName)Get a JaegerTracerbuilder for processing tracing data of a service with a given name.JaegerTracerBuilderlogSpans(boolean logSpans)Whether the reporter should also log the spans.JaegerTracerBuildermaxQueueSize(int maxQueueSize)The reporter's maximum queue size.JaegerTracerBuilderregisterGlobal(boolean global)When enabled, the created instance is also registered as a global tracer.JaegerTracerBuildersamplerManager(String samplerManagerHostPort)The host name and port when using the remote controlled sampler.JaegerTracerBuildersamplerMananger(String samplerManagerHostPort)Deprecated.typo, please usesamplerManager(String)JaegerTracerBuildersamplerParam(Number samplerParam)The sampler parameter (number).JaegerTracerBuildersamplerType(io.helidon.tracing.jaeger.JaegerTracerBuilder.SamplerType samplerType)Sampler type.JaegerTracerBuilderserviceName(String name)Service name of the traced service.JaegerTracerBuildertoken(String token)Authentication token sent as a "Bearer" to the endpoint.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface io.helidon.tracing.TracerBuilder
collectorUri
-
-
-
-
Method Detail
-
forService
public static JaegerTracerBuilder forService(String serviceName)
Get a JaegerTracerbuilder for processing tracing data of a service with a given name.- Parameters:
serviceName- name of the service that will be using the tracer.- Returns:
Tracerbuilder 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)
-
serviceName
public JaegerTracerBuilder serviceName(String name)
Description copied from interface:TracerBuilderService name of the traced service.- Specified by:
serviceNamein interfaceTracerBuilder<JaegerTracerBuilder>- Parameters:
name- name of the service using the tracer- Returns:
- updated builder instance
-
collectorProtocol
public JaegerTracerBuilder collectorProtocol(String protocol)
Description copied from interface:TracerBuilderProtocol to use (such ashttporhttps) to connect to tracing collector. Default is defined by each tracing integration.- Specified by:
collectorProtocolin interfaceTracerBuilder<JaegerTracerBuilder>- Parameters:
protocol- protocol to use- Returns:
- updated builder instance
-
collectorHost
public JaegerTracerBuilder collectorHost(String host)
Description copied from interface:TracerBuilderHost to use to connect to tracing collector. Default is defined by each tracing integration.- Specified by:
collectorHostin interfaceTracerBuilder<JaegerTracerBuilder>- Parameters:
host- host to use- Returns:
- updated builder instance
-
collectorPort
public JaegerTracerBuilder collectorPort(int port)
Description copied from interface:TracerBuilderPort to use to connect to tracing collector. Default is defined by each tracing integration.- Specified by:
collectorPortin interfaceTracerBuilder<JaegerTracerBuilder>- Parameters:
port- port to use- Returns:
- updated builder instance
-
collectorPath
public JaegerTracerBuilder collectorPath(String path)
Override path to use.- Specified by:
collectorPathin interfaceTracerBuilder<JaegerTracerBuilder>- Parameters:
path- path to override the default- Returns:
- updated builder instance
-
enabled
public JaegerTracerBuilder enabled(boolean enabled)
Description copied from interface:TracerBuilderWhen enabled, tracing will be sent. If enabled is false, tracing should use a no-op tracer.- Specified by:
enabledin interfaceTracerBuilder<JaegerTracerBuilder>- Parameters:
enabled- set tofalseto disable distributed tracing- Returns:
- updated builder instance
-
addTracerTag
public JaegerTracerBuilder addTracerTag(String key, String value)
Description copied from interface:TracerBuilderTracer level tags that get added to all reported spans.- Specified by:
addTracerTagin interfaceTracerBuilder<JaegerTracerBuilder>- Parameters:
key- name of the tagvalue- value of the tag- Returns:
- updated builder instance
-
addTracerTag
public JaegerTracerBuilder addTracerTag(String key, Number value)
Description copied from interface:TracerBuilderTracer level tags that get added to all reported spans.- Specified by:
addTracerTagin interfaceTracerBuilder<JaegerTracerBuilder>- Parameters:
key- name of the tagvalue- numeric value of the tag- Returns:
- updated builder instance
-
addTracerTag
public JaegerTracerBuilder addTracerTag(String key, boolean value)
Description copied from interface:TracerBuilderTracer level tags that get added to all reported spans.- Specified by:
addTracerTagin interfaceTracerBuilder<JaegerTracerBuilder>- Parameters:
key- name of the tagvalue- boolean value of the tag- Returns:
- updated builder instance
-
registerGlobal
public JaegerTracerBuilder registerGlobal(boolean global)
Description copied from interface:TracerBuilderWhen enabled, the created instance is also registered as a global tracer. When set totruemethodTracerBuilder.build()will have the same result asTracerBuilder.buildAndRegister().- Specified by:
registerGlobalin interfaceTracerBuilder<JaegerTracerBuilder>- Parameters:
global- whether to register this tracer as a global tracer once built- Returns:
- updated builder instance
-
basicAuth
public JaegerTracerBuilder basicAuth(String username, String password)
Configure username and password for basic authentication.- Parameters:
username- username to usepassword- 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:TracerBuilderLoad 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:
configin interfaceTracerBuilder<JaegerTracerBuilder>- Parameters:
config- configuration node of the tracer configuration- Returns:
- updated builder instance
-
samplerMananger
@Deprecated public JaegerTracerBuilder samplerMananger(String samplerManagerHostPort)
Deprecated.typo, please usesamplerManager(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 specifiedtimeUnit- 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
-
build
public Tracer build()
Builds theTracerfor Jaeger based on the configured parameters.- Specified by:
buildin interfaceBuilder<Tracer>- Specified by:
buildin interfaceTracerBuilder<JaegerTracerBuilder>- Returns:
- the tracer
-
buildAndRegister
public Tracer buildAndRegister()
Description copied from interface:TracerBuilderBuild and register as a global tracer.- Specified by:
buildAndRegisterin interfaceTracerBuilder<JaegerTracerBuilder>- Returns:
- The
Tracerbuilt and registered
-
-