Package codes.grow.packages.tempo
Class TempoConfig.Builder
java.lang.Object
codes.grow.packages.tempo.TempoConfig.Builder
- Enclosing class:
TempoConfig
Builder of the configuration.
Unset fields take the environment (when fromEnv(EnvReader) is called) or the
default.
-
Method Summary
Modifier and TypeMethodDescriptionbuild()Builds and validates the configuration.Sets the connect timeout (default 10 s).Fills every field that was not set explicitly from the environment.Adds a header sent with every request.Sets request hooks.Sets the logger (default silent).Sets an explicit proxy URL; environment proxies (HTTPS_PROXY) are never used.Sets the per-attempt timeout (default 30 s).retry(RetryPolicy retry) Sets the retry policy (defaultRetryPolicy.defaults()).Sets the tenant sent asX-Scope-OrgIDon every query call.tls(TlsOptions tls) Sets the TLS options; environment TLS variables are then ignored.Sets a bearer token sent asAuthorization: Bearer <token>; only useful behind an authenticating reverse proxy (Tempo itself has no authentication).Sets a bearer token for an authenticating reverse proxy.Sets the total timeout per call including retries (default 120 s).Sets the endpoint base URL.userAgentSuffix(String suffix) Sets the text appended to theUser-Agent.
-
Method Details
-
fromEnv
Fills every field that was not set explicitly from the environment.- Parameters:
env- environment reader- Returns:
- this builder
- Throws:
ConfigException- when a variable holds an invalid value
-
url
Sets the endpoint base URL.- Parameters:
url-httporhttpsURL- Returns:
- this builder
-
tenantId
Sets the tenant sent asX-Scope-OrgIDon every query call. Required by a multi-tenant Tempo, ignored by a single-tenant one;"a|b"runs a federated query.- Parameters:
tenantId- tenant id ornull- Returns:
- this builder
-
token
Sets a bearer token sent asAuthorization: Bearer <token>; only useful behind an authenticating reverse proxy (Tempo itself has no authentication).- Parameters:
token- token ornull- Returns:
- this builder
-
token
Sets a bearer token for an authenticating reverse proxy.- Parameters:
token- token ornull- Returns:
- this builder
-
connectTimeout
Sets the connect timeout (default 10 s).- Parameters:
d- positive duration- Returns:
- this builder
-
requestTimeout
Sets the per-attempt timeout (default 30 s).- Parameters:
d- positive duration- Returns:
- this builder
-
totalTimeout
Sets the total timeout per call including retries (default 120 s).- Parameters:
d- positive duration- Returns:
- this builder
-
retry
Sets the retry policy (defaultRetryPolicy.defaults()).- Parameters:
retry- policy- Returns:
- this builder
-
tls
Sets the TLS options; environment TLS variables are then ignored.- Parameters:
tls- options- Returns:
- this builder
-
proxy
Sets an explicit proxy URL; environment proxies (HTTPS_PROXY) are never used.- Parameters:
proxy- proxy URL- Returns:
- this builder
-
header
Adds a header sent with every request.- Parameters:
name- header namevalue- header value- Returns:
- this builder
-
userAgentSuffix
Sets the text appended to theUser-Agent.- Parameters:
suffix- suffix- Returns:
- this builder
-
hooks
Sets request hooks.- Parameters:
hooks- hooks- Returns:
- this builder
-
logger
Sets the logger (default silent).- Parameters:
logger- logger- Returns:
- this builder
-
build
Builds and validates the configuration.- Returns:
- the configuration
- Throws:
ConfigException- when a rule is violated
-