Browse Source

AMBARI-25852: Change Kafka metrics_reporters param setup logic (#3640)

Zhiguo Wu 2 years ago
parent
commit
0a672bfdc0

+ 1 - 1
ambari-server/src/main/resources/stacks/BIGTOP/3.2.0/services/KAFKA/configuration/kafka-broker.xml

@@ -305,7 +305,7 @@
   </property>
   <property>
     <name>kafka.metrics.reporters</name>
-    <value />
+    <value>{{metrics_reporters}}</value>
     <description>
       kafka ganglia metrics reporter and kafka timeline metrics reporter
     </description>

+ 3 - 0
ambari-server/src/main/resources/stacks/BIGTOP/3.2.0/services/KAFKA/package/scripts/params.py

@@ -153,6 +153,9 @@ if has_metric_collector:
   else:
     metric_collector_protocol = 'http'
 
+  # If AMS is part of Services, use the KafkaTimelineMetricsReporter for metric reporting. Default is ''.
+  metrics_reporters = "org.apache.hadoop.metrics2.sink.kafka.KafkaTimelineMetricsReporter"
+
   host_in_memory_aggregation = str(default("/configurations/ams-site/timeline.metrics.host.inmemory.aggregation", True)).lower()
   host_in_memory_aggregation_port = default("/configurations/ams-site/timeline.metrics.host.inmemory.aggregation.port", 61888)
   is_aggregation_https_enabled = False

+ 0 - 4
ambari-server/src/main/resources/stacks/BIGTOP/3.2.0/services/KAFKA/service_advisor.py

@@ -263,10 +263,6 @@ class KafkaRecommender(service_advisor.ServiceAdvisor):
     else:
       putKafkaBrokerAttributes('authorizer.class.name', 'delete', 'true')
 
-    #If AMS is part of Services, use the KafkaTimelineMetricsReporter for metric reporting. Default is ''.
-    if "AMBARI_METRICS" in servicesList:
-      putKafkaBrokerProperty('kafka.metrics.reporters', 'org.apache.hadoop.metrics2.sink.kafka.KafkaTimelineMetricsReporter')
-
     if ranger_plugin_enabled:
       kafkaLog4jRangerLines = [{
                                  "name": "log4j.appender.rangerAppender",