Skip to content

Commit

Permalink
BC-8360 - move uniique user Logins to longter, cache Improvments
Browse files Browse the repository at this point in the history
  • Loading branch information
mamutmk5 authored Nov 5, 2024
1 parent 3ba164b commit 67f5ca8
Showing 1 changed file with 157 additions and 15 deletions.
172 changes: 157 additions & 15 deletions ansible/roles/mongodb_query_exporter/templates/values.yml.j2
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,11 @@ aggregations:
overrideEmpty: true
emptyValue: 0
labels: []
constLabels: [{"mongodb_collection": "schools"}]
constLabels:
mongodb_collection: schools
longterm: 'true'
mode: pull
cache: 5m
pipeline: |
[
{"$count":"count"}
Expand All @@ -34,8 +37,11 @@ aggregations:
overrideEmpty: true
emptyValue: 0
labels: []
constLabels: [{"mongodb_collection": "accounts"}]
mode: pull
constLabels:
mongodb_collection: accounts
longterm: 'true'
mode:
cache: 1m
pipeline: |
[
{"$count":"count"}
Expand All @@ -51,8 +57,11 @@ aggregations:
overrideEmpty: true
emptyValue: 0
labels: []
constLabels: [{"mongodb_collection": "accounts"}]
constLabels:
mongodb_collection: accounts
longterm: 'true'
mode: pull
cache: 1m
pipeline: |
[
{
Expand Down Expand Up @@ -82,8 +91,11 @@ aggregations:
overrideEmpty: true
emptyValue: 0
labels: []
constLabels: [{"mongodb_collection": "accounts"}]
constLabels:
mongodb_collection: accounts
longterm: 'true'
mode: pull
cache: 5m
pipeline: |
[
{
Expand Down Expand Up @@ -113,8 +125,11 @@ aggregations:
overrideEmpty: true
emptyValue: 0
labels: []
constLabels: [{"mongodb_collection": "accounts"}]
constLabels:
mongodb_collection: accounts
longterm: 'true'
mode: pull
cache: 5m
pipeline: |
[
{
Expand All @@ -134,6 +149,74 @@ aggregations:
}
]

- database: {{ mongodb_query_exporter_mongodb_sc_db_name }}
collection: accounts
metrics:
- name: sc_unique_logins_last_28d
type: gauge
help: 'The number of unique user logins in the last 28 days.'
value: count
overrideEmpty: true
emptyValue: 0
labels: []
constLabels:
mongodb_collection: accounts
longterm: 'true'
mode: pull
cache: 5m
pipeline: |
[
{
"$match": {
"$expr": {
"$gte": [
"$lastLogin",
{
"$subtract": ["$$NOW", 2419200000]
}
]
}
}
},
{
"$count": "count"
}
]

- database: {{ mongodb_query_exporter_mongodb_sc_db_name }}
collection: accounts
metrics:
- name: sc_unique_logins_last_29d
type: gauge
help: 'The number of unique user logins in the last 29 days.'
value: count
overrideEmpty: true
emptyValue: 0
labels: []
constLabels:
mongodb_collection: accounts
longterm: 'true'
mode: pull
cache: 5m
pipeline: |
[
{
"$match": {
"$expr": {
"$gte": [
"$lastLogin",
{
"$subtract": ["$$NOW", 2505600000]
}
]
}
}
},
{
"$count": "count"
}
]

- database: {{ mongodb_query_exporter_mongodb_sc_db_name }}
collection: accounts
metrics:
Expand All @@ -144,8 +227,11 @@ aggregations:
overrideEmpty: true
emptyValue: 0
labels: []
constLabels: [{"mongodb_collection": "accounts"}]
constLabels:
mongodb_collection: accounts
longterm: 'true'
mode: pull
cache: 5m
pipeline: |
[
{
Expand All @@ -165,6 +251,40 @@ aggregations:
}
]

- database: {{ mongodb_query_exporter_mongodb_sc_db_name }}
collection: accounts
metrics:
- name: sc_unique_logins_last_31d
type: gauge
help: 'The number of unique user logins in the last 31 days.'
value: count
overrideEmpty: true
emptyValue: 0
labels: []
constLabels:
mongodb_collection: accounts
longterm: 'true'
mode: pull
cache: 5m
pipeline: |
[
{
"$match": {
"$expr": {
"$gte": [
"$lastLogin",
{
"$subtract": ["$$NOW", 2678400000]
}
]
}
}
},
{
"$count": "count"
}
]

- database: {{ mongodb_query_exporter_mongodb_sc_db_name }}
collection: accounts
metrics:
Expand All @@ -175,8 +295,11 @@ aggregations:
overrideEmpty: true
emptyValue: 0
labels: []
constLabels: [{"mongodb_collection": "accounts"}]
constLabels:
mongodb_collection: accounts
longterm: 'true'
mode: pull
cache: 5m
pipeline: |
[
{
Expand Down Expand Up @@ -206,8 +329,11 @@ aggregations:
overrideEmpty: true
emptyValue: 0
labels: []
constLabels: [{"mongodb_collection": "accounts"}]
constLabels:
mongodb_collection: accounts
longterm: 'true'
mode: pull
cache: 5m
pipeline: |
[
{
Expand Down Expand Up @@ -237,8 +363,11 @@ aggregations:
overrideEmpty: true
emptyValue: 0
labels: []
constLabels: [{"mongodb_collection": "users"}]
constLabels:
mongodb_collection: users
longterm: 'true'
mode: pull
cache: 5m
pipeline: |
[
{"$count":"count"}
Expand All @@ -253,8 +382,11 @@ aggregations:
overrideEmpty: true
emptyValue: 0
labels: []
constLabels: [{"mongodb_collection": "users"}]
constLabels:
mongodb_collection: users
longterm: 'true'
mode: pull
cache: 5m
pipeline: |
[
{
Expand All @@ -276,8 +408,11 @@ aggregations:
overrideEmpty: true
emptyValue: 0
labels: []
constLabels: [{"mongodb_collection": "users"}]
constLabels:
mongodb_collection: users
longterm: 'true'
mode: pull
cache: 5m
pipeline: |
[
{
Expand All @@ -299,8 +434,11 @@ aggregations:
overrideEmpty: true
emptyValue: 0
labels: []
constLabels: [{"mongodb_collection": "users"}]
constLabels:
mongodb_collection: users
longterm: 'true'
mode: pull
cache: 5m
pipeline: |
[
{
Expand All @@ -323,7 +461,9 @@ aggregations:
overrideEmpty: true
emptyValue: 0
labels: []
constLabels: [{"mongodb_collection": "classes"}]
constLabels:
mongodb_collection: classes
longterm: 'true'
mode: pull
pipeline: |
[
Expand All @@ -339,7 +479,9 @@ aggregations:
overrideEmpty: true
emptyValue: 0
labels: []
constLabels: [{"mongodb_collection": "courses"}]
constLabels:
mongodb_collection: courses
longterm: 'true'
mode: pull
pipeline: |
[
Expand Down

0 comments on commit 67f5ca8

Please sign in to comment.