[ https://issues.apache.org/jira/browse/FLINK-7155?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16307152#comment-16307152 ]
ASF GitHub Bot commented on FLINK-7155: --------------------------------------- Github user gobozov commented on a diff in the pull request: https://github.com/apache/flink/pull/4299#discussion_r159136038 --- Diff: flink-metrics/flink-metrics-influxdb/src/main/java/org/apache/flink/metrics/influxdb/InfluxdbReporter.java --- @@ -0,0 +1,76 @@ +/* + * 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.influxdb; + +import org.apache.flink.annotation.PublicEvolving; +import org.apache.flink.dropwizard.ScheduledDropwizardReporter; +import org.apache.flink.metrics.MetricConfig; + +import com.codahale.metrics.MetricFilter; +import com.codahale.metrics.ScheduledReporter; +import metrics_influxdb.HttpInfluxdbProtocol; +import metrics_influxdb.api.measurements.CategoriesMetricMeasurementTransformer; + +import java.util.concurrent.TimeUnit; + +/** + * This class acts as a factory for the {@link metrics_influxdb.InfluxdbReporter} and allows using it as a Flink + * reporter. + */ +@PublicEvolving +public class InfluxdbReporter extends ScheduledDropwizardReporter { + + public static final String ARG_USER = "user"; + public static final String ARG_PASSWORD = "password"; + public static final String ARG_DB = "db"; + + @Override + public ScheduledReporter getReporter(final MetricConfig config) { + final String host = config.getString(ARG_HOST, "localhost"); + final Integer port = config.getInteger(ARG_PORT, HttpInfluxdbProtocol.DEFAULT_PORT); + final String user = config.getString(ARG_USER, null); + final String password = config.getString(ARG_PASSWORD, null); + final String db = config.getString(ARG_DB, "flink"); + final String conversionRate = config.getString(ARG_CONVERSION_RATE, null); + final String conversionDuration = config.getString(ARG_CONVERSION_DURATION, null); + + final metrics_influxdb.InfluxdbReporter.Builder builder = + metrics_influxdb.InfluxdbReporter.forRegistry(registry); + + builder.protocol(new HttpInfluxdbProtocol(host, port, user, password, db)); --- End diff -- We built same thing for our needs using same InfluxDb reporter. The disadvantage is that it does not support https, we modified it to support sslContext. I also don't see way to provide tags to reporter builder. > Add Influxdb metrics reporter > ----------------------------- > > Key: FLINK-7155 > URL: https://issues.apache.org/jira/browse/FLINK-7155 > Project: Flink > Issue Type: Improvement > Components: Metrics > Reporter: Patrick Lucas > Assignee: Patrick Lucas > > [~jgrier] has a [simple Influxdb metrics reporter for > Flink|https://github.com/jgrier/flink-stuff/tree/master/flink-influx-reporter] > that is a thing wrapper around [a lightweight, public-domain Influxdb > reporter|https://github.com/davidB/metrics-influxdb] for Codahale metrics. > We can implement this very easily in Java in the same as as > flink-metrics-graphite. -- This message was sent by Atlassian JIRA (v6.4.14#64029)