Puppet Class: arclamp

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

Overview

Class: arclamp

Aggregate captured stack traces from MediaWiki application servers, write them to disk, and generate SVG flame graphs.

The aggregator reads captured traces from a Redis instance using pub/sub.

MediaWiki servers capture these traces from PHP.

For HHVM we use Xenon, the built-in sampling profiler for HHVM. <github.com/facebook/hhvm/wiki/Profiling#xenon>.

For PHP 7 we use Excimer. <www.mediawiki.org/wiki/Excimer>

Parameters

ensure

Description

redis_host

Address of Redis server that is publishing stack traces. Default: '127.0.0.1'.

redis_port

Port of Redis server that is publishing stack traces. Default: 6379.

Examples

class { 'arclamp':
    ensure     => present,
    redis_host => 'mwlog.example.net',
    redis_port => 6379,
}

Parameters:

  • ensure (Any) (defaults to: present)
  • redis_host (Any) (defaults to: '127.0.0.1')
  • redis_port (Any) (defaults to: 6379)


36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
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
# File 'modules/arclamp/manifests/init.pp', line 36

class arclamp(
    $ensure = present,
    $redis_host = '127.0.0.1',
    $redis_port = 6379,
) {
    require_package('python-redis')
    require_package('python-yaml')

    # Global setup
    group { 'xenon':
        ensure => $ensure,
    }

    user { 'xenon':
        ensure     => $ensure,
        gid        => 'xenon',
        shell      => '/bin/false',
        home       => '/nonexistent',
        system     => true,
        managehome => false,
    }

    file { '/srv/xenon':
        ensure => ensure_directory($ensure),
        links  => 'follow',
        owner  => 'xenon',
        group  => 'xenon',
        mode   => '0755',
    }

    file { '/usr/local/bin/arclamp-log':
        ensure => $ensure,
        source => 'puppet:///modules/arclamp/arclamp-log.py',
        owner  => 'root',
        group  => 'root',
        mode   => '0555',
    }
    # This is the Perl script that generates flame graphs.
    # It comes from <https://github.com/brendangregg/FlameGraph>.

    file { '/usr/local/bin/flamegraph.pl':
        ensure => $ensure,
        source => 'puppet:///modules/arclamp/flamegraph.pl',
        owner  => 'root',
        group  => 'root',
        mode   => '0555',
    }
    # Walks /srv/xenon/logs looking for log files which do not have a
    # corresponding SVG file and calls flamegraph.pl on each of them.

    file { '/usr/local/bin/arclamp-generate-svgs':
        ensure => $ensure,
        source => 'puppet:///modules/arclamp/arclamp-generate-svgs',
        owner  => 'root',
        group  => 'root',
        mode   => '0555',
    }

    cron { 'arclamp_generate_svgs':
        ensure  => $ensure,
        command => '/usr/local/bin/arclamp-generate-svgs > /dev/null',
        user    => 'xenon',
        minute  => '*/15',
        require => File['/usr/local/bin/arclamp-generate-svgs']
    }

    file { '/usr/local/bin/arclamp-grep':
        ensure => $ensure,
        source => 'puppet:///modules/arclamp/arclamp-grep.py',
        owner  => 'root',
        group  => 'root',
        mode   => '0555',
    }


    arclamp::instance {
        default:
            ensure     => present,
            redis_host => $redis_host,
            redis_port => $redis_port;
        'xenon':
            description => 'HHVM Xenon',
            label       => '';
        'excimer':
            description => 'PHP Excimer';
    }
}