This is an automated email from the ASF dual-hosted git repository.

chesnay pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/flink.git


The following commit(s) were added to refs/heads/master by this push:
     new 5421071  [FLINK-16962][metrics][datadog] Add DatadogHttpReporterFactory
5421071 is described below

commit 5421071c14c53603196e4e4adc75dae41feb2519
Author: molsionmo <52347588+molsio...@users.noreply.github.com>
AuthorDate: Fri Apr 17 22:15:27 2020 +0800

    [FLINK-16962][metrics][datadog] Add DatadogHttpReporterFactory
---
 docs/monitoring/metrics.md                         |  4 +--
 docs/monitoring/metrics.zh.md                      |  4 +--
 .../flink/metrics/datadog/DatadogHttpReporter.java |  2 ++
 .../datadog/DatadogHttpReporterFactory.java        | 36 ++++++++++++++++++++++
 ...he.flink.metrics.reporter.MetricReporterFactory | 16 ++++++++++
 5 files changed, 58 insertions(+), 4 deletions(-)

diff --git a/docs/monitoring/metrics.md b/docs/monitoring/metrics.md
index e7540fb..46d9032 100644
--- a/docs/monitoring/metrics.md
+++ b/docs/monitoring/metrics.md
@@ -757,7 +757,7 @@ metrics.reporter.stsd.port: 8125
 
 ### Datadog (org.apache.flink.metrics.datadog.DatadogHttpReporter)
 
-In order to use this reporter you must copy 
`/opt/flink-metrics-datadog-{{site.version}}.jar` into the `/lib` folder
+In order to use this reporter you must copy 
`/opt/flink-metrics-datadog-{{site.version}}.jar` into the `/plugins/datadog` 
folder
 of your Flink distribution.
 
 Note any variables in Flink metrics, such as `<host>`, `<job_name>`, 
`<tm_id>`, `<subtask_index>`, `<task_name>`, and `<operator_name>`,
@@ -775,7 +775,7 @@ Example configuration:
 
 {% highlight yaml %}
 
-metrics.reporter.dghttp.class: 
org.apache.flink.metrics.datadog.DatadogHttpReporter
+metrics.reporter.dghttp.factory.class: 
org.apache.flink.metrics.datadog.DatadogHttpReporterFactory
 metrics.reporter.dghttp.apikey: xxx
 metrics.reporter.dghttp.tags: myflinkapp,prod
 metrics.reporter.dghttp.proxyHost: my.web.proxy.com
diff --git a/docs/monitoring/metrics.zh.md b/docs/monitoring/metrics.zh.md
index b6321b7..b954ebd 100644
--- a/docs/monitoring/metrics.zh.md
+++ b/docs/monitoring/metrics.zh.md
@@ -757,7 +757,7 @@ metrics.reporter.stsd.port: 8125
 
 ### Datadog (org.apache.flink.metrics.datadog.DatadogHttpReporter)
 
-In order to use this reporter you must copy 
`/opt/flink-metrics-datadog-{{site.version}}.jar` into the `/lib` folder
+In order to use this reporter you must copy 
`/opt/flink-metrics-datadog-{{site.version}}.jar` into the `/plugins/datadog` 
folder
 of your Flink distribution.
 
 Note any variables in Flink metrics, such as `<host>`, `<job_name>`, 
`<tm_id>`, `<subtask_index>`, `<task_name>`, and `<operator_name>`,
@@ -774,7 +774,7 @@ Example configuration:
 
 {% highlight yaml %}
 
-metrics.reporter.dghttp.class: 
org.apache.flink.metrics.datadog.DatadogHttpReporter
+metrics.reporter.dghttp.factory.class: 
org.apache.flink.metrics.datadog.DatadogHttpReporterFactory
 metrics.reporter.dghttp.apikey: xxx
 metrics.reporter.dghttp.tags: myflinkapp,prod
 metrics.reporter.dghttp.proxyHost: my.web.proxy.com
diff --git 
a/flink-metrics/flink-metrics-datadog/src/main/java/org/apache/flink/metrics/datadog/DatadogHttpReporter.java
 
b/flink-metrics/flink-metrics-datadog/src/main/java/org/apache/flink/metrics/datadog/DatadogHttpReporter.java
index da965d5..d32323b 100644
--- 
a/flink-metrics/flink-metrics-datadog/src/main/java/org/apache/flink/metrics/datadog/DatadogHttpReporter.java
+++ 
b/flink-metrics/flink-metrics-datadog/src/main/java/org/apache/flink/metrics/datadog/DatadogHttpReporter.java
@@ -25,6 +25,7 @@ import org.apache.flink.metrics.Meter;
 import org.apache.flink.metrics.Metric;
 import org.apache.flink.metrics.MetricConfig;
 import org.apache.flink.metrics.MetricGroup;
+import org.apache.flink.metrics.reporter.InstantiateViaFactory;
 import org.apache.flink.metrics.reporter.MetricReporter;
 import org.apache.flink.metrics.reporter.Scheduled;
 
@@ -43,6 +44,7 @@ import java.util.concurrent.ConcurrentHashMap;
  *
  * <p>Variables in metrics scope will be sent to Datadog as tags.
  */
+@InstantiateViaFactory(factoryClassName = 
"org.apache.flink.metrics.datadog.DatadogHttpReporterFactory")
 public class DatadogHttpReporter implements MetricReporter, Scheduled {
        private static final Logger LOGGER = 
LoggerFactory.getLogger(DatadogHttpReporter.class);
        private static final String HOST_VARIABLE = "<host>";
diff --git 
a/flink-metrics/flink-metrics-datadog/src/main/java/org/apache/flink/metrics/datadog/DatadogHttpReporterFactory.java
 
b/flink-metrics/flink-metrics-datadog/src/main/java/org/apache/flink/metrics/datadog/DatadogHttpReporterFactory.java
new file mode 100644
index 0000000..d4e2e86
--- /dev/null
+++ 
b/flink-metrics/flink-metrics-datadog/src/main/java/org/apache/flink/metrics/datadog/DatadogHttpReporterFactory.java
@@ -0,0 +1,36 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.flink.metrics.datadog;
+
+import org.apache.flink.metrics.reporter.MetricReporter;
+import org.apache.flink.metrics.reporter.MetricReporterFactory;
+
+import java.util.Properties;
+
+/**
+ * {@link MetricReporterFactory} for {@link DatadogHttpReporter}.
+ */
+public class DatadogHttpReporterFactory implements MetricReporterFactory {
+
+       @Override
+       public MetricReporter createMetricReporter(Properties properties) {
+               return new DatadogHttpReporter();
+       }
+
+}
diff --git 
a/flink-metrics/flink-metrics-datadog/src/main/resources/META-INF/services/org.apache.flink.metrics.reporter.MetricReporterFactory
 
b/flink-metrics/flink-metrics-datadog/src/main/resources/META-INF/services/org.apache.flink.metrics.reporter.MetricReporterFactory
new file mode 100644
index 0000000..f451931
--- /dev/null
+++ 
b/flink-metrics/flink-metrics-datadog/src/main/resources/META-INF/services/org.apache.flink.metrics.reporter.MetricReporterFactory
@@ -0,0 +1,16 @@
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+org.apache.flink.metrics.datadog.DatadogHttpReporterFactory

Reply via email to