flink-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Fabian Hueske (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (FLINK-8284) Custom metrics not being exposed for Prometheus
Date Thu, 18 Jan 2018 13:13:00 GMT

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

Fabian Hueske commented on FLINK-8284:
--------------------------------------

+1 to improve the docs.

[~JBiason], would you mind to either update this issue or create a new one and tag it to the
component "Documentation".

 

Thank you!

> Custom metrics not being exposed for Prometheus
> -----------------------------------------------
>
>                 Key: FLINK-8284
>                 URL: https://issues.apache.org/jira/browse/FLINK-8284
>             Project: Flink
>          Issue Type: Bug
>          Components: Documentation, Metrics
>    Affects Versions: 1.4.0
>         Environment: Linux/CentOS 7
>            Reporter: Julio Biason
>            Priority: Major
>
> Following the documentation, we changed our filter that removes events with missing fields
to a RichFilterFunction, so we can capture metrics about such events:
> {code:scala}
> public class MissingClientFilter extends RichFilterFunction<LineData> {
> 	private transient Counter counter;
> 	@Override
> 	public void open(Configuration config) {
> 		this.counter = getRuntimeContext()
> 			.getMetricGroup()
> 			.addGroup("events")
> 			.counter("missingClient");
> 	}
> 	@Override
> 	public boolean filter(LineData line) {
> 		String client = line.get("client").toString();
> 		boolean missing = client.trim().equals("");
> 		if (!missing) {
> 			this.count();
> 		}
> 		return !missing;
> 	}
> 	private void count() {
> 		if (this.counter != null) {
> 			this.counter.inc();
> 		}
> 	}
> }
> {code}
> We also added Prometheus as our reporter:
> {noformat}
> metrics.reporters: prom
> metrics.reporter.prom.port: 9105
> metrics.reporter.prom.class: org.apache.flink.metrics.prometheus.PrometheusReporter
> {noformat}
> The problem is accessing port 9105 display all Flink metrics, but not ours.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Mime
View raw message