Elukey has submitted this change and it was merged. ( 
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/analytics/worker.yaml
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/monitoring/broker.pp
5 files changed, 44 insertions(+), 2 deletions(-)

Approvals:
  Elukey: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/hieradata/role/common/druid/analytics/worker.yaml 
b/hieradata/role/common/druid/analytics/worker.yaml
index 59fd334..9528f25 100644
--- a/hieradata/role/common/druid/analytics/worker.yaml
+++ b/hieradata/role/common/druid/analytics/worker.yaml
@@ -70,6 +70,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: '$ANALYTICS_NETWORKS'
 profile::druid::broker::properties:
   druid.processing.numThreads: 10
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..7ab39a4 100644
--- a/modules/profile/manifests/druid/broker.pp
+++ b/modules/profile/manifests/druid/broker.pp
@@ -9,16 +9,35 @@
     $properties         = hiera('profile::druid::broker::properties'),
     $env                = hiera('profile::druid::broker::env'),
     $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 Druid Broker process.
+    if $monitoring_enabled {
+        include ::profile::druid::monitoring::broker
+        $java_opts = $::profile::druid::monitoring::broker::java_opts
+
+        if $env['DRUID_EXTRA_JVM_OPTS'] {
+            $monitoring_env_vars = {
+                'DRUID_EXTRA_JVM_OPTS' => "${env['DRUID_EXTRA_JVM_OPTS']} 
${java_opts}"
+            }
+        } else {
+            $monitoring_env_vars = {
+                'DRUID_EXTRA_JVM_OPTS' => $java_opts
+            }
+        }
+    } else {
+        $monitoring_env_vars = {}
+    }
+
     # Druid Broker Service
     class { '::druid::broker':
         properties       => $properties,
-        env              => $env,
+        env              => merge($env, $monitoring_env_vars),
         should_subscribe => $daemon_autoreload,
     }
 
diff --git a/modules/profile/manifests/druid/monitoring/broker.pp 
b/modules/profile/manifests/druid/monitoring/broker.pp
new file mode 100644
index 0000000..29e0cee
--- /dev/null
+++ b/modules/profile/manifests/druid/monitoring/broker.pp
@@ -0,0 +1,18 @@
+# Class: profile::druid::monitoring::broker
+#
+# Sets up Prometheus based monitoring (only jvm) for the druid broker.
+#
+class profile::druid::monitoring::broker(
+    $prometheus_nodes        = hiera('prometheus_nodes'),
+) {
+    $jmx_exporter_config_file = '/etc/druid/jvm_prometheus_jmx_exporter.yaml'
+    $prometheus_jmx_exporter_broker_port = 8182
+    $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: merged
Gerrit-Change-Id: Ied9513222bf5256c70b428228c8d9a196a09bc1c
Gerrit-PatchSet: 11
Gerrit-Project: operations/puppet
Gerrit-Branch: production
Gerrit-Owner: Elukey <ltosc...@wikimedia.org>
Gerrit-Reviewer: Elukey <ltosc...@wikimedia.org>
Gerrit-Reviewer: Filippo Giunchedi <fgiunch...@wikimedia.org>
Gerrit-Reviewer: Ottomata <ao...@wikimedia.org>
Gerrit-Reviewer: jenkins-bot <>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to