Puppet Class: thanos::sidecar

Defined in:
manifests/sidecar.pp

Summary

This class manages sidecar service

Overview

This class install Sidecar as service sidecar for Prometheus server.

Examples:

include thanos::sidecar

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)

  • prometheus_url (Stdlib::HTTPUrl) (defaults to: 'http://localhost:9090')

    URL at which to reach Prometheus’s API. For better performance use local network.

  • prometheus_ready_timeout (String) (defaults to: '10m')

    Maximum time to wait for the Prometheus instance to start up

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

    Data directory of TSDB.

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

    Config file watched by the reloader.

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

    Output file for environment variable substituted config file.

  • reloader_rule_dirs (Array[Stdlib::Absolutepath]) (defaults to: [])

    Rule directories for the reloader to refresh.

  • reloader_watch_interval (String) (defaults to: '3m')

    Controls how often reloader re-reads config and rules.

  • reloader_retry_interval (String) (defaults to: '5s')

    Controls how often reloader retries config reload in case of error.

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

    Path to YAML file that contains object store configuration. See format details: thanos.io/storage.md/#configuration

  • shipper_upload_compacted (Boolean) (defaults to: false)

    If true sidecar will try to upload compacted blocks as well. Useful for migration purposes. Works only if compaction is disabled on Prometheus. Do it once and then disable the flag when done.

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

    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.
    
  • 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.



65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
# File 'manifests/sidecar.pp', line 65

class thanos::sidecar (
  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,
  Stdlib::HTTPUrl                $prometheus_url                        = 'http://localhost:9090',
  String                         $prometheus_ready_timeout              = '10m',
  Stdlib::Absolutepath           $tsdb_path                             = $thanos::tsdb_path,
  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 ? {
    'present' => 'running',
    default   => 'stopped'
  }

  thanos::resources::service { 'sidecar':
    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,
      'prometheus.url'                => $prometheus_url,
      'prometheus.ready_timeout'      => $prometheus_ready_timeout,
      'tsdb.path'                     => $tsdb_path,
      '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,
    },
    extra_params   => $extra_params,
  }
}