metric_prefix: Each metric starts with the chosen prefix.
query: This is the Mongo runCommand query to execute as a JSON object. Note: The Agent only supports count, find, and aggregates queries.
database: This is the MongoDB database to collect metrics from.
fields: Ignored for count queries. This is a list representing each field with no specific order. Ignores unspecified and missing fields. There are three required pieces of data for each fields:
field_name: This is the name of the field from which to fetch the data.
name: This is the suffix to append to the metric_prefix to form the full metric name. If type is tag, this column is treated as a tag and applied to every metric collected by this particular query.
type: This is the submission method (gauge, count, rate, and more). This can also be set to tag to tag each metric in the row with the name and value of the item in this column. You can use the count type to perform aggregation for queries that return multiple rows with the same or no tags.
tags: A list of tags to apply to each metric (as specified above).
count_type: For count queries only, this is the submission method (gauge, count, rate, and more) of the count result. Ignored for non-count queries.
This would emit one gauge metric mongo.example3.user.age with two tags: is_admin:true and is_admin:false representing the average age of users for each tags.