diff --git a/data/common.yaml b/data/common.yaml index 84802d0..109403f 100644 --- a/data/common.yaml +++ b/data/common.yaml @@ -1,5 +1,5 @@ --- -thanos::version: '0.10.1' +thanos::version: '0.15.0' ... diff --git a/manifests/compact.pp b/manifests/compact.pp index 07dcac3..a1d8912 100644 --- a/manifests/compact.pp +++ b/manifests/compact.pp @@ -35,43 +35,75 @@ # How long to retain samples of resolution 2 (1 hour) in bucket. 0d - disables this retention # @param wait # Do not exit after all compactions have been processed and wait for new work. +# @param wait_interval +# Wait interval between consecutive compaction runs and bucket refreshes. +# Only works when --wait flag specified. # @param downsampling_disable # Disables downsampling. This is not recommended as querying long time ranges without non-downsampled data is # not efficient and useful e.g it is not possible to render all samples for a human eye anyway # @param block_sync_concurrency # Number of goroutines to use when syncing block metadata from object storage. +# @param block_viewer_global_sync_block_interval +# Repeat interval for syncing the blocks between local and remote view for /global Block Viewer UI. # @param compact_concurrency # Number of goroutines to use when compacting groups. +# @param delete_delay +# Time before a block marked for deletion is deleted from bucket. +# If delete-delay is non zero, blocks will be marked for deletion and compactor component will +# delete blocks marked for deletion from the bucket. If delete-delay is 0, blocks will be deleted straight away. +# Note that deleting blocks immediately can cause query failures, if store gateway still has the block loaded, +# or compactor is ignoring the deletion because it's compacting the block at the same time. # @param selector_relabel_config_file # Path to YAML file that contains relabeling configuration that allows selecting blocks. # It follows native Prometheus relabel-config syntax. # See format details: https://prometheus.io/docs/prometheus/latest/configuration/configuration/#relabel_config +# @param web_external_prefix +# Static prefix for all HTML links and redirect URLs in the bucket web UI interface. +# Actual endpoints are still served on / or the web.route-prefix. +# This allows thanos bucket web UI to be served behind a reverse proxy that strips a URL sub-path. +# @param web_prefix_header +# 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. +# @param bucket_web_label +# Prometheus label to use as timeline title in the bucket web UI # @param extra_params # Parameters passed to the binary, ressently released in latest version of Thanos. # @example # include thanos::compact class thanos::compact ( - Enum['present', 'absent'] $ensure = 'present', - String $user = $thanos::user, - String $group = $thanos::group, - Stdlib::Absolutepath $bin_path = $thanos::bin_path, - 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', - Optional[Stdlib::Absolutepath] $data_dir = undef, - Optional[Stdlib::Absolutepath] $objstore_config_file = $thanos::storage_config_file, - String $consistency_delay = '30m', - String $retention_resolution_raw = '0d', - String $retention_resolution_5m = '0d', - String $retention_resolution_1h = '0d', - Boolean $wait = false, - Boolean $downsampling_disable = false, - Integer $block_sync_concurrency = 20, - Integer $compact_concurrency = 1, - Optional[Stdlib::Absolutepath] $selector_relabel_config_file = undef, - Hash $extra_params = {}, + Enum['present', 'absent'] $ensure = 'present', + String $user = $thanos::user, + String $group = $thanos::group, + Stdlib::Absolutepath $bin_path = $thanos::bin_path, + # 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', + Optional[Stdlib::Absolutepath] $data_dir = undef, + Optional[Stdlib::Absolutepath] $objstore_config_file = $thanos::storage_config_file, + String $consistency_delay = '30m', + String $retention_resolution_raw = '0d', + String $retention_resolution_5m = '0d', + String $retention_resolution_1h = '0d', + Boolean $wait = false, + String $wait_interval = '5m', + Boolean $downsampling_disable = false, + Integer $block_sync_concurrency = 20, + String $block_viewer_global_sync_block_interval = '1m', + Integer $compact_concurrency = 1, + String $delete_delay = '48h', + Optional[Stdlib::Absolutepath] $selector_relabel_config_file = undef, + Optional[String] $web_external_prefix = undef, + Optional[String] $web_prefix_header = undef, + Optional[String] $bucket_web_label = undef, + # Extra parametes + Hash $extra_params = {}, ) { $_service_ensure = $ensure ? { 'present' => 'running', @@ -84,22 +116,28 @@ user => $user, group => $group, 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, - 'data-dir' => $data_dir, - 'objstore.config-file' => $objstore_config_file, - 'consistency-delay' => $consistency_delay, - 'retention.resolution-raw' => $retention_resolution_raw, - 'retention.resolution-5m' => $retention_resolution_5m, - 'retention.resolution-1h' => $retention_resolution_1h, - 'wait' => $wait, - 'downsampling.disable' => $downsampling_disable, - 'block-sync-concurrency' => $block_sync_concurrency, - 'compact.concurrency' => $compact_concurrency, - 'selector.relabel-config-file' => $selector_relabel_config_file, + 'log.level' => $log_level, + 'log.format' => $log_format, + 'tracing.config-file' => $tracing_config_file, + 'http-address' => $http_address, + 'http-grace-period' => $http_grace_period, + 'data-dir' => $data_dir, + 'objstore.config-file' => $objstore_config_file, + 'consistency-delay' => $consistency_delay, + 'retention.resolution-raw' => $retention_resolution_raw, + 'retention.resolution-5m' => $retention_resolution_5m, + 'retention.resolution-1h' => $retention_resolution_1h, + 'wait' => $wait, + 'wait-interval' => $wait_interval, + 'downsampling.disable' => $downsampling_disable, + 'block-sync-concurrency' => $block_sync_concurrency, + 'block-viewer.global.sync-block-interval' => $block_viewer_global_sync_block_interval, + 'compact.concurrency' => $compact_concurrency, + 'delete-delay' => $delete_delay, + 'selector.relabel-config-file' => $selector_relabel_config_file, + 'web.external-prefix' => $web_external_prefix, + 'web.prefix-header' => $web_prefix_header, + 'bucket-web-label' => $bucket_web_label, }, extra_params => $extra_params, } diff --git a/manifests/downsample.pp b/manifests/downsample.pp deleted file mode 100644 index 457f526..0000000 --- a/manifests/downsample.pp +++ /dev/null @@ -1,66 +0,0 @@ -# @summary This class manages downsample service -# -# This class install Downsample as service continuously downsamples blocks in an object store bucket. -# -# @param ensure -# State ensured from compact service. -# @param user -# User running thanos. -# @param group -# Group under which thanos is running. -# @param bin_path -# Path where binary is located. -# @param log_level -# Only log messages with the given severity or above. One of: [debug, info, warn, error, fatal] -# @param log_format -# Output format of log messages. One of: [logfmt, json] -# @param tracing_config_file -# Path to YAML file with tracing configuration. See format details: https://thanos.io/tracing.md/#configuration -# @param http_address -# Listen host:port for HTTP endpoints. -# @param http_grace_period -# Time to wait after an interrupt received for HTTP Server. -# @param data_dir -# Data directory in which to cache blocks and process downsamplings. -# @param objstore_config_file -# Path to YAML file that contains object store configuration. See format details: https://thanos.io/storage.md/#configuration -# @param extra_params -# Parameters passed to the binary, ressently released in latest version of Thanos. -# @example -# include thanos::downsample -class thanos::downsample ( - Enum['present', 'absent'] $ensure = 'present', - String $user = $thanos::user, - String $group = $thanos::group, - Stdlib::Absolutepath $bin_path = $thanos::bin_path, - 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', - Optional[Stdlib::Absolutepath] $data_dir = undef, - Optional[Stdlib::Absolutepath] $objstore_config_file = $thanos::storage_config_file, - Hash $extra_params = {}, -) { - $_service_ensure = $ensure ? { - 'present' => 'running', - default => 'stopped' - } - - thanos::resources::service { 'downsample': - ensure => $_service_ensure, - user => $user, - group => $group, - bin_path => $bin_path, - 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, - 'data-dir' => $data_dir, - 'objstore.config-file' => $objstore_config_file, - }, - extra_params => $extra_params, - } -} diff --git a/manifests/init.pp b/manifests/init.pp index b86bfc4..fc8956a 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -10,15 +10,17 @@ # Whether to create a service to run Sidecar. # @param manage_query # Whether to create a service to run Query. +# @param manage_query_frontend +# Whether to create a service to run Query Frontend. # @param manage_rule # Whether to create a service to run Rule. # @param manage_store # Whether to create a service to run Store. # @param manage_compact # Whether to create a service to run Compact. -# @param manage_downsample -# Whether to create a service to run Downsample. -# @param manage_bucket_web +# @param manage_receiver +# Whether to create a service to run Receiver. +# @param manage_tools_bucket_web # Whether to create a service to run Bucket Web interface. # @param install_method # Installation method: url or package (only url is supported currently). @@ -87,11 +89,12 @@ String $os = downcase($facts['kernel']), Boolean $manage_sidecar = false, Boolean $manage_query = false, + Boolean $manage_query_frontend = false, Boolean $manage_rule = false, Boolean $manage_store = false, Boolean $manage_compact = false, - Boolean $manage_downsample = false, - Boolean $manage_bucket_web = false, + Boolean $manage_receiver = false, + Boolean $manage_tools_bucket_web = false, # Installation Enum['url', 'package', 'none'] $install_method = 'url', @@ -129,13 +132,14 @@ $bin_path = "${bin_dir}/thanos" $notify_services = { - 'sidecar' => $manage_sidecar, - 'query' => $manage_query, - 'rule' => $manage_rule, - 'store' => $manage_store, - 'compact' => $manage_compact, - 'downsample' => $manage_downsample, - 'bucket-web' => $manage_bucket_web, + 'sidecar' => $manage_sidecar, + 'query' => $manage_query, + 'query-frontend' => $manage_query_frontend, + 'rule' => $manage_rule, + 'store' => $manage_store, + 'compact' => $manage_compact, + 'receiver' => $manage_receiver, + 'bucket-web' => $manage_tools_bucket_web, }.filter |String $key, Boolean $value| { $value }.map |String $key, Boolean $value| { @@ -171,6 +175,11 @@ Class['thanos::config'] -> Class['thanos::query'] } + if $manage_query_frontend { + include thanos::query_frontend + Class['thanos::config'] -> Class['thanos::query_frontend'] + } + if $manage_rule { include thanos::rule Class['thanos::config'] -> Class['thanos::rule'] @@ -186,13 +195,13 @@ Class['thanos::config'] -> Class['thanos::compact'] } - if $manage_downsample { - include thanos::downsample - Class['thanos::config'] -> Class['thanos::downsample'] + if $manage_receiver { + include thanos::receiver + Class['thanos::config'] -> Class['thanos::receiver'] } - if $manage_bucket_web { - include thanos::bucket_web - Class['thanos::config'] -> Class['thanos::bucket_web'] + if $manage_tools_bucket_web { + include thanos::tools::bucket_web + Class['thanos::config'] -> Class['thanos::tools::bucket_web'] } } diff --git a/manifests/query.pp b/manifests/query.pp index 16f7607..ae4a628 100644 --- a/manifests/query.pp +++ b/manifests/query.pp @@ -54,10 +54,24 @@ # 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. +# @param log_request_decision +# 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. # @param query_timeout # Maximum time to process query by query node. # @param query_max_concurrent # Maximum number of queries processed concurrently by query node. +# @param query_loopback_delta +# 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. +# @param query_max_concurrent_select +# Maximum number of select requests made concurrently per a query. # @param query_replica_label # 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. @@ -66,6 +80,8 @@ # @param 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. +# @param store_strict +# 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. # @param store_sd_files # Path to files that contain addresses of store API servers. The path can be a glob pattern. # @param store_sd_interval @@ -93,6 +109,7 @@ String $user = $thanos::user, String $group = $thanos::group, Stdlib::Absolutepath $bin_path = $thanos::bin_path, + # Binary Parameters Thanos::Log_level $log_level = 'info', Enum['logfmt', 'json'] $log_format = 'logfmt', Optional[Stdlib::Absolutepath] $tracing_config_file = $thanos::tracing_config_file, @@ -111,11 +128,15 @@ 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] $stores = [], + Optional[String] $store_strict = undef, Array[Stdlib::Absolutepath] $store_sd_files = [], String $store_sd_interval = '5m', String $store_sd_dns_interval = '30s', @@ -124,6 +145,7 @@ Boolean $query_partial_response = false, String $query_default_evaluation_interval = '1m', String $store_response_timeout = '0ms', + # Extra parametes Hash $extra_params = {}, ) { $_service_ensure = $ensure ? { @@ -155,11 +177,15 @@ '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, 'store' => $stores, + 'store-strict' => $store_strict, 'store.sd-files' => $store_sd_files, 'store.sd-interval' => $store_sd_interval, 'store.sd-dns-interval' => $store_sd_dns_interval, diff --git a/manifests/query_frontend.pp b/manifests/query_frontend.pp new file mode 100644 index 0000000..79c124b --- /dev/null +++ b/manifests/query_frontend.pp @@ -0,0 +1,107 @@ +# @summary This class manages query frontend service +# +# This class install Query Frontend as service that can be put in front of Thanos Queriers to improve the read path. +# +# @param ensure +# State ensured from compact service. +# @param user +# User running thanos. +# @param group +# Group under which thanos is running. +# @param bin_path +# Path where binary is located. +# @param log_level +# Only log messages with the given severity or above. One of: [debug, info, warn, error, fatal] +# @param log_format +# Output format of log messages. One of: [logfmt, json] +# @param tracing_config_file +# Path to YAML file with tracing configuration. See format details: https://thanos.io/tracing.md/#configuration +# @param query_range_split_interval +# Split queries by an interval and execute in parallel, 0 disables it. +# @param query_range_max_retries_per_request +# Maximum number of retries for a single request; beyond this, the downstream error is returned. +# @param query_range_max_query_length +# Limit the query time range (end - start time) in the query-frontend, 0 disables it. +# @param query_range_max_query_parrallelism +# Maximum number of queries will be scheduled in parallel by the frontend. +# @param query_range_response_cache_max_freshness +# Most recent allowed cacheable result, to prevent caching very recent results that might still be in flux. +# @param query_range_partial_response +# Enable partial response for queries if no partial_response param is specified. --no-query-range.partial-response for disabling. +# @param query_range_response_cache_config_file +# Path to YAML file that contains response cache configuration. +# @param http_address +# Listen host:port for HTTP endpoints. +# @param http_grace_period +# Time to wait after an interrupt received for HTTP Server. +# @param query_frontend_downstream_url +# URL of downstream Prometheus Query compatible API. +# @param query_frontend_compress_responses +# Compress HTTP responses. +# @param query_frontend_log_queries_longer_than +# Log queries that are slower than the specified duration. Set to 0 to disable. Set to < 0 to enable on all queries. +# @param log_request_decision +# 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. +# @param extra_params +# Parameters passed to the binary, ressently released in latest version of Thanos. +# @example +# include thanos::query +class thanos::query_frontend ( + Enum['present', 'absent'] $ensure = 'present', + String $user = $thanos::user, + String $group = $thanos::group, + Stdlib::Absolutepath $bin_path = $thanos::bin_path, + # 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 $query_range_split_interval = '24h', + Integer $query_range_max_retries_per_request = 5, + Integer $query_range_max_query_length = 0, + Integer $query_range_max_query_parrallelism = 14, + String $query_range_response_cache_max_freshness = '1m', + Boolean $query_range_partial_response = false, + Optional[Stdlib::Absolutepath] $query_range_response_cache_config_file = undef, + String $http_address = '0.0.0.0:10902', + String $http_grace_period = '2m', + Stdlib::HTTPUrl $query_frontend_downstream_url = 'http://localhost:9090', + Boolean $query_frontend_compress_responses = false, + Integer $query_frontend_log_queries_longer_than = 0, + Optional[String] $log_request_decision = undef, + # Extra parametes + Hash $extra_params = {}, +) { + $_service_ensure = $ensure ? { + 'present' => 'running', + default => 'stopped' + } + + thanos::resources::service { 'query-frontend': + ensure => $_service_ensure, + bin_path => $bin_path, + user => $user, + group => $group, + params => { + 'log.level' => $log_level, + 'log.format' => $log_format, + 'tracing.config-file' => $tracing_config_file, + 'uery-range.split-interval' => $query_range_split_interval, + 'query-range.max-retries-per-request' => $query_range_max_retries_per_request, + 'query-range.max-query-length' => $query_range_max_query_length, + 'query-range.max-query-parallelism' => $query_range_max_query_parrallelism, + 'query-range.response-cache-max-freshness' => $query_range_response_cache_max_freshness, + 'query-range.partial-response' => $query_range_partial_response, + 'query-range.response-cache-config-file' => $query_range_response_cache_config_file, + 'http-address' => $http_address, + 'http-grace-period' => $http_grace_period, + 'query-frontend.downstream-url' => $query_frontend_downstream_url, + 'query-frontend.compress-responses' => $query_frontend_downstream_url, + 'query-frontend.log_queries_longer_than' => $query_frontend_log_queries_longer_than, + 'log.request.decision' => $log_request_decision, + }, + extra_params => $extra_params, + } +} diff --git a/manifests/receiver.pp b/manifests/receiver.pp new file mode 100644 index 0000000..7aeb835 --- /dev/null +++ b/manifests/receiver.pp @@ -0,0 +1,165 @@ +# @summary This class manages receiver service +# +# This class install Receiver as service that implements the Prometheus Remote Write API. +# +# @param ensure +# State ensured from compact service. +# @param user +# User running thanos. +# @param group +# Group under which thanos is running. +# @param bin_path +# Path where binary is located. +# @param log_level +# Only log messages with the given severity or above. One of: [debug, info, warn, error, fatal] +# @param log_format +# Output format of log messages. One of: [logfmt, json] +# @param tracing_config_file +# Path to YAML file with tracing configuration. See format details: https://thanos.io/tracing.md/#configuration +# @param http_address +# Listen host:port for HTTP endpoints. +# @param http_grace_period +# Time to wait after an interrupt received for HTTP Server. +# @param grpc_address +# Listen ip:port address for gRPC endpoints (StoreAPI). Make sure this address is routable from other components. +# @param grpc_grace_period +# Time to wait after an interrupt received for GRPC Server. +# @param grpc_server_tls_cert +# TLS Certificate for gRPC server, leave blank to disable TLS +# @param grpc_server_tls_key +# TLS Key for the gRPC server, leave blank to disable TLS +# @param grpc_server_tls_client_ca +# TLS CA to verify clients against. If no client CA is specified, there is no client verification on server side. (tls.NoClientCert) +# @param remote_write_address +# Address to listen on for remote write requests. +# @param remote_write_server_tls_cert +# TLS Certificate for HTTP server, leave blank to disable TLS. +# @param remote_write_server_tls_key +# TLS Key for the HTTP server, leave blank to disable TLS. +# @param remote_write_server_tls_client_ca +# TLS CA to verify clients against. If no client CA is specified, there is no client verification on server side. (tls.NoClientCert) +# @param remote_write_client_tls_cert +# TLS Certificates to use to identify this client to the server. +# @param remote_write_client_tls_key +# TLS Key for the client's certificate. +# @param remote_write_client_tls_ca +# TLS CA Certificates to use to verify servers. +# @param remote_write_client_server_name +# Server name to verify the hostname on the returned gRPC certificates. See https://tools.ietf.org/html/rfc4366#section-3.1 +# @param data_dir +# Data directory in which to cache blocks and process downsamplings. +# @param objstore_config_file +# Path to YAML file that contains object store configuration. See format details: https://thanos.io/storage.md/#configuration +# @param tsdb_retention +# How long to retain raw samples on local storage. 0d - disables this retention. +# @param receive_hashrings_file +# Path to file that contains the hashring configuration. +# @param receive_hashrings_file_refresh_interval +# Refresh interval to re-read the hashring configuration file. (used as a fallback) +# @param receive_local_endpoint +# Endpoint of local receive node. Used to identify the local node in the hashring configuration. +# @param receive_tenant_header +# HTTP header to determine tenant for write requests. +# @param receive_default_tenant_id +# HDefault tenant ID to use when none is provided via a header. +# @param receive_tenant_label_name +# Label name through which the tenant will be announced. +# @param receive_replica_header +# HTTP header specifying the replica number of a write request. +# @param receive_replication_factor +# How many times to replicate incoming write requests. +# @param tsdb_wal_compression +# Compress the tsdb WAL. +# @param tsdb_no_lockfile +# Do not create lockfile in TSDB data directory. +# In any case, the lockfiles will be deleted on next startup. +# @param extra_params +# Parameters passed to the binary, ressently released in latest version of Thanos. +# @example +# include thanos::downsample +class thanos::receiver ( + Enum['present', 'absent'] $ensure = 'present', + String $user = $thanos::user, + String $group = $thanos::group, + Stdlib::Absolutepath $bin_path = $thanos::bin_path, + # 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, + String $remote_write_address = '0.0.0.0:19291', + Optional[Stdlib::Absolutepath] $remote_write_server_tls_cert = undef, + Optional[Stdlib::Absolutepath] $remote_write_server_tls_key = undef, + Optional[Stdlib::Absolutepath] $remote_write_server_tls_client_ca = undef, + Optional[Stdlib::Absolutepath] $remote_write_client_tls_cert = undef, + Optional[Stdlib::Absolutepath] $remote_write_client_tls_key = undef, + Optional[Stdlib::Absolutepath] $remote_write_client_tls_ca = undef, + Optional[String] $remote_write_client_server_name = undef, + Optional[Stdlib::Absolutepath] $data_dir = undef, + Optional[Stdlib::Absolutepath] $objstore_config_file = $thanos::storage_config_file, + String $tsdb_retention = '15d', + Optional[Stdlib::Absolutepath] $receive_hashrings_file = undef, + String $receive_hashrings_file_refresh_interval = '5m', + Optional[String] $receive_local_endpoint = undef, + String $receive_tenant_header = 'THANOS-TENANT', + String $receive_default_tenant_id = 'default-tenant', + String $receive_tenant_label_name = 'tenant_id', + String $receive_replica_header = 'THANOS-REPLICA', + Integer $receive_replication_factor = 1, + Boolean $tsdb_wal_compression = false, + Boolean $tsdb_no_lockfile = false, + # Extra parametes + Hash $extra_params = {}, +) { + $_service_ensure = $ensure ? { + 'present' => 'running', + default => 'stopped' + } + + thanos::resources::service { 'receive': + ensure => $_service_ensure, + user => $user, + group => $group, + bin_path => $bin_path, + 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, + 'remote-write.address' => $remote_write_address, + 'remote-write.server-tls-cert' => $remote_write_server_tls_cert, + 'remote-write.server-tls-key' => $remote_write_server_tls_key, + 'remote-write.server-tls-client-ca' => $remote_write_server_tls_client_ca, + 'remote-write.client-tls-cert' => $remote_write_client_tls_cert, + 'remote-write.client-tls-key' => $remote_write_client_tls_key, + 'remote-write.client-tls-ca' => $remote_write_client_tls_ca, + 'remote-write.client-server-name' => $remote_write_client_server_name, + 'data-dir' => $data_dir, + 'objstore.config-file' => $objstore_config_file, + 'tsdb.retention' => $tsdb_retention, + 'receive.hashrings-file' => $receive_hashrings_file, + 'receive.hashrings-file-refresh-interval' => $receive_hashrings_file_refresh_interval, + 'receive.local-endpoint' => $receive_local_endpoint, + 'receive.tenant-header' => $receive_tenant_header, + 'receive.default-tenant-id' => $receive_default_tenant_id, + 'receive.tenant-label-name' => $receive_tenant_label_name, + 'receive.replica-header' => $receive_replica_header, + 'receive.replication-factor' => $receive_replication_factor, + 'tsdb.wal-compression' => $tsdb_wal_compression, + 'tsdb.no-lockfile' => $tsdb_no_lockfile, + }, + extra_params => $extra_params, + } +} diff --git a/manifests/rule.pp b/manifests/rule.pp index 2ba4eff..f12733d 100644 --- a/manifests/rule.pp +++ b/manifests/rule.pp @@ -47,6 +47,8 @@ # Block duration for TSDB block. # @param tsdb_retention # Block retention time on local disk. +# @param tsdb_no_lockfile +# Do not create lockfile in TSDB data directory. In any case, the lockfiles will be deleted on next startup. # @param tsdb_wal_compression # Compress the tsdb WAL. # @param alertmanagers_url @@ -82,6 +84,11 @@ # 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, hich sends the stripped # prefix value in X-Forwarded-Prefix header. This allows thanos UI to be served on a sub-path. +# @param log_request_decision +# 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. # @param objstore_config_file # Path to YAML file that contains object store configuration. See format details: # https://thanos.io/storage.md/#configuration @@ -107,6 +114,7 @@ String $user = $thanos::user, String $group = $thanos::group, Stdlib::Absolutepath $bin_path = $thanos::bin_path, + # Binary Parameters Thanos::Log_level $log_level = 'info', Enum['logfmt', 'json'] $log_format = 'logfmt', Optional[Stdlib::Absolutepath] $tracing_config_file = $thanos::tracing_config_file, @@ -124,6 +132,7 @@ String $eval_interval = '30s', String $tsdb_block_duration = '2h', String $tsdb_retention = '48h', + Boolean $tsdb_no_lockfile = false, Boolean $tsdb_wal_compression = false, Array[Stdlib::HTTPUrl] $alertmanagers_url = [], String $alertmanagers_send_timeout = '10s', @@ -134,12 +143,14 @@ Optional[String] $web_route_prefix = undef, Optional[String] $web_external_prefix = undef, Optional[String] $web_prefix_header = undef, + Optional[String] $log_request_decision = undef, Optional[Stdlib::Absolutepath] $objstore_config_file = undef, Array[String] $queries = [], Optional[Stdlib::Absolutepath] $query_config_file = undef, Array[Stdlib::Absolutepath] $query_sd_files = [], String $query_sd_interval = '5m', String $query_sd_dns_interval = '30s', + # Extra parametes Hash $extra_params = {}, ) { $_service_ensure = $ensure ? { @@ -171,6 +182,7 @@ 'tsdb.block-duration' => $tsdb_block_duration, 'tsdb.retention' => $tsdb_retention, 'tsdb.wal-compression' => $tsdb_wal_compression, + 'tsdb.no-lockfile' => $tsdb_no_lockfile, 'alertmanagers.url' => $alertmanagers_url, 'alertmanagers.send-timeout' => $alertmanagers_send_timeout, 'alertmanagers.config-file' => $alertmanagers_config_file, @@ -180,6 +192,7 @@ 'web.route-prefix' => $web_route_prefix, 'web.external-prefix' => $web_external_prefix, 'web.prefix-header' => $web_prefix_header, + 'log.request.decision' => $log_request_decision, 'objstore.config-file' => $objstore_config_file, 'query' => $queries, 'query.config-file' => $query_config_file, diff --git a/manifests/sidecar.pp b/manifests/sidecar.pp index a893875..5bbcbee 100644 --- a/manifests/sidecar.pp +++ b/manifests/sidecar.pp @@ -46,6 +46,10 @@ # Output file for environment variable substituted config file. # @param reloader_rule_dirs # Rule directories for the reloader to refresh. +# @param reloader_watch_interval +# Controls how often reloader re-reads config and rules. +# @param reloader_retry_interval +# Controls how often reloader retries config reload in case of error. # @param objstore_config_file # Path to YAML file that contains object store configuration. See format details: https://thanos.io/storage.md/#configuration # @param shipper_upload_compacted @@ -53,8 +57,8 @@ # Works only if compaction is disabled on Prometheus. Do it once and then disable the flag when done. # @param min_time # Start of time range limit to serve. Thanos sidecar will serve only metrics, which happened later than this value. -# Option can be a constant time in RFC3339 format or time duration relative to current time, such as -1d or 2h45m. Valid -# duration units are ms, s, m, h, d, w, y. +# Option can be a constant time in RFC3339 format or time duration relative to current time, such as -1d or 2h45m. +# Valid duration units are ms, s, m, h, d, w, y. # @param extra_params # Parameters passed to the binary, ressently released in latest version of Thanos. # @example @@ -64,6 +68,7 @@ String $user = $thanos::user, String $group = $thanos::group, Stdlib::Absolutepath $bin_path = $thanos::bin_path, + # Binary Parameters Thanos::Log_level $log_level = 'info', Enum['logfmt', 'json'] $log_format = 'logfmt', Optional[Stdlib::Absolutepath] $tracing_config_file = $thanos::tracing_config_file, @@ -82,9 +87,12 @@ Optional[Stdlib::Absolutepath] $reloader_config_file = undef, Optional[Stdlib::Absolutepath] $reloader_config_envsubst_file = undef, Array[Stdlib::Absolutepath] $reloader_rule_dirs = [], + String $reloader_watch_interval = '3m', + String $reloader_retry_interval = '5s', Optional[Stdlib::Absolutepath] $objstore_config_file = $thanos::storage_config_file, Boolean $shipper_upload_compacted = false, Optional[String] $min_time = undef, + # Extra parametes Hash $extra_params = {}, ) { $_service_ensure = $ensure ? { @@ -116,6 +124,8 @@ 'reloader.config-file' => $reloader_config_file, 'reloader.config-envsubst-file' => $reloader_config_envsubst_file, 'reloader.rule-dir' => $reloader_rule_dirs, + 'reloader.watch-interval' => $reloader_watch_interval, + 'reloader.retry-interval' => $reloader_retry_interval, 'objstore.config-file' => $objstore_config_file, 'shipper.upload-compacted' => $shipper_upload_compacted, 'min-time' => $min_time, diff --git a/manifests/store.pp b/manifests/store.pp index e84086e..e41e2ba 100644 --- a/manifests/store.pp +++ b/manifests/store.pp @@ -67,6 +67,26 @@ # See format details: https://prometheus.io/docs/prometheus/latest/configuration/configuration/#relabel_config # @param consistency_delay # Minimum age of all blocks before they are being read. +# @param ignore_deletion_marks_delay +# Duration after which the blocks marked for deletion will be filtered out while fetching blocks. +# The idea of ignore-deletion-marks-delay is to ignore blocks that are marked for deletion with some delay. +# This ensures store can still serve blocks that are meant to be deleted but do not have a replacement yet. +# If delete-delay duration is provided to compactor or bucket verify component, +# it will upload deletion-mark.json file to mark after what duration the block should be deleted rather than +# deleting the block straight away. If delete-delay is non-zero for compactor or bucket verify component, +# ignore-deletion-marks-delay should be set to (delete-delay)/2 so that blocks marked for deletion are filtered out +# while fetching blocks before being deleted from bucket. Default is 24h, half of the default value for --delete-delay on compactor. +# @param web_external_prefix +# 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. +# @param web_prefix_header +# 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. # @param extra_params # Parameters passed to the binary, ressently released in latest version of Thanos. # @example @@ -76,6 +96,7 @@ String $user = $thanos::user, String $group = $thanos::group, Stdlib::Absolutepath $bin_path = $thanos::bin_path, + # Binary Parameters Thanos::Log_level $log_level = 'info', Enum['logfmt', 'json'] $log_format = 'logfmt', Optional[Stdlib::Absolutepath] $tracing_config_file = $thanos::tracing_config_file, @@ -99,6 +120,10 @@ Optional[String] $max_time = undef, Optional[Stdlib::Absolutepath] $selector_relabel_config_file = undef, String $consistency_delay = '30m', + String $ignore_deletion_marks_delay = '24h', + Optional[String] $web_external_prefix = undef, + Optional[String] $web_prefix_header = undef, + # Extra parametes Hash $extra_params = {}, ) { $_service_ensure = $ensure ? { @@ -135,6 +160,9 @@ 'max-time' => $max_time, 'selector.relabel-config-file' => $selector_relabel_config_file, 'consistency-delay' => $consistency_delay, + 'ignore-deletion-marks-delay' => $ignore_deletion_marks_delay, + 'web.external-prefix' => $web_external_prefix, + 'web.prefix-header' => $web_prefix_header, }, extra_params => $extra_params, } diff --git a/manifests/bucket_web.pp b/manifests/tools/bucket_web.pp similarity index 97% rename from manifests/bucket_web.pp rename to manifests/tools/bucket_web.pp index 4becfa9..4260bc4 100644 --- a/manifests/bucket_web.pp +++ b/manifests/tools/bucket_web.pp @@ -43,11 +43,12 @@ # Parameters passed to the binary, ressently released in latest version of Thanos. # @example # include thanos::bucket_web -class thanos::bucket_web ( +class thanos::tools::bucket_web ( Enum['present', 'absent'] $ensure = 'present', String $user = $thanos::user, String $group = $thanos::group, Stdlib::Absolutepath $bin_path = $thanos::bin_path, + # Binary Parameters Thanos::Log_level $log_level = 'info', Enum['logfmt', 'json'] $log_format = 'logfmt', Optional[Stdlib::Absolutepath] $tracing_config_file = $thanos::tracing_config_file, @@ -59,6 +60,7 @@ String $refresh = '30m', String $timeout = '5m', String $label = '', + # Extra parametes Hash $extra_params = {}, ) { $_service_ensure = $ensure ? { @@ -68,7 +70,7 @@ thanos::resources::service { 'bucket-web': ensure => $_service_ensure, - name => 'bucket web', + name => 'tools bucket web', bin_path => $bin_path, user => $user, group => $group, diff --git a/metadata.json b/metadata.json index dd16d4c..40de991 100644 --- a/metadata.json +++ b/metadata.json @@ -1,6 +1,6 @@ { "name": "maeq-thanos", - "version": "1.0.2", + "version": "1.1.0", "author": "maeq", "summary": "This module install Thanos and can manage it's components", "license": "Apache-2.0", @@ -21,7 +21,7 @@ { "operatingsystem": "CentOS", "operatingsystemrelease": [ - "7" + "7", "8" ] }, { @@ -33,13 +33,13 @@ { "operatingsystem": "Debian", "operatingsystemrelease": [ - "9" + "9", "10" ] }, { "operatingsystem": "Ubuntu", "operatingsystemrelease": [ - "18.04" + "18.04", "20.04" ] }, {