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

Add totalsize metric in MongoDB collstats metricset #42003

Closed
2 tasks done
ishleenk17 opened this issue Dec 12, 2024 · 11 comments · Fixed by #42171
Closed
2 tasks done

Add totalsize metric in MongoDB collstats metricset #42003

ishleenk17 opened this issue Dec 12, 2024 · 11 comments · Fixed by #42171
Assignees
Labels
Team:Obs-InfraObs Label for the Observability Infrastructure Monitoring team

Comments

@ishleenk17
Copy link
Contributor

ishleenk17 commented Dec 12, 2024

Describe the enhancement:

Add the totalsize metric to mongodb collstats.
This is an important metric to report the total size of the collection.

Once this is added to the beats module, we should add the same to Integrations datastream as well.

Tasks

Preview Give feedback
  1. Team:Obs-InfraObs backport-8.17 backport-8.x enhancement
    stefans-elastic
  2. Integration:mongodb enhancement
    stefans-elastic
@botelastic botelastic bot added the needs_team Indicates that the issue/PR needs a Team:* label label Dec 12, 2024
@lalit-satapathy lalit-satapathy added the Team:Obs-InfraObs Label for the Observability Infrastructure Monitoring team label Dec 23, 2024
@botelastic botelastic bot removed the needs_team Indicates that the issue/PR needs a Team:* label label Dec 23, 2024
@ishleenk17
Copy link
Contributor Author

We should revisit all the collstats metrics as I think we should add couple other important metrics as well.
The list of the metrics available .

@stefans-elastic
Copy link
Contributor

This confuses me a bit: it looks like collstats module doesn't actually return collstats data. It return results of top command: https://github.com/elastic/beats/blob/main/metricbeat/module/mongodb/collstats/collstats.go#L79
Also if we are going to fetch collstats metrics I think we need to call collstats command on each collection (which is likely going to degrade performance of the module). Are we ok with this?

@ishleenk17
Copy link
Contributor Author

That's right, this is what I noticed as well while checking the beats code. That we are returning just the usage metrics for the collections from the top command. Listed here as well. We are not having any other metrics. Hence I pointed out we might want to revisit the complete collstats module.

Also if we are going to fetch collstats metrics I think we need to call collstats command on each collection (which is likely going to degrade performance of the module)

I think we don't have any way other than using the collstats command, is that right ?

@stefans-elastic
Copy link
Contributor

I think we don't have any way other than using the collstats command, is that right ?

That's my understanding (I haven't found any other way)

@stefans-elastic
Copy link
Contributor

@ishleenk17 I've come up with a "PoC" (kinda): eb7bbcb

If this solution makes sense I will proceed and expand it with other collStats fields

@ishleenk17
Copy link
Contributor Author

This looks fine. Thanks Stefan.
Let's come up with the most relevant list of metrics that we would like to include for collstats.

@stefans-elastic
Copy link
Contributor

I suggest:

Please let me know what do you think.

P.S. I've updated the PoC a bit (introduced WaitGroup's). I think it sould make the performance better.

@ishleenk17
Copy link
Contributor Author

The list looks good. Lets also add below two to these

max
nindexes

@stefans-elastic
Copy link
Contributor

@ishleenk17 done and PR is ready for review - #42171

@stefans-elastic
Copy link
Contributor

Note: there is CI issue with backport PR for this feature. The problem occurs when CI tries to download one of the dependencies but the site doesn't exists anymore so it fails. The problem is caused by go.opencensus.io (which is brought by github.com/dgraph-io/badger.

There should be a quick fix available shortly - it will prepopulate dependencies on CI VM (so CI doesn't have to download them). PR for quick fix is https://github.com/elastic/ci-agent-images/pull/1187. For long term solution there is issue open for getting rid of github.com/dgraph-io/badger - #42443.

@stefans-elastic
Copy link
Contributor

both beats and integrations parts are merged

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Team:Obs-InfraObs Label for the Observability Infrastructure Monitoring team
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants