Defined Type: arclamp::profiler

Defined in:
modules/arclamp/manifests/profiler.pp

Overview

Parameters:

  • description (String)
  • redis_host (Stdlib::Host)
  • redis_port (Stdlib::Port::Unprivileged)
  • label (String) (defaults to: ".${title}")
  • ensure (Wmflib::Ensure) (defaults to: 'present')
  • retain_hourly_logs_hours (Integer) (defaults to: 336)
  • retain_daily_logs_days (Integer) (defaults to: 90)


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
# File 'modules/arclamp/manifests/profiler.pp', line 1

define arclamp::profiler(
    String $description,
    Stdlib::Host $redis_host,
    Stdlib::Port::Unprivileged $redis_port,
    String $label = ".${title}",
    Wmflib::Ensure $ensure = 'present',
    Integer $retain_hourly_logs_hours = 336, # 14 days
    Integer $retain_daily_logs_days = 90,
) {
    # Verify the title will not create us any issues
    assert_type(Pattern[/[a-z]+/], $title)

    $config = {
        base_path => '/srv/xenon/logs',
        redis     => {
            host => $redis_host,
            port => $redis_port,
        },
        redis_channel => $title,
        logs          => [
          { period => 'hourly',
            format => "%Y-%m-%d_%H${label}",
            retain => $retain_hourly_logs_hours,
          }, {
            period => 'daily',
            format => "%Y-%m-%d${label}",
            retain => $retain_daily_logs_days,
          },
        ],
    }

    file { "/etc/arclamp-log-${title}.yaml":
        ensure  => $ensure,
        content => ordered_yaml($config),
        owner   => 'root',
        group   => 'root',
        mode    => '0444',
        notify  => Service["${title}-log"],
    }

    systemd::service { "${title}-log":
        ensure    => $ensure,
        content   => systemd_template('arclamp-log'),
        subscribe => Package['performance/arc-lamp'],
        require   => File['/srv/xenon']
    }
}