-
Notifications
You must be signed in to change notification settings - Fork 242
Document new core Prometheus Exporter #1154
Description
In the 4.1 release, the ability to export Graylog Dropwizard metrics to Prometheus is being added to the core open-source product in Graylog2/graylog2-server#10767. This works similarly to the existing Graylog Cloud server-side prometheus metrics exporting, except it allows the mappings between the Dropwizard and Prometheus metrics to be customized at runtime in a yaml file.
Expected Content
- Add the new configuration parameters to the server.conf docs page.
- Add a new page or section that describes the minimum details needed to understand, enable, and use the feature. There is no need to explain how to set up Prometheus. However, we should explain how to define the individual mappings.
Functionality Description
The configuration properties described in the server.conf file can be used to enable and customize the feature.
This Prometheus exporter heavily uses Prometheus metric labels to consolidate individual traditional Graylog Dropwizard metrics in to a combined metric with labels, which make it easer to view and analyze similar metrics together.
The initial export mappings are described here in prometheus-exporter.yml. Essentially, this is a mapping between Dropwizard metric names (wildcard patterns) and prometheus export names. The matching patterns are described in detail here.
The following example definition uses most of the export, mapping and labels functionality, note the metric_name and metric_pattern. All metrics exported to Prometheus will have the gl_ prefix appended to the name. So, the name in the below example will result as gl_auth_actions.
- metric_name: "auth_actions"
match_pattern: "org.graylog.plugins.cloud.auth.*.failure.http.*"
wildcard_extract_labels:
- "action"
- "http_code"
additional_labels:
success: "false"
type: "http"
The wildcard_extract_labels are an ordered sequence of label names to extract for the wildcard asterisks * that appear in the metric name. One label value for each value in place of the wildcard will be created.
For example, for the definition above, the following metric would produce the following labels:
metric: org.graylog.plugins.cloud.auth.tokenRequest.failure.http.500
label: action: tokenRequest
label: action: http_code: 500
The success and type labels are static labels.
Note that all metrics will automatically be assigned a node_id label with the value of the Graylog node id that the metric was exported from. This makes it easy to visualize metrics across Graylog nodes together, and also see which values are coming from which node.
I hope this explanation helps, but perhaps the best way to see how to definitions work is to use the exporter for some known metrics and map them to prometheus metrics and various labels to see what the output looks like.
I am not exactly sure how much detail we should go into in the documentation, since to use this feature, the user probably already knows Prometheus fairly well.
To test this functionality, the instructions to starting a Prometheus instance in Docker can be used:
https://docs.graylog.org/en/4.0/pages/enterprise/cloud_forwarder.html#prometheus-metrics-exports