Puppet Class: thanos::query

Defined in:
manifests/query.pp

Summary

This class manages query service

Overview

This class install Query as service query node exposing PromQL enabled Query API with data retrieved from multiple store nodes.

Examples:

include thanos::query

Parameters:

  • ensure (Enum['present', 'absent']) (defaults to: 'present')

    State ensured from compact service.

  • user (String) (defaults to: $thanos::user)

    User running thanos.

  • group (String) (defaults to: $thanos::group)

    Group under which thanos is running.

  • bin_path (Stdlib::Absolutepath) (defaults to: $thanos::bin_path)

    Path where binary is located.

  • log_level (Thanos::Log_level) (defaults to: 'info')

    Only log messages with the given severity or above. One of: [debug, info, warn, error, fatal]

  • log_format (Enum['logfmt', 'json']) (defaults to: 'logfmt')

    Output format of log messages. One of: [logfmt, json]

  • tracing_config_file (Optional[Stdlib::Absolutepath]) (defaults to: $thanos::tracing_config_file)

    Path to YAML file with tracing configuration. See format details: thanos.io/tracing.md/#configuration

  • http_address (String) (defaults to: '0.0.0.0:10902')

    Listen host:port for HTTP endpoints.

  • http_grace_period (String) (defaults to: '2m')

    Time to wait after an interrupt received for HTTP Server.

  • grpc_address (String) (defaults to: '0.0.0.0:10901')

    Listen ip:port address for gRPC endpoints (StoreAPI). Make sure this address is routable from other components.

  • grpc_grace_period (String) (defaults to: '2m')

    Time to wait after an interrupt received for GRPC Server.

  • grpc_server_tls_cert (Optional[Stdlib::Absolutepath]) (defaults to: undef)

    TLS Certificate for gRPC server, leave blank to disable TLS

  • grpc_server_tls_key (Optional[Stdlib::Absolutepath]) (defaults to: undef)

    TLS Key for the gRPC server, leave blank to disable TLS

  • grpc_server_tls_client_ca (Optional[Stdlib::Absolutepath]) (defaults to: undef)

    TLS CA to verify clients against. If no client CA is specified, there is no client verification on server side. (tls.NoClientCert)

  • grpc_client_tls_secure (Boolean) (defaults to: false)

    Use TLS when talking to the gRPC server

  • grpc_client_tls_cert (Optional[Stdlib::Absolutepath]) (defaults to: undef)

    TLS Certificates to use to identify this client to the server

  • grpc_client_tls_key (Optional[Stdlib::Absolutepath]) (defaults to: undef)

    TLS Key for the client’s certificate

  • grpc_client_tls_ca (Optional[Stdlib::Absolutepath]) (defaults to: undef)

    TLS CA Certificates to use to verify gRPC servers

  • grpc_client_server_name (Optional[String]) (defaults to: undef)

    Server name to verify the hostname on the returned gRPC certificates. See tools.ietf.org/html/rfc4366#section-3.1

  • web_route_prefix (Optional[String]) (defaults to: undef)

    Prefix for API and UI endpoints. This allows thanos UI to be served on a sub-path.

    This option is analogous to --web.route-prefix of Promethus.
    
  • web_external_prefix (Optional[String]) (defaults to: undef)

    Static prefix for all HTML links and redirect URLs in the UI query web interface.

    Actual endpoints are still served on / or the web.route-prefix.
    This allows thanos UI to be served behind a reverse proxy that strips a URL sub-path.
    
  • web_prefix_header (Optional[String]) (defaults to: undef)

    Name of HTTP request header used for dynamic prefixing of UI links and redirects.

    This option is ignored if web.external-prefix argument is set.
    Security risk: enable this option only if a reverse proxy in front of thanos is resetting the header.
    The --web.prefix-header=X-Forwarded-Prefix option can be useful, for example,
    if Thanos UI is served via Traefik reverse proxy with PathPrefixStrip option enabled, which sends the stripped
    prefix value in X-Forwarded-Prefix header. This allows thanos UI to be served on a sub-path.
    
  • log_request_decision (Optional[String]) (defaults to: undef)

    Request Logging for logging the start and end of requests. LogFinishCall is enabled by default.

    LogFinishCall : Logs the finish call of the requests.
    LogStartAndFinishCall : Logs the start and finish call of the requests.
    NoLogCall : Disable request logging.
    
  • query_timeout (String) (defaults to: '2m')

    Maximum time to process query by query node.

  • query_max_concurrent (Integer) (defaults to: 20)

    Maximum number of queries processed concurrently by query node.

  • query_loopback_delta (Optional[String]) (defaults to: undef)

    The maximum lookback duration for retrieving metrics during expression evaluations.

    PromQL always evaluates the query for the certain timestamp (query range timestamps are deduced by step).
    Since scrape intervals might be different, PromQL looks back for given amount of time to get latest sample.
    If it exceeds the maximum lookback delta it assumes series is stale and returns none (a gap).
    This is why lookback delta should be set to at least 2 times of the slowest scrape interval.
    If unset it will use the promql default of 5m.
    
  • query_max_concurrent_select (Integer) (defaults to: 4)

    Maximum number of select requests made concurrently per a query.

  • query_replica_label (Optional[String]) (defaults to: undef)

    Labels to treat as a replica indicator along which data is deduplicated.

    Still you will be able to query without deduplication using 'dedup=false' parameter.
    
  • selector_labels (Array[String]) (defaults to: [])

    Query selector labels that will be exposed in info endpoint.

  • endpoints (Array[String]) (defaults to: [])

    (Replace stores) Addresses of statically configured store API servers. The scheme may be prefixed with ‘dns+’ or ‘dnssrv+’

    to detect store API servers through respective DNS lookups.
    
  • store_strict (Optional[String]) (defaults to: undef)

    Addresses of only statically configured store API servers that are always used, even if the health check fails.

    Useful if you have a caching layer on top.
    
  • store_sd_files (Array[Stdlib::Absolutepath]) (defaults to: [])

    Path to files that contain addresses of store API servers. The path can be a glob pattern.

  • store_sd_interval (String) (defaults to: '5m')

    Refresh interval to re-read file SD files. It is used as a resync fallback.

  • store_sd_dns_interval (String) (defaults to: '30s')

    Interval between DNS resolutions.

  • store_unhealthy_timeout (String) (defaults to: '30s')

    Timeout before an unhealthy store is cleaned from the store UI page.

  • query_auto_downsampling (Boolean) (defaults to: false)

    Enable automatic adjustment (step / 5) to what source of data should be used in store gateways

    if no max_source_resolution param is specified.
    
  • query_partial_response (Boolean) (defaults to: false)

    Enable partial response for queries if no partial_response param is specified. –no-query.partial-response for disabling.

  • query_default_evaluation_interval (String) (defaults to: '1m')

    Set default evaluation interval for sub queries.

  • store_response_timeout (String) (defaults to: '0ms')

    If a Store doesn’t send any data in this specified duration then a Store will be ignored and partial data will be

    returned if it's enabled. 0 disables timeout.
    
  • max_open_files (Optional[Integer]) (defaults to: undef)

    Define how many open files the service is able to use In some cases, the default value (1024) needs to be increased

  • extra_params (Hash) (defaults to: {})

    Parameters passed to the binary, ressently released in latest version of Thanos.



