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 Mongodb Standalone, Sharded, Replica Set Metric Scraper #6951

Closed

Conversation

schmikei
Copy link
Contributor

Description:
Adds a new receiver mongodb. This receiver is intended to collect metrics from standalone, replica set, and sharded deployments of mongo.

I am open to potential renames as to differentiate further from the current mongodb as a service(atlas) receiver if we feel necessary or is too ambiguous.

Pre-requisites:

If authentication is enabled, a clusterMonitor user so that proper commands can be authenticated to collect metrics. There may be plans to extend authentication options but this appears to be the most common approach to authentication if necessary.

This is generally accomplished(at least for mongodb >3.0) via a command like

db.createUser({
  "user": "monitor-user",
  "pwd": "$MONITOR_USER_PASSWORD",
  "roles": [
    { role: "clusterMonitor", db: "admin" },
  ]
})

Configuration

Example:

receivers:
  mongodb:
    hosts: 
      - localhost:27017
    username: otel
    password: $MONGO_PASSWORD
    collection_interval: 10s

This is accomplished via the mongo-go-driver driver which supports back to mongo server versions >2.6.

Current proposed list of metrics:

Metric Description Type Unit Label(s)
cache.operations The number of cache operations. monotonic sum 1{.operations} type (hits, misses)
collections The number of collections. non-monotomic sum 1 database
connections The number of active server connections. non-monotomic sum 1 database,connection_type
data.size The size in bytes of the collection. Data compression does not affect this value. non-monotomic sum By database
extents The number of extents. (only available on mongo versions <=4.2) non-monotomic sum 1 database
global_lock.hold The time the global lock has been held. monotonic sum ms  
index.countindexes The number of indexes. non-monotomic sum 1 database
index.size The sum of the space allocated to all indexes in the database, including free index space. non-monotonic sum   database
memory.usage The amount of memory used. non-monotonic sum By database, type (resident, virtual, mapped, mappedWithJournal)
objects The number of objects. non-monotomic sum 1 database
operations The number of operations executed. monotonic sum 1{.operations} operation
storage.size The total amount of storage in bytes allocated to this collection for document storage. If collection data is compressed it reflects the compressed size. non-monotomic sum By database

Link to tracking Issue:

Testing:

Integration tests/unit tests

Tested manually against mongo 5.0, 4.4, and 4.0 expect to continue testing while this is reviewed up to earliest version that the mongo-driver supports 2.6

Documentation:

Documentation added specifies the metrics collected and configuration. This is autogenerated via the metadata.yml

@linux-foundation-easycla
Copy link

linux-foundation-easycla bot commented Dec 27, 2021

CLA Signed

The committers are authorized under a signed CLA.

@jpkrohling jpkrohling added the Sponsor Needed New component seeking sponsor label Dec 27, 2021
@jpkrohling
Copy link
Member

@schmikei, could you please go over #6926 confirm you have what's listed there?

@schmikei
Copy link
Contributor Author

@jpkrohling Thanks! This was my first attempt at drafting up a contribution. That issue seems super helpful on how to proceed 🚀

Plan on breaking up this PR soonish to follow those guidelines more closely! Will still need to find a proper way to get a sponsor. Will look into it a bit more and come back.

@schmikei schmikei closed this Dec 27, 2021
@jpkrohling
Copy link
Member

If you don't have a sponsor yet, let me know and I'll ping the approvers to see if anyone is interested.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Sponsor Needed New component seeking sponsor
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants