Use the custom metric configuration feature to monitor Flink custom metric data in your Prometheus instance. After you add metrics to the custom metric configuration, the agent recognizes and collects them. The agent supports two configuration methods by default: by full metric name and by metric prefix. You can also combine these methods.
Prerequisites
The agent version is 4.1.0 or later.
Procedure
Log on to the Realtime Compute console.
In the Actions column for the target instance, click More > Monitoring Metric Configuration.
In the left-side navigation pane, choose Settings, and then click the Settings tab. In the Prometheus Agent section, click Custom Metric Configuration.
In the Custom Metric Configuration dialog box, enter the names or patterns of the metrics to collect, and then click OK.
Collection method
Description
By full metric name
Enter the full name of the metric to collect.
By metric prefix
Enter a metric prefix to collect a series of metrics. Use the format prefix_name*.
Combined method
Enter metrics using either their full names or prefixes.
ImportantEnter each metric on a new line, without any trailing characters such as commas, semicolons, colons, or spaces.
Custom metric collection example
If you want to collect the following metrics:
flink_jobmanager_Status_JVM_GarbageCollector_G1_Young_Generation_Count
flink_jobmanager_Status_JVM_GarbageCollector_G1_Old_Generation_Count
flink_jobmanager_Status_JVM_GarbageCollector_G1_Young_Generation_Time
flink_jobmanager_Status_JVM_GarbageCollector_G1_Old_Generation_Time flink_taskmanager_job_task_operator_dtNumBytesIn
The first four metrics are related to G1 garbage collection and share the flink_jobmanager_Status_JVM_GarbageCollector_G1_ prefix. You can use the combined method to configure the metrics as follows:
In the Custom Metric Configuration dialog box, enter flink_jobmanager_Status_JVM_GarbageCollector_G1_* and flink_taskmanager_job_task_operator_dtNumBytesIn, with each entry on a separate line. Then, click OK.