Skip to content
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

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

Nitesh-vaidyanath
Copy link

@Nitesh-vaidyanath Nitesh-vaidyanath commented Dec 26, 2023

PR Description

Which issue(s) this PR fixes

Notes to the Reviewer

PR Checklist

  • CHANGELOG.md updated
  • Documentation added
  • Tests updated
  • [] Config converters updated

@CLAassistant
Copy link

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.


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
Copy link
Contributor

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,
Copy link
Contributor

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).

Copy link
Author

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.

Copy link
Contributor

@marctc marctc Jan 3, 2024

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 ).

Copy link
Author

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.

Copy link
Contributor

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?

Copy link
Contributor

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.

Copy link
Author

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
Copy link
Contributor

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.

Copy link
Author

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.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor

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)
Copy link
Contributor

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.

Copy link
Contributor

@marctc marctc left a 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.

Copy link
Contributor

This PR has not had any activity in the past 30 days, so the needs-attention label has been added to it.
If you do not have enough time to follow up on this PR or you think it's no longer relevant, consider closing it.
The needs-attention label signals to maintainers that something has fallen through the cracks. No action is needed by you; your PR will be kept open and you do not have to respond to this comment. The label will be removed the next time this job runs if there is new activity.
Thank you for your contributions!

@github-actions github-actions bot added the needs-attention An issue or PR has been sitting around and needs attention. label Feb 10, 2024
@tpaschalis
Copy link
Member

@Nitesh-vaidyanath I think we're on a good path, do you have the time to address @marctc's feedback here?

Copy link
Contributor

@clayton-cornell clayton-cornell left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some doc input

Comment on lines +42 to +47
| `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 |
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
| `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 |

Comment on lines +97 to +107
# 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
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
# 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)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
- 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

@github-actions github-actions bot removed the needs-attention An issue or PR has been sitting around and needs attention. label Feb 23, 2024
@rfratto rfratto added variant/static Related to Grafana Agent Static. variant/flow Relatd to Grafana Agent Flow. enhancement New feature or request labels Apr 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request variant/flow Relatd to Grafana Agent Flow. variant/static Related to Grafana Agent Static.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants