Skip to content

Commit

Permalink
[FLINK-16966][metrics][infuxdb] Add InfluxDBReporterFactory
Browse files Browse the repository at this point in the history
  • Loading branch information
windWheel committed May 17, 2020
1 parent 6a58ce0 commit fab8bf7
Show file tree
Hide file tree
Showing 6 changed files with 57 additions and 26 deletions.
4 changes: 2 additions & 2 deletions docs/monitoring/metrics.md
Original file line number Diff line number Diff line change
Expand Up @@ -652,7 +652,7 @@ metrics.reporter.grph.protocol: TCP

### InfluxDB (org.apache.flink.metrics.influxdb.InfluxdbReporter)

In order to use this reporter you must copy `/opt/flink-metrics-influxdb-{{site.version}}.jar` into the `/lib` folder
In order to use this reporter you must copy `/opt/flink-metrics-influxdb-{{site.version}}.jar` into the `plugins/influxdb` folder
of your Flink distribution.

Parameters:
Expand All @@ -663,7 +663,7 @@ Example configuration:

{% highlight yaml %}

metrics.reporter.influxdb.class: org.apache.flink.metrics.influxdb.InfluxdbReporter
metrics.reporter.influxdb.factory.class: org.apache.flink.metrics.influxdb.InfluxdbReporterFactory
metrics.reporter.influxdb.host: localhost
metrics.reporter.influxdb.port: 8086
metrics.reporter.influxdb.db: flink
Expand Down
4 changes: 2 additions & 2 deletions docs/monitoring/metrics.zh.md
Original file line number Diff line number Diff line change
Expand Up @@ -652,7 +652,7 @@ metrics.reporter.grph.protocol: TCP

### InfluxDB (org.apache.flink.metrics.influxdb.InfluxdbReporter)

In order to use this reporter you must copy `/opt/flink-metrics-influxdb-{{site.version}}.jar` into the `/lib` folder
In order to use this reporter you must copy `/opt/flink-metrics-influxdb-{{site.version}}.jar` into the `plugins/influxdb` folder
of your Flink distribution.

Parameters:
Expand All @@ -663,7 +663,7 @@ Example configuration:

{% highlight yaml %}

metrics.reporter.influxdb.class: org.apache.flink.metrics.influxdb.InfluxdbReporter
metrics.reporter.influxdb.factory.class: org.apache.flink.metrics.influxdb.InfluxdbReporterFactory
metrics.reporter.influxdb.host: localhost
metrics.reporter.influxdb.port: 8086
metrics.reporter.influxdb.db: flink
Expand Down
22 changes: 0 additions & 22 deletions flink-metrics/flink-metrics-influxdb/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -112,28 +112,6 @@ under the License.
<!-- org.msgpack:msgpack-core is not required -->
</includes>
</artifactSet>
<relocations combine.children="append">
<relocation>
<pattern>org.influxdb</pattern>
<shadedPattern>org.apache.flink.metrics.influxdb.shaded.org.influxdb</shadedPattern>
</relocation>
<relocation>
<pattern>com.squareup.moshi</pattern>
<shadedPattern>org.apache.flink.metrics.influxdb.shaded.com.squareup.moshi</shadedPattern>
</relocation>
<relocation>
<pattern>okhttp3</pattern>
<shadedPattern>org.apache.flink.metrics.influxdb.shaded.okhttp3</shadedPattern>
</relocation>
<relocation>
<pattern>okio</pattern>
<shadedPattern>org.apache.flink.metrics.influxdb.shaded.okio</shadedPattern>
</relocation>
<relocation>
<pattern>retrofit2</pattern>
<shadedPattern>org.apache.flink.metrics.influxdb.shaded.retrofit2</shadedPattern>
</relocation>
</relocations>
</configuration>
</execution>
</executions>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
import org.apache.flink.metrics.Meter;
import org.apache.flink.metrics.Metric;
import org.apache.flink.metrics.MetricConfig;
import org.apache.flink.metrics.reporter.InstantiateViaFactory;
import org.apache.flink.metrics.reporter.MetricReporter;
import org.apache.flink.metrics.reporter.Scheduled;
import org.apache.flink.util.NetUtils;
Expand Down Expand Up @@ -57,6 +58,7 @@
/**
* {@link MetricReporter} that exports {@link Metric Metrics} via InfluxDB.
*/
@InstantiateViaFactory(factoryClassName = "org.apache.flink.metrics.influxdb.InfluxdbReporterFactory")
public class InfluxdbReporter extends AbstractReporter<MeasurementInfo> implements Scheduled {

private String database;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
/*
* 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:https://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.metrics.reporter.MetricReporter;
import org.apache.flink.metrics.reporter.MetricReporterFactory;

import java.util.Properties;

/**
* {@link MetricReporterFactory} for {@link InfluxdbReporter}.
*/
public class InfluxdbReporterFactory implements MetricReporterFactory {

@Override
public MetricReporter createMetricReporter(Properties properties) {
return new InfluxdbReporter();
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# 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:https://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.

org.apache.flink.metrics.influxdb.InfluxdbReporterFactory

0 comments on commit fab8bf7

Please sign in to comment.