Skip to content

Commit

Permalink
#25 Support Thanos version 0.15.0
Browse files Browse the repository at this point in the history
  • Loading branch information
syberalexis committed Sep 20, 2020
1 parent 6b5bff7 commit 19a407a
Show file tree
Hide file tree
Showing 12 changed files with 462 additions and 130 deletions.
2 changes: 1 addition & 1 deletion data/common.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---

thanos::version: '0.10.1'
thanos::version: '0.15.0'

...
112 changes: 75 additions & 37 deletions manifests/compact.pp
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand All @@ -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,
}
Expand Down
66 changes: 0 additions & 66 deletions manifests/downsample.pp

This file was deleted.

45 changes: 27 additions & 18 deletions manifests/init.pp
Original file line number Diff line number Diff line change
Expand Up @@ -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).
Expand Down Expand Up @@ -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',
Expand Down Expand Up @@ -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| {
Expand Down Expand Up @@ -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']
Expand All @@ -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']
}
}
Loading

0 comments on commit 19a407a

Please sign in to comment.