When using Flink, you need to monitor its task running status to know whether the tasks run normally and troubleshoot faults. TMP integrates Pushgateway to allow Flink to write metrics and provides an out-of-the-box Grafana monitoring dashboard for it.
APPID
on the Account Info page.Configuration Item | Default Value | Data Type | Description | Suggestion |
---|---|---|---|---|
metrics.reporter.promgateway.class | None | String | Name of the Java class for exporting metrics to Pushgateway | - |
metrics.reporter.promgateway. jobName |
None | String | Push task name | Specify an easily understandable string |
metrics.reporter.promgateway. randomJobNameSuffix |
true | Boolean | Whether to add a random string after the task name | Set it to `true`. If no random string is added, metrics of different Flink tasks will overwrite each other |
metrics.reporter.promgateway. groupingKey |
None | String | Global label added to each metric in the format of `k1=v1;k2=v2` | Add the EMR instance ID to distinguish between the data of different instances, such as `instance_id=emr-xxx` |
metrics.reporter.promgateway. interval |
None | Time | Time interval for pushing metrics, such as 30s | We recommend you set the value to about 1 minute |
metrics.reporter.promgateway.host | None | String | Pushgateway service address | It is the service address of the TMP instance in the console |
metrics.reporter.promgateway.port | -1 | Integer | Pushgateway service port | It is the port of the TMP instance in the console |
metrics.reporter.promgateway. needBasicAuth |
false | Boolean | Whether the Pushgateway service requires authentication | Set it to `true`, as the Pushgateway of TMP requires authentication |
metrics.reporter.promgateway.user | None | String | Username for authentication | It is your `APPID` |
metrics.reporter.promgateway. password |
None | String | Password for authentication | It is the access token of the TMP instance in the console |
metrics.reporter.promgateway. deleteOnShutdown |
true | Boolean | Whether to delete the corresponding metrics on the Pushgateway after the Flink task is completed | Set it to `true` |
metrics.reporter.promgateway.class: org.apache.flink.metrics.prometheus.PrometheusPushGatewayReporter
metrics.reporter.promgateway.jobName: climatePredict
metrics.reporter.promgateway.randomJobNameSuffix:true
metrics.reporter.promgateway.interval: 60 SECONDS
metrics.reporter.promgateway.groupingKey:instance_id=emr-xxxx
metrics.reporter.promgateway.host: 172.xx.xx.xx
metrics.reporter.promgateway.port: 9090
metrics.reporter.promgateway.needBasicAuth: true
metrics.reporter.promgateway.user: appid
metrics.reporter.promgateway.password: token
The Pushgateway plugin in the official package currently does not support configuring the authentication information, but TMP requires authentication before data can be written. Therefore, we recommend you use the JAR package we provide. We have also submitted a pull request for supporting authentication to the Flink team.
cd /usr/local/service/flink/lib
rm flink-metrics-prometheus*jar
cd /usr/local/service/flink/lib
wget https://rig-1258344699.cos.ap-guangzhou.myqcloud.com/flink/flink-metrics-prometheus_2.11-auth.jar -O flink-metrics-prometheus_2.11-auth.jar
Run the flink run
command on the master node to submit a new task and view the task log:
grep metrics /usr/local/service/flink/log/flink-hadoop-client-*.log
If the log contains the following content, the configuration is successfully loaded:
Note:As tasks previously submitted in the cluster use the old configuration file, their metrics are not reported.
Was this page helpful?