Elukey has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/390419 )

Change subject: profile::druid::broker: add prometheus jmx exporter config (jvm 
only)
......................................................................

profile::druid::broker: add prometheus jmx exporter config (jvm only)

Bug: T177459
Change-Id: Ied9513222bf5256c70b428228c8d9a196a09bc1c
---
M hieradata/role/common/druid/public/worker.yaml
A modules/profile/files/druid/jvm_prometheus_jmx_exporter.yaml
M modules/profile/manifests/druid/broker.pp
A modules/profile/manifests/druid/broker/monitoring.pp
4 files changed, 42 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/operations/puppet 
refs/changes/19/390419/1

diff --git a/hieradata/role/common/druid/public/worker.yaml 
b/hieradata/role/common/druid/public/worker.yaml
index fac2bbf..ce4f5cf 100644
--- a/hieradata/role/common/druid/public/worker.yaml
+++ b/hieradata/role/common/druid/public/worker.yaml
@@ -64,6 +64,7 @@
 # --- Druid Broker
 
 # Broker gets a special ferm_srange since it is the frontend query interface 
to Druid.
+profile::druid::broker::monitoring_enabled: true
 profile::druid::broker::ferm_srange: '$DOMAIN_NETWORKS'
 profile::druid::broker::properties:
   druid.processing.numThreads: 10
diff --git a/modules/profile/files/druid/jvm_prometheus_jmx_exporter.yaml 
b/modules/profile/files/druid/jvm_prometheus_jmx_exporter.yaml
new file mode 100644
index 0000000..73530b2
--- /dev/null
+++ b/modules/profile/files/druid/jvm_prometheus_jmx_exporter.yaml
@@ -0,0 +1,3 @@
+---
+lowercaseOutputLabelNames: true
+lowercaseOutputName: false
\ No newline at end of file
diff --git a/modules/profile/manifests/druid/broker.pp 
b/modules/profile/manifests/druid/broker.pp
index dde1163..7b7ba89 100644
--- a/modules/profile/manifests/druid/broker.pp
+++ b/modules/profile/manifests/druid/broker.pp
@@ -11,10 +11,29 @@
     $ferm_srange        = hiera('profile::druid::broker::ferm_srange'),
     $monitoring_enabled = hiera('profile::druid::monitoring_enabled'),
     $daemon_autoreload  = hiera('profile::druid::daemons_autoreload'),
+    $monitoring_enabled = hiera('profile::druid::broker::monitoring_enabled'),
 ) {
 
     require ::profile::druid::common
 
+    # If monitoring is enabled, then include the monitoring profile and set 
$java_opts
+    # for exposing the Prometheus JMX Exporter in the Kafka Broker process.
+    if $monitoring_enabled {
+        include ::profile::druid::broker::monitoring
+        $broker_extra_java_opts = 
::profile::druid::broker::monitoring::broker_extra_java_opts
+
+        if $env['DRUID_EXTRA_JVM_OPTS'] {
+            $monitoring_env_vars = {
+                'DRUID_EXTRA_JVM_OPTS' => "${env['DRUID_EXTRA_JVM_OPTS']} 
${broker_extra_java_opts}"
+            }
+        } else {
+            $monitoring_env_vars = {
+                'DRUID_EXTRA_JVM_OPTS' => $broker_extra_java_opts
+            }
+        }
+        $env = merge($env, $monitoring_env_vars)
+    }
+
     # Druid Broker Service
     class { '::druid::broker':
         properties       => $properties,
diff --git a/modules/profile/manifests/druid/broker/monitoring.pp 
b/modules/profile/manifests/druid/broker/monitoring.pp
new file mode 100644
index 0000000..a08f2d9
--- /dev/null
+++ b/modules/profile/manifests/druid/broker/monitoring.pp
@@ -0,0 +1,19 @@
+# Class: profile::druid::monitoring
+#
+# Sets up Prometheus based monitoring for all the druid workers. This assumes
+# that all the Druid workers are running all the daemons.
+#
+class profile::druid::broker::monitoring (
+    $prometheus_nodes        = hiera('prometheus_nodes'),
+) {
+    $jmx_exporter_config_file = '/etc/druid/jvm_prometheus_jmx_exporter.yaml'
+    $prometheus_jmx_exporter_broker_port = 8182
+    $broker_extra_java_opts = 
"-javaagent:/usr/share/java/prometheus/jmx_prometheus_javaagent.jar=${::ipaddress}:${prometheus_jmx_exporter_broker_port}:${jmx_exporter_config_file}"
+    profile::prometheus::jmx_exporter { "druid_broker_${::hostname}":
+        hostname         => $::hostname,
+        port             => $prometheus_jmx_exporter_broker_port,
+        prometheus_nodes => $prometheus_nodes,
+        config_file      => $jmx_exporter_config_file,
+        source           => 
'puppet:///modules/profile/druid/jvm_prometheus_jmx_exporter.yaml',
+    }
+}
\ No newline at end of file

-- 
To view, visit https://gerrit.wikimedia.org/r/390419
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ied9513222bf5256c70b428228c8d9a196a09bc1c
Gerrit-PatchSet: 1
Gerrit-Project: operations/puppet
Gerrit-Branch: production
Gerrit-Owner: Elukey <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to