Package codes.grow.packages.datadogapm
Class DatadogApmConfig.Builder
java.lang.Object
codes.grow.packages.datadogapm.DatadogApmConfig.Builder
- Enclosing class:
DatadogApmConfig
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 (query API only).Sets the Datadog API key (query API only).Sets the query API base URL (defaulthttps://api.<site>).Sets the Datadog application key withapm_read(query API only).Sets the Datadog application key withapm_read(query API only).build()Builds and validates the configuration.Sets the connect timeout (default 10 s).environment(String environment) Setsenvof unified service tagging.Fills every field that was not set explicitly from the environment (see the table onDatadogApmConfig).Adds a header sent with every request.Sets request hooks.Sets the logger (default silent).otlpEndpoint(String otlpEndpoint) Sets the OTLP endpoint of the Agent.protocol(TracingConfig.Protocol protocol) Sets the OTLP protocol (HTTP_PROTOBUFby default, orGRPC).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()).serviceName(String serviceName) Setsserviceof unified service tagging.serviceVersion(String serviceVersion) Setsversionof unified service tagging.Sets the Datadog site, e.g.Adds an extra resource attribute (merged overDD_TAGS).Adds extra resource attributes.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 the Agent trace intake URL (defaulthttp://127.0.0.1:8126).userAgentSuffix(String suffix) Sets the text appended to theUser-Agent.
-
Method Details
-
fromEnv
Fills every field that was not set explicitly from the environment (see the table onDatadogApmConfig).- Parameters:
env- environment reader- Returns:
- this builder
- Throws:
ConfigException- when a variable holds an invalid value
-
url
Sets the Agent trace intake URL (defaulthttp://127.0.0.1:8126).- Parameters:
url-httporhttpsURL- Returns:
- this builder
-
otlpEndpoint
Sets the OTLP endpoint of the Agent. HTTP: a base URL (http://agent:4318;/v1/tracesis appended when the URL has no path) or the full traces URL; gRPC:http://agent:4317. Unset: the host ofurl(String)with port 4318 or 4317.- Parameters:
otlpEndpoint- endpoint URL- Returns:
- this builder
-
protocol
Sets the OTLP protocol (HTTP_PROTOBUFby default, orGRPC).- Parameters:
protocol- protocol- Returns:
- this builder
-
serviceName
Setsserviceof unified service tagging.- Parameters:
serviceName- service name- Returns:
- this builder
-
serviceVersion
Setsversionof unified service tagging.- Parameters:
serviceVersion- version- Returns:
- this builder
-
environment
Setsenvof unified service tagging.- Parameters:
environment- environment- Returns:
- this builder
-
tag
Adds an extra resource attribute (merged overDD_TAGS).- Parameters:
key- keyvalue- value- Returns:
- this builder
-
tags
Adds extra resource attributes.- Parameters:
tags- tags- Returns:
- this builder
-
apiKey
Sets the Datadog API key (query API only).- Parameters:
apiKey- key- Returns:
- this builder
-
apiKey
Sets the Datadog API key (query API only).- Parameters:
apiKey- key- Returns:
- this builder
-
appKey
Sets the Datadog application key withapm_read(query API only).- Parameters:
appKey- key- Returns:
- this builder
-
appKey
Sets the Datadog application key withapm_read(query API only).- Parameters:
appKey- key- Returns:
- this builder
-
site
Sets the Datadog site, e.g.datadoghq.eu(defaultdatadoghq.com).- Parameters:
site- site host name- Returns:
- this builder
-
apiUrl
Sets the query API base URL (defaulthttps://api.<site>).- Parameters:
apiUrl- URL- 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
-