[ 
https://issues.apache.org/jira/browse/FLINK-6221?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16009537#comment-16009537
 ] 

ASF GitHub Bot commented on FLINK-6221:
---------------------------------------

Github user zentol commented on a diff in the pull request:

    https://github.com/apache/flink/pull/3833#discussion_r116368672
  
    --- Diff: 
flink-metrics/flink-metrics-prometheus/src/test/java/org/apache/flink/metrics/prometheus/PrometheusReporterTest.java
 ---
    @@ -0,0 +1,192 @@
    +/*
    + * 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.prometheus;
    +
    +import com.mashape.unirest.http.HttpResponse;
    +import com.mashape.unirest.http.Unirest;
    +import com.mashape.unirest.http.exceptions.UnirestException;
    +import org.apache.flink.configuration.ConfigConstants;
    +import org.apache.flink.configuration.Configuration;
    +import org.apache.flink.configuration.MetricOptions;
    +import org.apache.flink.metrics.Counter;
    +import org.apache.flink.metrics.Gauge;
    +import org.apache.flink.metrics.Histogram;
    +import org.apache.flink.metrics.Meter;
    +import org.apache.flink.metrics.Metric;
    +import org.apache.flink.metrics.SimpleCounter;
    +import org.apache.flink.metrics.reporter.MetricReporter;
    +import org.apache.flink.metrics.util.TestMeter;
    +import org.apache.flink.runtime.metrics.MetricRegistry;
    +import org.apache.flink.runtime.metrics.MetricRegistryConfiguration;
    +import org.apache.flink.runtime.metrics.groups.FrontMetricGroup;
    +import org.apache.flink.runtime.metrics.groups.TaskManagerMetricGroup;
    +import org.apache.flink.runtime.metrics.util.TestingHistogram;
    +import org.apache.flink.util.TestLogger;
    +import org.junit.After;
    +import org.junit.Rule;
    +import org.junit.Test;
    +import org.junit.rules.ExpectedException;
    +
    +import java.util.Arrays;
    +
    +import static 
org.apache.flink.metrics.prometheus.PrometheusReporter.ARG_PORT;
    +import static 
org.apache.flink.runtime.metrics.scope.ScopeFormat.SCOPE_SEPARATOR;
    +import static org.hamcrest.Matchers.both;
    +import static org.hamcrest.Matchers.containsString;
    +import static org.hamcrest.Matchers.equalTo;
    +import static org.junit.Assert.assertThat;
    +
    +public class PrometheusReporterTest extends TestLogger {
    +   private static final int NON_DEFAULT_PORT = 9429;
    +
    +   private static final String HOST_NAME    = "hostname";
    +   private static final String TASK_MANAGER = "tm";
    +
    +   private static final String HELP_PREFIX    = "# HELP ";
    +   private static final String TYPE_PREFIX    = "# TYPE ";
    +   private static final String DIMENSIONS     = "host=\"" + HOST_NAME + 
"\",tm_id=\"" + TASK_MANAGER + "\"";
    +   private static final String DEFAULT_LABELS = "{" + DIMENSIONS + ",}";
    +   private static final String SCOPE_PREFIX   = "taskmanager_";
    +
    +   @Rule
    +   public ExpectedException thrown = ExpectedException.none();
    +
    +   private MetricRegistry registry = prepareMetricRegistry();
    --- End diff --
    
    could be final.


> Add Prometheus support to metrics
> ---------------------------------
>
>                 Key: FLINK-6221
>                 URL: https://issues.apache.org/jira/browse/FLINK-6221
>             Project: Flink
>          Issue Type: Improvement
>          Components: Metrics
>    Affects Versions: 1.2.0
>            Reporter: Joshua Griffith
>            Assignee: Maximilian Bode
>            Priority: Minor
>
> [Prometheus|https://prometheus.io/] is becoming popular for metrics and 
> alerting. It's possible to use 
> [statsd-exporter|https://github.com/prometheus/statsd_exporter] to load Flink 
> metrics into Prometheus but it would be far easier if Flink supported 
> Promethus as a metrics reporter. A [dropwizard 
> client|https://github.com/prometheus/client_java/tree/master/simpleclient_dropwizard]
>  exists that could be integrated into the existing metrics system.



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)

Reply via email to