Package codes.grow.packages.datadoglogs
Class DatadogLogsConfig.Builder
java.lang.Object
codes.grow.packages.datadoglogs.DatadogLogsConfig.Builder
- Enclosing class:
DatadogLogsConfig
Builder of the configuration.
Unset fields take the environment (when fromEnv(EnvReader) is called) or the
default.
-
Method Summary
Modifier and TypeMethodDescriptionSets the Datadog API key (required by every call).Sets the Datadog API key (required by every call).Overrides the API base URL.Sets the Datadog application key (query API only; never sent to the intake).Sets the Datadog application key (query API only; never sent to the intake).build()Builds and validates the configuration.Sets the connect timeout (default 10 s).Sets the environment, sent as tagenv:<value>.Fills every field that was not set explicitly from the environment.Adds a header sent with every request.Sets request hooks.Sets the defaulthostname(used when a record has nohost.nameresource).Overrides the logs intake base URL.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 defaultservice(used when a record has noservice.nameresource).Sets the Datadog site, for exampledatadoghq.eu(defaultdatadoghq.com).Sets theddsourceof every log (defaultgrow-sdk).Replaces the tags from one string separated by commas or spaces.Replaces the tags added to every log.tls(TlsOptions tls) Sets the TLS options; environment TLS variables are then ignored.Sets the total timeout per call including retries (default 120 s).Sets one base URL for both the intake and the API (tests, proxies, fakeintake).userAgentSuffix(String suffix) Sets the text appended to theUser-Agent.Sets the version, sent as tagversion:<value>.
-
Method Details
-
fromEnv
Fills every field that was not set explicitly from the environment.- Parameters:
reader- environment reader- Returns:
- this builder
- Throws:
ConfigException- when a variable holds an invalid value
-
apiKey
Sets the Datadog API key (required by every call).- Parameters:
apiKey- key- Returns:
- this builder
-
apiKey
Sets the Datadog API key (required by every call).- Parameters:
apiKey- key- Returns:
- this builder
-
appKey
Sets the Datadog application key (query API only; never sent to the intake).- Parameters:
appKey- key- Returns:
- this builder
-
appKey
Sets the Datadog application key (query API only; never sent to the intake).- Parameters:
appKey- key- Returns:
- this builder
-
site
Sets the Datadog site, for exampledatadoghq.eu(defaultdatadoghq.com).- Parameters:
site- site, seeDatadogSites.SITES- Returns:
- this builder
-
url
Sets one base URL for both the intake and the API (tests, proxies, fakeintake).- Parameters:
url-httporhttpsURL- Returns:
- this builder
-
intakeUrl
Overrides the logs intake base URL.- Parameters:
intakeUrl-httporhttpsURL- Returns:
- this builder
-
apiUrl
Overrides the API base URL.- Parameters:
apiUrl-httporhttpsURL- Returns:
- this builder
-
service
Sets the defaultservice(used when a record has noservice.nameresource).- Parameters:
service- service name- Returns:
- this builder
-
env
Sets the environment, sent as tagenv:<value>.- Parameters:
env- environment- Returns:
- this builder
-
version
Sets the version, sent as tagversion:<value>.- Parameters:
version- version- Returns:
- this builder
-
tags
Replaces the tags added to every log.- Parameters:
tags-key:valuestrings- Returns:
- this builder
-
tags
Replaces the tags from one string separated by commas or spaces.- Parameters:
tags- tag list text- Returns:
- this builder
-
hostname
Sets the defaulthostname(used when a record has nohost.nameresource).- Parameters:
hostname- host name- Returns:
- this builder
-
source
Sets theddsourceof every log (defaultgrow-sdk).- Parameters:
source- source- 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
-