Skip to content

Add support of extra mongodb collstats metrics - #12407

Merged
stefans-elastic merged 0 commit into
elastic:mainfrom
stefans-elastic:mongo-collstats
Jan 30, 2025
Merged

Add support of extra mongodb collstats metrics#12407
stefans-elastic merged 0 commit into
elastic:mainfrom
stefans-elastic:mongo-collstats

Conversation

@stefans-elastic

@stefans-elastic stefans-elastic commented Jan 21, 2025

Copy link
Copy Markdown
Contributor

Proposed commit message

Add support of extra mongodb collstats metrics (size, count, avgObjSize, storageSize, totalIndexSize, totalSize, max, nindexes)

Checklist

  • I have reviewed tips for building integrations and this pull request is aligned with them.
  • I have verified that all data streams collect metrics or logs.
  • I have added an entry to my package's changelog.yml file.
  • I have verified that Kibana version constraints are current according to guidelines.
  • I have verified that any added dashboard complies with Kibana's Dashboard good practices

Author's Checklist

  • [ ]

How to test this PR locally

Related issues

Screenshots

Screenshot 2025-01-21 at 1 32 08 PM
@stefans-elastic stefans-elastic added enhancement New feature or request Team:Obs-InfraObs Observability Infrastructure Monitoring team [elastic/obs-infraobs-integrations] labels Jan 21, 2025
@stefans-elastic stefans-elastic self-assigned this Jan 21, 2025
@elastic-vault-github-plugin-prod

Copy link
Copy Markdown
Contributor

🚀 Benchmarks report

To see the full report comment with /test benchmark fullreport

@stefans-elastic
stefans-elastic marked this pull request as ready for review January 21, 2025 13:01
@stefans-elastic
stefans-elastic requested a review from a team as a code owner January 21, 2025 13:01
@ghost

ghost commented Jan 21, 2025

Copy link
Copy Markdown

@stefans-elastic not sure in which release this feature ended up in metricbeat but you will have to bump the kibana version to that one.

Comment on lines 128 to 131

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

You could add metric_type: gauge and unit: byte. Also field namings could be improved check naming conventions: https://www.elastic.co/guide/en/beats/devguide/current/event-conventions.html

@stefans-elastic stefans-elastic Jan 22, 2025

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

You could add metric_type: gauge and unit: byte.

is this only for stats.storageSize property?

Also field namings could be improved

don't names have to be the same as they are in beats? Also the names match naming of the fields returned by mongo's collstats command - https://www.mongodb.com/docs/manual/reference/command/collStats/#output

@stefans-elastic

Copy link
Copy Markdown
Contributor Author

@stefans-elastic not sure in which release this feature ended up in metricbeat but you will have to bump the kibana version to that one.

I don't think beats part got released already (maybe I didn't need to be so quick with this PR. Do you think I should move this PR to Draft until beats gets a new release?

@shmsr shmsr changed the title add support of extra mongodb collstats metrics Jan 21, 2025
@shmsr

shmsr commented Jan 21, 2025

Copy link
Copy Markdown
Member

@stefans-elastic not sure in which release this feature ended up in metricbeat but you will have to bump the kibana version to that one.

I don't think beats part got released already (maybe I didn't need to be so quick with this PR. Do you think I should move this PR to Draft until beats gets a new release?

@stefans-elastic Your changes will be able in next minor release of beats i.e., 8.18. So, if you set kibana.version in top-level manifest.yml correctly, then you can also merge it now. This change will only be available when some user installs the 8.18 or above stack; and should choose to install this specific version of package.

@shmsr

shmsr commented Jan 21, 2025

Copy link
Copy Markdown
Member

Can we add a commit message in the PR description to maintain PR hygiene?

Comment thread packages/mongodb/changelog.yml Outdated
Comment thread packages/mongodb/data_stream/collstats/fields/fields.yml Outdated
Comment thread packages/mongodb/manifest.yml Outdated
@ishleenk17

Copy link
Copy Markdown
Member

@stefans-elastic not sure in which release this feature ended up in metricbeat but you will have to bump the kibana version to that one.

I don't think beats part got released already (maybe I didn't need to be so quick with this PR. Do you think I should move this PR to Draft until beats gets a new release?

8.18 release is quite late.
We can backport it to 8.17.x as well and then we will be able to merge this PR sometime next month.

@stefans-elastic

Copy link
Copy Markdown
Contributor Author

@stefans-elastic not sure in which release this feature ended up in metricbeat but you will have to bump the kibana version to that one.

I don't think beats part got released already (maybe I didn't need to be so quick with this PR. Do you think I should move this PR to Draft until beats gets a new release?

8.18 release is quite late. We can backport it to 8.17.x as well and then we will be able to merge this PR sometime next month.

