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

Gather per collections stats in mongodb input plugin #6137

Merged
merged 1 commit into from
Jul 31, 2019

Conversation

seuf
Copy link
Contributor

@seuf seuf commented Jul 18, 2019

This PR add Mongodb input plugin per collection stats gathering.

It will discover collection in each database.
You can specify the databases you want to gather collection stats by setting the col_stats_db option.

  ## When true, collect per collection stats
  # gather_col_stats = false
  ## List of db where collections stats are collected
  ## If empty, all db are concerned
  # col_stats_dbs = ["local"]

New metrics per collections are :
mongodb_col_stats

  • tags:
    • hostname
    • collection
    • db_name
  • fields:
    • size (integer)
    • avg_obj_size (integer)
    • storage_size (integer)
    • total_index_size (integer)
    • ok (integer)
    • count (integer)
    • type (tring)

Related Issue : #5496

Required for all PRs:

  • Signed CLA. (signed a long time ago. Still valid ?)
  • Associated README.md updated.
  • Has appropriate unit tests. (no dedicated unit tests for custom gathering)

@danielnelson danielnelson added area/mongodb feat Improvement on an existing feature such as adding a new setting/mode to an existing plugin labels Jul 18, 2019
@danielnelson danielnelson added this to the 1.12.0 milestone Jul 18, 2019
@danielnelson danielnelson self-requested a review July 18, 2019 22:35
@danielnelson danielnelson merged commit ef9a1c0 into influxdata:master Jul 31, 2019
},
}, col_stat_line)
if err != nil {
log.Println("E! Error getting col stats from " + col_name + "(" + err.Error() + ")")
Copy link

@oboukili oboukili Aug 8, 2019

Choose a reason for hiding this comment

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

Shouldn't fmt.Errorf be used here to return an error and prevent further execution?

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 maybe a continue so it continues adding other (likely valid) colls

Copy link
Contributor

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.

Should we make that same change after line 162 as well?

Copy link
Contributor

Choose a reason for hiding this comment

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

Yeah, also we need to do something on 155. Probably should move this into a function.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/mongodb feat Improvement on an existing feature such as adding a new setting/mode to an existing plugin
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants