mas-chen commented on code in PR #20598:
URL: https://github.com/apache/flink/pull/20598#discussion_r947005151
##########
flink-metrics/flink-metrics-datadog/src/main/java/org/apache/flink/metrics/datadog/DatadogHttpReporterFactory.java:
##########
@@ -26,8 +26,34 @@
/** {@link MetricReporterFactory} for {@link DatadogHttpReporter}. */
public class DatadogHttpReporterFactory implements MetricReporterFactory {
+ private static final String API_KEY = "apikey";
+ private static final String PROXY_HOST = "proxyHost";
+ private static final String PROXY_PORT = "proxyPort";
+ private static final String DATA_CENTER = "dataCenter";
+ private static final String TAGS = "tags";
+ private static final String MAX_METRICS_PER_REQUEST =
"maxMetricsPerRequest";
+ private static final String USE_LOGICAL_IDENTIFIER =
"useLogicalIdentifier";
+
@Override
- public MetricReporter createMetricReporter(Properties properties) {
- return new DatadogHttpReporter();
+ public MetricReporter createMetricReporter(Properties config) {
+ final String apiKey = config.getProperty(API_KEY, null);
+ final String proxyHost = config.getProperty(PROXY_HOST, null);
+ final int proxyPort = Integer.valueOf(config.getProperty(PROXY_PORT,
"8080"));
+ final String rawDataCenter = config.getProperty(DATA_CENTER, "US");
+ final int maxMetricsPerRequestValue =
+ Integer.valueOf(config.getProperty(MAX_METRICS_PER_REQUEST,
"2000"));
+ final DataCenter dataCenter = DataCenter.valueOf(rawDataCenter);
+ final String tags = config.getProperty(TAGS, "");
+ final boolean useLogicalIdentifier =
+
Boolean.parseBoolean(config.getProperty(USE_LOGICAL_IDENTIFIER, "false"));
Review Comment:
Should this default to `true`, as documented?
##########
docs/content.zh/docs/deployment/metric_reporters.md:
##########
@@ -261,6 +261,8 @@ metrics.reporter.stsd.interval: 60 SECONDS
使用 Datadog 时,Flink 运行指标中的任何变量,例如 `<host>`、`<job_name>`、 `<tm_id>`、
`<subtask_index>`、`<task_name>`、 `<operator_name>`,都会被当作
`host:localhost`、`job_name:myjobname` 这样的 tag 发送。
+<span class="label label-danger">Note</span> For legacy reasons the reporter
uses _both_ the metric identifier _and_ tags. This redundancy can be avoided by
enabling `useLogicalIdentifier`.
+
<span class="label label-info">注意</span> 按照 Datedog 的 Histograms
命名约定,Histograms 类的运行指标会作为一系列 gauges 显示(`<metric_name>.<aggregation>`)。
Review Comment:
small nit: DateDog -> Datadog misspelling, small fix worth fixing now?
##########
flink-metrics/flink-metrics-datadog/src/main/java/org/apache/flink/metrics/datadog/DatadogHttpReporterFactory.java:
##########
@@ -26,8 +26,34 @@
/** {@link MetricReporterFactory} for {@link DatadogHttpReporter}. */
public class DatadogHttpReporterFactory implements MetricReporterFactory {
+ private static final String API_KEY = "apikey";
+ private static final String PROXY_HOST = "proxyHost";
+ private static final String PROXY_PORT = "proxyPort";
+ private static final String DATA_CENTER = "dataCenter";
+ private static final String TAGS = "tags";
+ private static final String MAX_METRICS_PER_REQUEST =
"maxMetricsPerRequest";
+ private static final String USE_LOGICAL_IDENTIFIER =
"useLogicalIdentifier";
+
@Override
- public MetricReporter createMetricReporter(Properties properties) {
- return new DatadogHttpReporter();
+ public MetricReporter createMetricReporter(Properties config) {
+ final String apiKey = config.getProperty(API_KEY, null);
+ final String proxyHost = config.getProperty(PROXY_HOST, null);
+ final int proxyPort = Integer.valueOf(config.getProperty(PROXY_PORT,
"8080"));
+ final String rawDataCenter = config.getProperty(DATA_CENTER, "US");
+ final int maxMetricsPerRequestValue =
+ Integer.valueOf(config.getProperty(MAX_METRICS_PER_REQUEST,
"2000"));
+ final DataCenter dataCenter = DataCenter.valueOf(rawDataCenter);
+ final String tags = config.getProperty(TAGS, "");
Review Comment:
Shouldn't this option be deprecated since we introduced adding global tags,
generically?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]