Skip to content

Commit

Permalink
group size distribution test
Browse files Browse the repository at this point in the history
  • Loading branch information
Loki-Afro committed Nov 11, 2024
1 parent 1e67cf0 commit 03f7987
Showing 1 changed file with 42 additions and 0 deletions.
42 changes: 42 additions & 0 deletions ansible/roles/mongodb_query_exporter/templates/values.yml.j2
Original file line number Diff line number Diff line change
Expand Up @@ -1184,3 +1184,45 @@ aggregations:
}
}
]


- database: {{ mongodb_query_exporter_mongodb_sc_db_name }}
collection: groups
metrics:
- name: sc_groups_size_distribution_by_type
type: gauge
help: 'Group user size distribution by type'
value: count
overrideEmpty: true
emptyValue: 0
labels:
- type
constLabels:
longterm: 'true'
mode: pull
pipeline: |
[
{
"$project": {
"type": 1,
"group_size": { "$size": "$users" }
}
},
{
"$group": {
"_id": { "type": "$type", "group_size": "$group_size" },
"count": { "$sum": 1 }
}
},
{
"$project": {
"_id": 0,
"type": "$_id.type",
"group_size": "$_id.group_size",
"count": { "$toDouble": "$count" }
}
},
{
"$sort": { "type": 1, "group_size": 1 }
}
]

0 comments on commit 03f7987

Please sign in to comment.