111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
# File 'manifests/query.pp', line 111

class thanos::query (
  Enum['present', 'absent']      $ensure                            = 'present',
  String                         $user                              = $thanos::user,
  String                         $group                             = $thanos::group,
  Stdlib::Absolutepath           $bin_path                          = $thanos::bin_path,
  Optional[Integer]              $max_open_files                    = undef,
  # Binary Parameters
  Thanos::Log_level              $log_level                         = 'info',
  Enum['logfmt', 'json']         $log_format                        = 'logfmt',
  Optional[Stdlib::Absolutepath] $tracing_config_file               = $thanos::tracing_config_file,
  String                         $http_address                      = '0.0.0.0:10902',
  String                         $http_grace_period                 = '2m',
  String                         $grpc_address                      = '0.0.0.0:10901',
  String                         $grpc_grace_period                 = '2m',
  Optional[Stdlib::Absolutepath] $grpc_server_tls_cert              = undef,
  Optional[Stdlib::Absolutepath] $grpc_server_tls_key               = undef,
  Optional[Stdlib::Absolutepath] $grpc_server_tls_client_ca         = undef,
  Boolean                        $grpc_client_tls_secure            = false,
  Optional[Stdlib::Absolutepath] $grpc_client_tls_cert              = undef,
  Optional[Stdlib::Absolutepath] $grpc_client_tls_key               = undef,
  Optional[Stdlib::Absolutepath] $grpc_client_tls_ca                = undef,
  Optional[String]               $grpc_client_server_name           = undef,
  Optional[String]               $web_route_prefix                  = undef,
  Optional[String]               $web_external_prefix               = undef,
  Optional[String]               $web_prefix_header                 = undef,
  Optional[String]               $log_request_decision              = undef,
  String                         $query_timeout                     = '2m',
  Integer                        $query_max_concurrent              = 20,
  Optional[String]               $query_loopback_delta              = undef,
  Integer                        $query_max_concurrent_select       = 4,
  Optional[String]               $query_replica_label               = undef,
  Array[String]                  $selector_labels                   = [],
  Array[String]                  $endpoints                         = [],
  Optional[String]               $store_strict                      = undef,
  Array[Stdlib::Absolutepath]    $store_sd_files                    = [],
  String                         $store_sd_interval                 = '5m',
  String                         $store_sd_dns_interval             = '30s',
  String                         $store_unhealthy_timeout           = '30s',
  Boolean                        $query_auto_downsampling           = false,
  Boolean                        $query_partial_response            = false,
  String                         $query_default_evaluation_interval = '1m',
  String                         $store_response_timeout            = '0ms',
  # Extra parametes
  Hash                           $extra_params                      = {},
) {
  $_service_ensure = $ensure ? {
    'present' => 'running',
    default   => 'stopped'
  }

  thanos::resources::service { 'query':
    ensure         => $_service_ensure,
    bin_path       => $bin_path,
    user           => $user,
    group          => $group,
    max_open_files => $max_open_files,
    params         => {
      'log.level'                         => $log_level,
      'log.format'                        => $log_format,
      'tracing.config-file'               => $tracing_config_file,
      'http-address'                      => $http_address,
      'http-grace-period'                 => $http_grace_period,
      'grpc-address'                      => $grpc_address,
      'grpc-grace-period'                 => $grpc_grace_period,
      'grpc-server-tls-cert'              => $grpc_server_tls_cert,
      'grpc-server-tls-key'               => $grpc_server_tls_key,
      'grpc-server-tls-client-ca'         => $grpc_server_tls_client_ca,
      'grpc-client-tls-secure'            => $grpc_client_tls_secure,
      'grpc-client-tls-cert'              => $grpc_client_tls_cert,
      'grpc-client-tls-key'               => $grpc_client_tls_key,
      'grpc-client-tls-ca'                => $grpc_client_tls_ca,
      'grpc-client-server-name'           => $grpc_client_server_name,
      'web.route-prefix'                  => $web_route_prefix,
      'web.external-prefix'               => $web_external_prefix,
      'web.prefix-header'                 => $web_prefix_header,
      'log.request.decision'              => $log_request_decision,
      'query.timeout'                     => $query_timeout,
      'query.max-concurrent'              => $query_max_concurrent,
      'query.loopback-delta'              => $query_loopback_delta,
      'query.max-concurrent-select'       => $query_max_concurrent_select,
      'query.replica-label'               => $query_replica_label,
      'selector-label'                    => $selector_labels,
      'endpoint'                          => $endpoints,
      'store-strict'                      => $store_strict,
      'store.sd-files'                    => $store_sd_files,
      'store.sd-interval'                 => $store_sd_interval,
      'store.sd-dns-interval'             => $store_sd_dns_interval,
      'store.unhealthy-timeout'           => $store_unhealthy_timeout,
      'query.auto-downsampling'           => $query_auto_downsampling,
      'query.partial-response'            => $query_partial_response,
      'query.default-evaluation-interval' => $query_default_evaluation_interval,
      'store.response-timeout'            => $store_response_timeout,
    },
    extra_params   => $extra_params,
  }
}