The <CustomMetricConfig> section contains the settings for custom Prometheus metrics or Prometheus metrics which do not have metric mappings. Using this configuration, you can enabe or disable custom metric, drop unwanted Prometheus label names and even configure the maximum number of labels that can be set.
- collectCustomMetrics is used to enable or disable the collection of custom Prometheus metrics which do not have mappings in the XML. Set the option to true to collect custom metrics and false to disable the collection of custom metrics.
- enableAllLabels is used to enable or disable collection the Prometheus labels. Setting this field to true enables collection of labels and setting it to false disables collection of labels. Prometheus labels are used to create instanced metrics and this setting is applicable only when collectCustomMetrics is set to true.
- labelNamesToExclude contains the comma separated label names to be excluded while creating the instanced custom Prometheus metrics. This setting is applicable only when collectCustomMetrics and enableAllLabels is set to true. A default list of labels to be dropped is provided in the XML file and you can add more to this list as required.
- maxGroupNames sets the maximum number of label names allowed while creating the instanced custom Prometheus metrics. This setting is applicable only when collectCustomMetrics and enableAllLabels is set to true. The default value for this field is 3 which indicates that three levels of instanced metrics will be available.
Below is a sample CustomMetricConfig with values for each of the fields.
<CustomMetricConfig collectCustomMetrics="false" enableAllLabels="false" labelNamesToExclude="beta_kubernetes_io_os,container_label_annotation_io_kubernetes_container_hash" maxGroupNames="3">