You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@flink.apache.org by ch...@apache.org on 2022/08/17 21:59:54 UTC

[flink] 04/04: [FLINK-29002][datadog] Deprecate 'tags' option

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

commit 3e6f47c9d3623c240bbb86845893f9a022dde03d
Author: Chesnay Schepler <ch...@apache.org>
AuthorDate: Tue Aug 16 21:42:15 2022 +0200

    [FLINK-29002][datadog] Deprecate 'tags' option
---
 docs/content.zh/docs/deployment/metric_reporters.md              | 2 --
 docs/content/docs/deployment/metric_reporters.md                 | 2 --
 .../apache/flink/metrics/datadog/DatadogHttpReporterFactory.java | 9 +++++++++
 3 files changed, 9 insertions(+), 4 deletions(-)

diff --git a/docs/content.zh/docs/deployment/metric_reporters.md b/docs/content.zh/docs/deployment/metric_reporters.md
index 5ab5b1c39da..2c4cdb9b033 100644
--- a/docs/content.zh/docs/deployment/metric_reporters.md
+++ b/docs/content.zh/docs/deployment/metric_reporters.md
@@ -270,7 +270,6 @@ metrics.reporter.stsd.interval: 60 SECONDS
 参数:
 
 - `apikey` - Datadog 的 API KEY。
-- `tags` - (可选的)发送到 Datadog 时将会转换为指标的全局 tag。tag 间只能以逗号分隔。
 - `proxyHost` - (可选的)发送到 Datadog 时使用的代理主机。
 - `proxyPort` - (可选的)发送到 Datadog 时使用的代理端口,默认为 8080。
 - `dataCenter` - (可选的)要连接的数据中心(`EU`/`US`),默认为 `US`。
@@ -282,7 +281,6 @@ metrics.reporter.stsd.interval: 60 SECONDS
 ```yaml
 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
 metrics.reporter.dghttp.proxyPort: 8080
 metrics.reporter.dghttp.dataCenter: US
diff --git a/docs/content/docs/deployment/metric_reporters.md b/docs/content/docs/deployment/metric_reporters.md
index f980745a138..e8b3ccb2e20 100644
--- a/docs/content/docs/deployment/metric_reporters.md
+++ b/docs/content/docs/deployment/metric_reporters.md
@@ -254,7 +254,6 @@ In contrast to Datadog-provided Histograms the reported aggregations are not com
 Parameters:
 
 - `apikey` - the Datadog API key
-- `tags` - (optional) the global tags that will be applied to metrics when sending to Datadog. Tags should be separated by comma only
 - `proxyHost` - (optional) The proxy host to use when sending to Datadog.
 - `proxyPort` - (optional) The proxy port to use when sending to Datadog, defaults to 8080.
 - `dataCenter` - (optional) The data center (`EU`/`US`) to connect to, defaults to `US`.
@@ -266,7 +265,6 @@ Example configuration:
 ```yaml
 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
 metrics.reporter.dghttp.proxyPort: 8080
 metrics.reporter.dghttp.dataCenter: US
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
index c9ba359f52b..ebee3b545c7 100644
--- 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
@@ -21,11 +21,16 @@ package org.apache.flink.metrics.datadog;
 import org.apache.flink.metrics.reporter.MetricReporter;
 import org.apache.flink.metrics.reporter.MetricReporterFactory;
 
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
 import java.util.Properties;
 
 /** {@link MetricReporterFactory} for {@link DatadogHttpReporter}. */
 public class DatadogHttpReporterFactory implements MetricReporterFactory {
 
+    private static final Logger LOG = LoggerFactory.getLogger(DatadogHttpReporterFactory.class);
+
     private static final String API_KEY = "apikey";
     private static final String PROXY_HOST = "proxyHost";
     private static final String PROXY_PORT = "proxyPort";
@@ -43,6 +48,10 @@ public class DatadogHttpReporterFactory implements MetricReporterFactory {
         final int maxMetricsPerRequestValue =
                 Integer.valueOf(config.getProperty(MAX_METRICS_PER_REQUEST, "2000"));
         final DataCenter dataCenter = DataCenter.valueOf(rawDataCenter);
+        if (config.containsKey(TAGS)) {
+            LOG.warn(
+                    "The 'tags' option is deprecated; please use 'scope.variables.additional' instead.");
+        }
         final String tags = config.getProperty(TAGS, "");
         final boolean useLogicalIdentifier =
                 Boolean.parseBoolean(config.getProperty(USE_LOGICAL_IDENTIFIER, "false"));