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')


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
# 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',
) {
    # 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          => [
            # 336 hours is 14 days * 24 hours (T166624)
            { period => 'hourly',  format => "%Y-%m-%d_%H${label}", retain => 336 },
            { period => 'daily',   format => "%Y-%m-%d${label}",    retain => 90 },
        ],
    }

    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']
    }
}