java.lang.Object
io.helidon.tracing.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
Modifier and TypeClassDescriptionstatic enum
Versions available for Zipkin API. -
Constructor Summary
ModifierConstructorDescriptionprotected
Default 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.Baggage keys to be propagated.build()
Builds theTracer
for 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 ashttp
orhttps
) 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 ZipkinTracerBuilder
Create a new builder based on values in configuration.boolean
enabled()
Return whether this tracer is an enabled tracer with a real backend.enabled
(boolean enabled) When enabled, tracing will be sent.static ZipkinTracerBuilder
forService
(String serviceName) Get a ZipkinTracer
builder 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> B
Access 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 ZipkinTracer
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 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:OpenTracingTracerBuilder
Service name of the traced service.- Specified by:
serviceName
in interfaceOpenTracingTracerBuilder<ZipkinTracerBuilder>
- Parameters:
name
- name of the service using the tracer- Returns:
- updated builder instance
-
collectorUri
Description copied from interface:OpenTracingTracerBuilder
Set 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:
collectorUri
in interfaceOpenTracingTracerBuilder<ZipkinTracerBuilder>
- Parameters:
uri
- the endpoint of the tracing collector- Returns:
- updated builder instance
-
collectorProtocol
Description copied from interface:OpenTracingTracerBuilder
Protocol to use (such ashttp
orhttps
) to connect to tracing collector. Default is defined by each tracing integration.- Specified by:
collectorProtocol
in interfaceOpenTracingTracerBuilder<ZipkinTracerBuilder>
- Parameters:
protocol
- protocol to use- Returns:
- updated builder instance
-
collectorHost
Description copied from interface:OpenTracingTracerBuilder
Host to use to connect to tracing collector. Default is defined by each tracing integration.- Specified by:
collectorHost
in interfaceOpenTracingTracerBuilder<ZipkinTracerBuilder>
- Parameters:
host
- host to use- Returns:
- updated builder instance
-
collectorPort
Description copied from interface:OpenTracingTracerBuilder
Port to use to connect to tracing collector. Default is defined by each tracing integration.- Specified by:
collectorPort
in 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:
collectorPath
in interfaceOpenTracingTracerBuilder<ZipkinTracerBuilder>
- Parameters:
path
- path to override the default defined byZipkinTracerBuilder.Version
- Returns:
- updated builder instance
-
enabled
Description copied from interface:OpenTracingTracerBuilder
When enabled, tracing will be sent. If enabled is false, tracing should use a no-op tracer.- Specified by:
enabled
in interfaceOpenTracingTracerBuilder<ZipkinTracerBuilder>
- Parameters:
enabled
- set tofalse
to disable distributed tracing- Returns:
- updated builder instance
-
addTracerTag
Description copied from interface:OpenTracingTracerBuilder
Tracer level tags that get added to all reported spans.- Specified by:
addTracerTag
in interfaceOpenTracingTracerBuilder<ZipkinTracerBuilder>
- Parameters:
key
- name of the tagvalue
- value of the tag- Returns:
- updated builder instance
-
addTracerTag
Description copied from interface:OpenTracingTracerBuilder
Tracer level tags that get added to all reported spans.- Specified by:
addTracerTag
in interfaceOpenTracingTracerBuilder<ZipkinTracerBuilder>
- Parameters:
key
- name of the tagvalue
- numeric value of the tag- Returns:
- updated builder instance
-
addTracerTag
Description copied from interface:OpenTracingTracerBuilder
Tracer level tags that get added to all reported spans.- Specified by:
addTracerTag
in interfaceOpenTracingTracerBuilder<ZipkinTracerBuilder>
- Parameters:
key
- name of the tagvalue
- boolean value of the tag- Returns:
- updated builder instance
-
registerGlobal
Description copied from interface:OpenTracingTracerBuilder
When enabled, the created instance is also registered as a global tracer.- Specified by:
registerGlobal
in 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:OpenTracingTracerBuilder
Return whether this tracer is an enabled tracer with a real backend.- Specified by:
enabled
in interfaceOpenTracingTracerBuilder<ZipkinTracerBuilder>
- Returns:
true
if enabled
-
unwrap
Description copied from interface:OpenTracingTracerBuilder
Access 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:
unwrap
in interfaceOpenTracingTracerBuilder<ZipkinTracerBuilder>
- Type Parameters:
B
- type of the builder- Parameters:
builderClass
- type to access- Returns:
- instance of the builder
-
config
Description copied from interface:OpenTracingTracerBuilder
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 interfaceOpenTracingTracerBuilder<ZipkinTracerBuilder>
- Parameters:
config
- configuration node of the tracer configuration- Returns:
- updated builder instance
-
build
Builds theTracer
for Zipkin based on the configured parameters.- Specified by:
build
in interfaceBuilder<ZipkinTracerBuilder,
Tracer> - Specified by:
build
in 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
-
baggage
Baggage keys to be propagated.- Parameters:
baggageKeys
- that will be propagated.- 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
-