-
Notifications
You must be signed in to change notification settings - Fork 486
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Adding more option to enable required mongo stats to monito #6021
base: main
Are you sure you want to change the base?
Conversation
Nitesh Vaidyanath seems not to be a GitHub user. You need a GitHub account to be able to sign the CLA. If you have already a GitHub account, please add the email address used for this commit to your account. You have signed the CLA already but the status is still pending? Let us recheck it. |
} | ||
|
||
var collectAll = true |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there any reason to make this variable global?
@@ -17,15 +17,29 @@ import ( | |||
|
|||
var DefaultConfig = Config{ | |||
DirectConnect: true, | |||
EnableDBStats: false, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
wouldn't be better to have all of this enabled by default instead of setting them to true later (from line 92).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When collectAll is enabled all the stats are enabled by default. If someone wants to enable specific stats they can just enable that flag, which in turn disables collectAll.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe I'm missing something, but I still don't understand why these flags are not enabled by default and we need a collectAll
variable (which is true by default ).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah it is bit confussing but setting collectAll to true and enabling all other other flags doesn't make any differnce. In the comment i added for the sake of understanding, collectAll=ture is equaliant to enabling all the other flags however, if we enable any one or more flags it will diasable collectAll and other flags too.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If it's confusing for you, it will be confusing for the rest of users. Would you mind refactor the configuration to be easier to understand?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think I understand the point that, because CollectAll
was hardcoded to true
, the new flags won't have any effect unless we expose the flag and users manually disable it.
In order to mirror the actual collector's logic as closely as possible and avoid misunderstanding from users, I would suggest fully exposing CollectAll
as a new flag, and setting it to true
in DefaultConfig
(as @marctc suggested).
Rationale: most users won't need that level of granularity, but if they do, they can disable CollectAll
and set each desired flag individually.
We should also make sure that we are exposing all the flags that would be enabled by CollectAll
(afaik we are missing some).
This is also a potential argument for not exposing any flags at all: if the collector dependency is updated and some new flags are added and missed as part of the update, users who manually set the list of collectors to enable may miss the new ones, so there is some maintenance cost involved in providing such level of granularity.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let me refactor and push my changes.
@@ -79,6 +79,34 @@ Besides that, there's not much to configure. Please refer to the full reference | |||
# MongoDB node connection URL, which must be in the [`Standard Connection String Format`](https://docs.mongodb.com/manual/reference/connection-string/#std-label-connections-standard-connection-string-format) | |||
[mongodb_uri: <string>] | |||
|
|||
# By default all the below stats will be |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This explanation should be also added to flow component doc. But if we change the default behavior, we can remove them altogether.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @marctc, there is no change in default behavior. I have just added more configurable parameter.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes i have already added this to docs/sources/flow/reference/components/prometheus.exporter.mongodb.md
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
By default behavior I meant my comment in https://github.com/grafana/agent/pull/6021/files#r1437078040. The component docs specifies that those flags are disabled by default but then the code does the opposite (as it reflected here).
@@ -2317,6 +2317,8 @@ v0.24.0 (2022-04-07) | |||
|
|||
### Features | |||
|
|||
- Adding more option to enable required mongo stats to monitor. (@Nitesh-vaidyanath) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This changelog entry is placed in a old release section. Please, move it to unreleased section.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please see comments. Once comments are addressed the PR would be ready to be merged.
This PR has not had any activity in the past 30 days, so the |
@Nitesh-vaidyanath I think we're on a good path, do you have the time to address @marctc's feedback here? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some doc input
| `enable_db_stats` | `boolean` | Enable mongo database stats | false | no | | ||
| `enable_diagnostic_data` | `boolean` | Enable mongo diagonstic data | false | no | | ||
| `enable_replicaset_status` | `boolean` | Enable mongo replica set status stats | false | no | | ||
| `enable_top_metrics` | `boolean` | Enable mongo top metrics | false | no | | ||
| `enable_index_stats` | `boolean` | Enable mongo index stats | false | no | | ||
| `enable_coll_stats` | `boolean` | Enable mongo collection stats | false | no | |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| `enable_db_stats` | `boolean` | Enable mongo database stats | false | no | | |
| `enable_diagnostic_data` | `boolean` | Enable mongo diagonstic data | false | no | | |
| `enable_replicaset_status` | `boolean` | Enable mongo replica set status stats | false | no | | |
| `enable_top_metrics` | `boolean` | Enable mongo top metrics | false | no | | |
| `enable_index_stats` | `boolean` | Enable mongo index stats | false | no | | |
| `enable_coll_stats` | `boolean` | Enable mongo collection stats | false | no | | |
| `enable_db_stats` | `boolean` | Enable MongoDB database statistics. | false | no | | |
| `enable_diagnostic_data` | `boolean` | Enable MongoDB diagnostic data. | false | no | | |
| `enable_replicaset_status` | `boolean` | Enable MongoDB replica set status statistics. | false | no | | |
| `enable_top_metrics` | `boolean` | Enable MongoDB top metrics. | false | no | | |
| `enable_index_stats` | `boolean` | Enable MongoDB index statistics. | false | no | | |
| `enable_coll_stats` | `boolean` | Enable MongoDB collection statistics. | false | no | |
# Mongo exporter variable EnableDBStats | ||
[enable_db_stats: <boolean> | default = false] | ||
# Mongo exporter variable EnableDiagnosticData | ||
[enable_diagnostic_data: <boolean> | default = false] | ||
# Mongo exporter variable EnableReplicasetStatus | ||
[enable_replicaset_status: <boolean> | default = false] | ||
# Mongo exporter variable EnableTopMetrics | ||
[enable_top_metrics: <boolean> | default = false] | ||
# Mongo exporter variable EnableIndexStats | ||
[enable_index_stats: <boolean> | default = false] | ||
# Mongo exporter variable EnableCollStats |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
# Mongo exporter variable EnableDBStats | |
[enable_db_stats: <boolean> | default = false] | |
# Mongo exporter variable EnableDiagnosticData | |
[enable_diagnostic_data: <boolean> | default = false] | |
# Mongo exporter variable EnableReplicasetStatus | |
[enable_replicaset_status: <boolean> | default = false] | |
# Mongo exporter variable EnableTopMetrics | |
[enable_top_metrics: <boolean> | default = false] | |
# Mongo exporter variable EnableIndexStats | |
[enable_index_stats: <boolean> | default = false] | |
# Mongo exporter variable EnableCollStats | |
# MongoDB exporter variable EnableDBStats | |
[enable_db_stats: <boolean> | default = false] | |
# MongoDB exporter variable EnableDiagnosticData | |
[enable_diagnostic_data: <boolean> | default = false] | |
# MongoDB exporter variable EnableReplicasetStatus | |
[enable_replicaset_status: <boolean> | default = false] | |
# MongoDB exporter variable EnableTopMetrics | |
[enable_top_metrics: <boolean> | default = false] | |
# MongoDB exporter variable EnableIndexStats | |
[enable_index_stats: <boolean> | default = false] | |
# MongoDB exporter variable EnableCollStats |
@@ -2317,6 +2317,8 @@ v0.24.0 (2022-04-07) | |||
|
|||
### Features | |||
|
|||
- Adding more option to enable required mongo stats to monitor. (@Nitesh-vaidyanath) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- Adding more option to enable required mongo stats to monitor. (@Nitesh-vaidyanath) | |
- Adding more option to enable required MongoDB stats to monitor. (@Nitesh-vaidyanath) |
We also need to correct the MongoDB name to match their product name/capitalization
PR Description
Which issue(s) this PR fixes
Notes to the Reviewer
PR Checklist