Puppet Class: profile::query_service::blazegraph

Defined in:
modules/profile/manifests/query_service/blazegraph.pp

Overview

Parameters:

  • package_dir (Stdlib::Unixpath) (defaults to: hiera('profile::query_service::package_dir'))
  • data_dir (Stdlib::Unixpath) (defaults to: hiera('profile::query_service::data_dir'))
  • log_dir (Stdlib::Unixpath) (defaults to: hiera('profile::query_service::log_dir'))
  • deploy_name (String) (defaults to: hiera('profile::query_service::deploy_name'))
  • logstash_logback_port (Stdlib::Port) (defaults to: hiera('logstash_logback_port'))
  • endpoint (String) (defaults to: hiera('profile::query_service::endpoint'))
  • heap_size (String) (defaults to: hiera('profile::query_service::blazegraph_heap_size', '31g'))
  • use_deployed_config (Boolean) (defaults to: hiera('profile::query_service::blazegraph_use_deployed_config', false))
  • options (Array[String]) (defaults to: hiera('profile::query_service::blazegraph_options'))
  • extra_jvm_opts (Array[String]) (defaults to: hiera('profile::query_service::blazegraph_extra_jvm_opts'))
  • prometheus_nodes (Array[String]) (defaults to: hiera('prometheus_nodes'))
  • contact_groups (String) (defaults to: hiera('contactgroups', 'admins'))
  • lag_warning (Integer[0]) (defaults to: hiera('profile::query_service::lag_warning', 1200))
  • lag_critical (Integer[0]) (defaults to: hiera('profile::query_service::lag_critical', 3600))
  • monitoring_enabled (Boolean) (defaults to: lookup('profile::query_service::blazegraph::monitoring_enabled', { 'default_value' => false}))
  • sparql_query_stream (Optional[String]) (defaults to: hiera('profile::query_service::sparql_query_stream', undef))
  • event_service_endpoint (Optional[String]) (defaults to: hiera('profile::query_service::event_service_endpoint', undef))


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
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
# File 'modules/profile/manifests/query_service/blazegraph.pp', line 1

class profile::query_service::blazegraph(
    Stdlib::Unixpath $package_dir = hiera('profile::query_service::package_dir'),
    Stdlib::Unixpath $data_dir = hiera('profile::query_service::data_dir'),
    Stdlib::Unixpath $log_dir = hiera('profile::query_service::log_dir'),
    String $deploy_name = hiera('profile::query_service::deploy_name'),
    Stdlib::Port $logstash_logback_port = hiera('logstash_logback_port'),
    String $endpoint = hiera('profile::query_service::endpoint'),
    String $heap_size = hiera('profile::query_service::blazegraph_heap_size', '31g'),
    Boolean $use_deployed_config = hiera('profile::query_service::blazegraph_use_deployed_config', false),
    Array[String] $options = hiera('profile::query_service::blazegraph_options'),
    Array[String] $extra_jvm_opts = hiera('profile::query_service::blazegraph_extra_jvm_opts'),
    Array[String] $prometheus_nodes = hiera('prometheus_nodes'),
    String $contact_groups = hiera('contactgroups', 'admins'),
    Integer[0] $lag_warning  = hiera('profile::query_service::lag_warning', 1200),
    Integer[0] $lag_critical = hiera('profile::query_service::lag_critical', 3600),
    Boolean $monitoring_enabled = lookup('profile::query_service::blazegraph::monitoring_enabled', { 'default_value' => false}),
    Optional[String] $sparql_query_stream = hiera('profile::query_service::sparql_query_stream', undef),
    Optional[String] $event_service_endpoint = hiera('profile::query_service::event_service_endpoint', undef)
) {
    require ::profile::query_service::common

    if $sparql_query_stream and !$event_service_endpoint {
        fail('profile::query_service::event_service_endpoint must be provided when profile::query_service::sparql_query_stream is set')
    }

    $username = 'blazegraph'
    $instance_name = "${deploy_name}-blazegraph"
    $prometheus_agent_path = '/usr/share/java/prometheus/jmx_prometheus_javaagent.jar'
    $default_extra_jvm_opts = [
        '-XX:+UseNUMA',
        '-XX:+UnlockExperimentalVMOptions',
        '-XX:G1NewSizePercent=20',
        '-XX:+ParallelRefProcEnabled',
    ]

    $event_service_jvm_opts = $sparql_query_stream ? {
        default => [
            "-Dwdqs.event-sender-filter.event-gate-endpoint=${event_service_endpoint}",
            "-Dwdqs.event-sender-filter.event-gate-sparql-query-stream=${sparql_query_stream}"
        ],
        undef   => []
    }

    $prometheus_agent_port_blazegraph = 9102
    $prometheus_agent_config_blazegraph = "/etc/${deploy_name}/${instance_name}-prometheus-jmx.yaml"
    profile::prometheus::jmx_exporter { $instance_name:
        hostname         => $::hostname,
        prometheus_nodes => $prometheus_nodes,
        source           => 'puppet:///modules/profile/query_service/blazegraph-prometheus-jmx.yaml',
        port             => $prometheus_agent_port_blazegraph,
        before           => Service[$instance_name],
        config_file      => $prometheus_agent_config_blazegraph,
    }

    prometheus::blazegraph_exporter { 'wdqs-blazegraph':
        blazegraph_port  => 9999,
        prometheus_port  => 9193,
        prometheus_nodes => $prometheus_nodes,
    }

    query_service::blazegraph { $instance_name:
        package_dir           => $package_dir,
        data_dir              => $data_dir,
        logstash_logback_port => $logstash_logback_port,
        log_dir               => $log_dir,
        deploy_name           => $deploy_name,
        username              => $username,
        options               => $options,
        use_deployed_config   => $use_deployed_config,
        port                  => 9999,
        config_file_name      => 'RWStore.properties',
        heap_size             => $heap_size,
        extra_jvm_opts        => $default_extra_jvm_opts + $event_service_jvm_opts + $extra_jvm_opts + "-javaagent:${prometheus_agent_path}=${prometheus_agent_port_blazegraph}:${prometheus_agent_config_blazegraph}"
    }

    if $monitoring_enabled {
        class { 'query_service::monitor::blazegraph':
            username       => $username,
            contact_groups => $contact_groups,
            lag_warning    => $lag_warning,
            lag_critical   => $lag_critical,
        }

        query_service::monitor::blazegraph_instance { $instance_name:
            username        => $username,
            contact_groups  => $contact_groups,
            port            => 9999,
            prometheus_port => 9193,
        }
    }
}