Github user zentol commented on a diff in the pull request:
    --- Diff: 
    @@ -0,0 +1,214 @@
    + * 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
    + *
    + *
    + *
    + * 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.CharacterFilter;
    +import org.apache.flink.metrics.Counter;
    +import org.apache.flink.metrics.Gauge;
    +import org.apache.flink.metrics.Meter;
    +import org.apache.flink.metrics.Histogram;
    +import org.apache.flink.metrics.Metric;
    +import org.apache.flink.metrics.MetricConfig;
    +import org.apache.flink.metrics.MetricGroup;
    +import org.apache.flink.metrics.datadog.utils.SerializationUtils;
    +import org.apache.flink.metrics.reporter.MetricReporter;
    +import org.apache.flink.metrics.reporter.Scheduled;
    +import org.slf4j.Logger;
    +import org.slf4j.LoggerFactory;
    +import java.util.ArrayList;
    +import java.util.Arrays;
    +import java.util.List;
    +import java.util.Map;
    +import java.util.concurrent.ConcurrentHashMap;
    + * Metric Reporter for Datadog
    + *
    + * Variables in metrics scope will be sent to Datadog as tags
    + * */
    +public class DatadogHttpReporter implements MetricReporter, 
CharacterFilter, Scheduled {
    +   private static final Logger LOGGER = 
    +   // Both Flink's Gauge and Meter values are taken as gauge in Datadog
    +   private final Map<Gauge, DGauge> gauges = new ConcurrentHashMap<>();
    +   private final Map<Counter, DCounter> counters = new 
    +   private final Map<Meter, DMeter> meters = new ConcurrentHashMap<>();
    +   private DatadogHttpClient client;
    +   private List<String> configTags;
    +   public static final String API_KEY = "apikey";
    +   public static final String TAGS = "tags";
    +   @Override
    +   public void notifyOfAddedMetric(Metric metric, String metricName, 
MetricGroup group) {
    +           final String name = group.getMetricIdentifier(metricName, this);
    --- End diff --
    Some systems don't allow certain special characters to be part of the 
metric name. Instead of filtering these out after generating the 
MetricIdentifier every time, the CharacterFilter interface allows us to do this 
filtering more efficiently by caching a filtered version of the scope in the 

If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at or file a JIRA ticket
with INFRA.

Reply via email to