trying to backport to 8.17 (elastic/beats#42358). I think we should be able to include this in 8.17.2 release

Comment thread packages/mongodb/changelog.yml Outdated

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

From working on #12070 I learned that I should append -next to version (in my understanding it's needed in case stack version isn't released yet)

@jsoriano jsoriano Jan 22, 2025

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Appending the -next version is an approach that can be used to merge a change without publishing a version. This can be used to delay the decision on publishing a package, for example if a set of related changes are introduced on different PRs.

This is not linked to the stack version, a package can be published for an stack version that doesn't exist yet.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

thank you for clarification @jsoriano

I think I don't need -next in this PR in this case, right?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Looking to the changes, and seeing that they include support for 9.0, I would not use -next, but I would still use a prerelease tag by now, given that 9.0 is not GA yet.

Regarding the support for 9.0, I think you should mention it in the changelog too, and maybe bring to a different PR.

Comment thread packages/mongodb/manifest.yml Outdated

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I've noticed that quite a few packages have || ^9.0.0 in the condition. Correct me if we don't need it in this package

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Why do you need to increase the version from 8.13 to 8.17?

Even if the new fields are only available from 8.17, they probably don't do any harm on 8.13, and this way you can more easily keep maintaining support for versions from 8.13 to 8.17.

Correct me if we don't need it in this package

This will be needed, yes. Though, you can consider splitting this PR in two, one for the new fields, and another one for 9.0 support.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I've noticed that quite a few packages have || ^9.0.0 in the condition. Correct me if we don't need it in this package

We are doing a bulk change of adding support of 9.0.0 . So you can remove that from this PR.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Even if the new fields are only available from 8.17, they probably don't do any harm on 8.13, and this way you can more easily keep maintaining support for versions from 8.13 to 8.17.

@jsoriano : In case we don't upgrade to 8.17.2, we will have new fields which actually don't exist for stack version lower than this but will still be shown in the README of the Integration. The user sitting on 8.13 might then also expect those fields which can't be supported. WDYT ?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

We are doing a bulk change of adding support of 9.0.0 . So you can remove that from this PR.

removed 9.0.0 from the PR

@stefans-elastic

Copy link
Copy Markdown
Contributor Author

Can we add a commit message in the PR description to maintain PR hygiene?

added

Comment thread packages/mongodb/manifest.yml Outdated

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

It's not allowed to publish "next" versions.

I cannot find the documentation, now but it was here the steps previously
https://github.com/elastic/integrations/pull/9796/files#diff-7b9748c4f848852d8b40b331e43f9fd58560e923d065183d0eb3e5916d831c9bL146

Should it be set again to 1.16.0 here (keeping the changelog "-next" entry)? @ishleenk17 @jsoriano

@mrodm mrodm Jan 22, 2025

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

The same happened in this PR #12407

That new version of the "iis" package was not published, since it is not allowed to publish "-next" versions.

Maybe you would need to update the manifest also for that other package ("iis" package).

WDYT ? @ishleenk17 @jsoriano

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

It should be possible to use the -next suffix. This is useful to introduce changes without releasing a package version.

I have reopened https://github.com/elastic/package-storage-infra/issues/394 to review the implementation of the process.

As workaround, yes, I think it should be possible to keep the current version here.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

to clarify: in manifest it should be 1.16.0 and in changelog it should be 1.17.0-next, right?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Wait, we are trying a quick fix on the storage infra side so these packages are fully ignored and not published.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

If we use next in this PR and merge it. I don't think we will be able to publish any other change to the mongodb package until this change is published.
There are other mongodb changes ongoing in parallel which would be merged soon.
So, IMO lets wait to push this PR until release of 8.17.2.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I've removed -next

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Why does this change need 8.17.2? It is only adding support for more fields, it should be safe to use in older versions.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

@stefans-elastic : Lets keep the version as 8.13.
We should figure out a way to depict in the fields on how to showcase that a particular set of fields are available only from 8.17.2 onwards.
But the kibana version can remain unchanged.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

@stefans-elastic

Copy link
Copy Markdown
Contributor Author

since the PR in beats to backport this to 8.17 has been finally merged I think it is safe to assume the feature is going to be available in 8.17.2. So I think we can go ahead and approve/merge this PR (I'm pretty sure I've addressed all PR comments. If you notice something I haven't addressed - please let me know). WDYT?

@elasticmachine

Copy link
Copy Markdown

💚 Build Succeeded

History

  • 💚 Build #20851 succeeded 25ff1e0114e4fa07d4033bdc558d6d00797a8bd8
  • 💔 Build #20840 failed 09a1f18d6697de22d75497a9a3606546f4b0508a
  • 💔 Build #20804 failed f8a682b5e05d2d61b3e46e28d9eab756c316522c
  • 💚 Build #20709 succeeded 61a706d5506e653e35127e5b3c984bfa7c094daf

cc @stefans-elastic

@ishleenk17 ishleenk17 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Looks good!

@stefans-elastic
stefans-elastic merged this pull request into elastic:main Jan 30, 2025
@stefans-elastic
stefans-elastic deleted the mongo-collstats branch January 30, 2025 10:05
@elastic-vault-github-plugin-prod

Copy link
Copy Markdown
Contributor

Package mongodb - 1.17.0 containing this change is available at https://epr.elastic.co/package/mongodb/1.17.0/

harnish-crest-data pushed a commit to chavdaharnish/integrations that referenced this pull request Feb 4, 2025
* add support of extra mongodb collstats metrics

* update PR id in changelog.yml

* remove stats. from collstats fields declaration

* fix mongodb package version and kibana version

* remove '-next' from version, remove kibana 9.0.0 from the condition

* fix syntax error in changelog.yml

* revert kibana vertion change in manifest.yml (back to 8.13.0)
harnish-crest-data pushed a commit to chavdaharnish/integrations that referenced this pull request Feb 5, 2025
* add support of extra mongodb collstats metrics

* update PR id in changelog.yml

* remove stats. from collstats fields declaration

* fix mongodb package version and kibana version

* remove '-next' from version, remove kibana 9.0.0 from the condition

* fix syntax error in changelog.yml

* revert kibana vertion change in manifest.yml (back to 8.13.0)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request Integration:mongodb MongoDB Team:Obs-InfraObs Observability Infrastructure Monitoring team [elastic/obs-infraobs-integrations]

7 participants