Class TempoClient.Builder

java.lang.Object
codes.grow.packages.tempo.TempoClient.Builder
Enclosing class:
TempoClient

public static final class TempoClient.Builder extends Object
Builder that configures and creates a client in one chain.
  • Method Details

    • fromEnv

      public TempoClient.Builder fromEnv(EnvReader env)
      Fills unset fields from an environment reader.
      Parameters:
      env - reader, e.g. EnvReader.system()
      Returns:
      this builder
    • url

      public TempoClient.Builder url(String url)
      Sets the endpoint base URL.
      Parameters:
      url - URL
      Returns:
      this builder
    • tenantId

      public TempoClient.Builder tenantId(String tenantId)
      Sets the tenant sent as X-Scope-OrgID.
      Parameters:
      tenantId - tenant id
      Returns:
      this builder
    • token

      public TempoClient.Builder token(String token)
      Sets a bearer token for an authenticating reverse proxy.
      Parameters:
      token - token
      Returns:
      this builder
    • token

      public TempoClient.Builder token(Secret token)
      Sets a bearer token for an authenticating reverse proxy.
      Parameters:
      token - token
      Returns:
      this builder
    • connectTimeout

      public TempoClient.Builder connectTimeout(Duration d)
      Sets the connect timeout.
      Parameters:
      d - duration
      Returns:
      this builder
    • requestTimeout

      public TempoClient.Builder requestTimeout(Duration d)
      Sets the per-attempt timeout.
      Parameters:
      d - duration
      Returns:
      this builder
    • totalTimeout

      public TempoClient.Builder totalTimeout(Duration d)
      Sets the total timeout.
      Parameters:
      d - duration
      Returns:
      this builder
    • retry

      public TempoClient.Builder retry(RetryPolicy retry)
      Sets the retry policy.
      Parameters:
      retry - policy
      Returns:
      this builder
    • tls

      public TempoClient.Builder tls(TlsOptions tls)
      Sets the TLS options.
      Parameters:
      tls - options
      Returns:
      this builder
    • proxy

      public TempoClient.Builder proxy(String proxy)
      Sets the proxy URL.
      Parameters:
      proxy - URL
      Returns:
      this builder
    • header

      public TempoClient.Builder header(String name, String value)
      Adds a header.
      Parameters:
      name - name
      value - value
      Returns:
      this builder
    • userAgentSuffix

      public TempoClient.Builder userAgentSuffix(String suffix)
      Sets the user agent suffix.
      Parameters:
      suffix - suffix
      Returns:
      this builder
    • hooks

      public TempoClient.Builder hooks(Hooks hooks)
      Sets hooks.
      Parameters:
      hooks - hooks
      Returns:
      this builder
    • logger

      public TempoClient.Builder logger(Logger logger)
      Sets the logger.
      Parameters:
      logger - logger
      Returns:
      this builder
    • build

      public TempoClient build()
      Builds the configuration and the client.
      Returns:
      a new client
      Throws:
      ConfigException - when the configuration is invalid