Class ZipkinTracerBuilder
java.lang.Object
io.helidon.tracing.providers.zipkin.ZipkinTracerBuilder
- All Implemented Interfaces:
Builder<ZipkinTracerBuilder,,Tracer> OpenTracingTracerBuilder<ZipkinTracerBuilder>,Supplier<Tracer>
public class ZipkinTracerBuilder
extends Object
implements OpenTracingTracerBuilder<ZipkinTracerBuilder>
The ZipkinTracerBuilder is a convenience builder for
Tracer to use with Zipkin.
Unless You want to explicitly depend on Zipkin in Your code, please
use TracerBuilder.create(String) or TracerBuilder.create(Config) that is abstracted.
The following table lists zipkin specific defaults and configuration options.
| option | default | description |
|---|---|---|
api-version |
2 | Version of the Zipkin API to use, currently supports 1 and 2 |
service |
Required service name | |
protocol |
http |
see TracerBuilder |
host |
127.0.0.1 |
see TracerBuilder |
port |
9411 | see TracerBuilder |
path |
/api/v2/spans |
Default for ZipkinTracerBuilder.Version.V2, which is the default version |
tags |
see TracerBuilder |
|
boolean-tags |
see TracerBuilder |
|
int-tags |
see TracerBuilder |
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enumVersions available for Zipkin API. -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedDefault constructor, does not modify state. -
Method Summary
Modifier and TypeMethodDescriptionaddTracerTag(String key, boolean value) Tracer level tags that get added to all reported spans.addTracerTag(String key, Number value) Tracer level tags that get added to all reported spans.addTracerTag(String key, String value) Tracer level tags that get added to all reported spans.build()Builds theTracerfor Zipkin based on the configured parameters.collectorHost(String host) Host to use to connect to tracing collector.collectorPath(String path) Override path to use.collectorPort(int port) Port to use to connect to tracing collector.collectorProtocol(String protocol) Protocol to use (such ashttporhttps) to connect to tracing collector.collectorUri(URI uri) Set the collector URI used for sending tracing data.Load configuration of tracer from configuration of the application.static ZipkinTracerBuilderCreate a new builder based on values in configuration.booleanenabled()Return whether this tracer is an enabled tracer with a real backend.enabled(boolean enabled) When enabled, tracing will be sent.static ZipkinTracerBuilderforService(String serviceName) Get a ZipkinTracerbuilder for processing tracing data of a service with a given name.registerGlobal(boolean global) When enabled, the created instance is also registered as a global tracer.The sender to use for sending events to Zipkin.serviceName(String name) Service name of the traced service.<B> BAccess the underlying builder by specific type.version(ZipkinTracerBuilder.Version version) Version of Zipkin API to use.
-
Constructor Details
-
ZipkinTracerBuilder
protected ZipkinTracerBuilder()Default constructor, does not modify state.
-
-
Method Details
-
forService
Get a ZipkinTracerbuilder 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 Zipkin.
-
create
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:
-
serviceName
Description copied from interface:OpenTracingTracerBuilderService name of the traced service.- Specified by:
serviceNamein interfaceOpenTracingTracerBuilder<ZipkinTracerBuilder>- Parameters:
name- name of the service using the tracer- Returns:
- updated builder instance
-
collectorUri
Description copied from interface:OpenTracingTracerBuilderSet the collector URI used for sending tracing data.Default implementation configures
OpenTracingTracerBuilder.collectorProtocol(String),OpenTracingTracerBuilder.collectorHost(String),OpenTracingTracerBuilder.collectorPath(String)andOpenTracingTracerBuilder.collectorPort(int)if configured in the uri.- Specified by:
collectorUriin interfaceOpenTracingTracerBuilder<ZipkinTracerBuilder>- Parameters:
uri- the endpoint of the tracing collector- Returns:
- updated builder instance
-
collectorProtocol
Description copied from interface:OpenTracingTracerBuilderProtocol to use (such ashttporhttps) to connect to tracing collector. Default is defined by each tracing integration.- Specified by:
collectorProtocolin interfaceOpenTracingTracerBuilder<ZipkinTracerBuilder>- Parameters:
protocol- protocol to use- Returns:
- updated builder instance
-
collectorHost
Description copied from interface:OpenTracingTracerBuilderHost to use to connect to tracing collector. Default is defined by each tracing integration.- Specified by:
collectorHostin interfaceOpenTracingTracerBuilder<ZipkinTracerBuilder>- Parameters:
host- host to use- Returns:
- updated builder instance
-
collectorPort
Description copied from interface:OpenTracingTracerBuilderPort to use to connect to tracing collector. Default is defined by each tracing integration.- Specified by:
collectorPortin interfaceOpenTracingTracerBuilder<ZipkinTracerBuilder>- Parameters:
port- port to use- Returns:
- updated builder instance
-
collectorPath
Override path to use. Path is usually defined by the protocolZipkinTracerBuilder.Version. Use this to override if not using default (e.g. when Zipkin is behind a reverse proxy that prefixes the path).- Specified by:
collectorPathin interfaceOpenTracingTracerBuilder<ZipkinTracerBuilder>- Parameters:
path- path to override the default defined byZipkinTracerBuilder.Version- Returns:
- updated builder instance
-
enabled
Description copied from interface:OpenTracingTracerBuilderWhen enabled, tracing will be sent. If enabled is false, tracing should use a no-op tracer.- Specified by:
enabledin interfaceOpenTracingTracerBuilder<ZipkinTracerBuilder>- Parameters:
enabled- set tofalseto disable distributed tracing- Returns:
- updated builder instance
-
addTracerTag
Description copied from interface:OpenTracingTracerBuilderTracer level tags that get added to all reported spans.- Specified by:
addTracerTagin interfaceOpenTracingTracerBuilder<ZipkinTracerBuilder>- Parameters:
key- name of the tagvalue- value of the tag- Returns:
- updated builder instance
-
addTracerTag
Description copied from interface:OpenTracingTracerBuilderTracer level tags that get added to all reported spans.- Specified by:
addTracerTagin interfaceOpenTracingTracerBuilder<ZipkinTracerBuilder>- Parameters:
key- name of the tagvalue- numeric value of the tag- Returns:
- updated builder instance
-
addTracerTag
Description copied from interface:OpenTracingTracerBuilderTracer level tags that get added to all reported spans.- Specified by:
addTracerTagin interfaceOpenTracingTracerBuilder<ZipkinTracerBuilder>- Parameters:
key- name of the tagvalue- boolean value of the tag- Returns:
- updated builder instance
-
registerGlobal
Description copied from interface:OpenTracingTracerBuilderWhen enabled, the created instance is also registered as a global tracer.- Specified by:
registerGlobalin interfaceOpenTracingTracerBuilder<ZipkinTracerBuilder>- Parameters:
global- whether to register this tracer as a global tracer once built- Returns:
- updated builder instance
-
enabled
public boolean enabled()Description copied from interface:OpenTracingTracerBuilderReturn whether this tracer is an enabled tracer with a real backend.- Specified by:
enabledin interfaceOpenTracingTracerBuilder<ZipkinTracerBuilder>- Returns:
trueif enabled
-
unwrap
Description copied from interface:OpenTracingTracerBuilderAccess the underlying builder by specific type. This is a dangerous operation that will succeed only if the builder contains the expected type. This practically removes abstraction capabilities of this builder.- Specified by:
unwrapin interfaceOpenTracingTracerBuilder<ZipkinTracerBuilder>- Type Parameters:
B- type of the builder- Parameters:
builderClass- type to access- Returns:
- instance of the builder
-
config
Description copied from interface:OpenTracingTracerBuilderLoad 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 interfaceOpenTracingTracerBuilder<ZipkinTracerBuilder>- Parameters:
config- configuration node of the tracer configuration- Returns:
- updated builder instance
-
build
Builds theTracerfor Zipkin based on the configured parameters.- Specified by:
buildin interfaceBuilder<ZipkinTracerBuilder,Tracer> - Specified by:
buildin interfaceOpenTracingTracerBuilder<ZipkinTracerBuilder>- Returns:
- the tracer
-
version
Version of Zipkin API to use. Defaults toZipkinTracerBuilder.Version.V2.- Parameters:
version- version to use- Returns:
- updated builder instance
-
sender
The sender to use for sending events to Zipkin. When configured, allcollectorProtocol(String),collectorHost(String),collectorPort(int), andversion(Version)methods are ignored.- Parameters:
sender- the sender to use- Returns:
- this builder
-