OpenTelemetry Bot d680729c09 [chore] Prepare release 0.90.0 (#29543) пре 1 година
..
internal c27d0561d9 [receiver/mongodb] add receiver.mongodb.removeDatabaseAttr Alpha feature gate (#27621) пре 1 година
testdata c27d0561d9 [receiver/mongodb] add receiver.mongodb.removeDatabaseAttr Alpha feature gate (#27621) пре 1 година
Makefile 150e3bd135 [receiver/mongodb] Add Scaffolding for MongoDB receiver (#6972) пре 3 година
README.md c27d0561d9 [receiver/mongodb] add receiver.mongodb.removeDatabaseAttr Alpha feature gate (#27621) пре 1 година
client.go f4c44858b5 [all][chore] Moved from interface{} to any for all go code (#29072) пре 1 година
client_test.go 6fae6befe6 [chore] dependabot updates Tue Nov 14 02:40:36 UTC 2023 (#29262) пре 1 година
config.go 4b935647eb [receiver/mongodb] Change the type of `Config.Password` to be `configopaque.String` (#23866) пре 1 година
config_test.go 66bac88f55 [chore] make update-otel (#24661) пре 1 година
doc.go 5133f4ccd6 [chore] use license shortform (#22052) пре 1 година
documentation.md c27d0561d9 [receiver/mongodb] add receiver.mongodb.removeDatabaseAttr Alpha feature gate (#27621) пре 1 година
factory.go 2c5577b0d7 [chore] updating scrapers to use default method from scraperhelper (#22138) пре 1 година
factory_test.go 4a0ea8e961 [chore] Improving life cycle tests reporting (#23145) пре 1 година
go.mod d680729c09 [chore] Prepare release 0.90.0 (#29543) пре 1 година
go.sum 40b485f08a Update core for v0.90.0 release (#29539) пре 1 година
integration_test.go c27d0561d9 [receiver/mongodb] add receiver.mongodb.removeDatabaseAttr Alpha feature gate (#27621) пре 1 година
metadata.yaml c27d0561d9 [receiver/mongodb] add receiver.mongodb.removeDatabaseAttr Alpha feature gate (#27621) пре 1 година
metrics.go c27d0561d9 [receiver/mongodb] add receiver.mongodb.removeDatabaseAttr Alpha feature gate (#27621) пре 1 година
scraper.go c27d0561d9 [receiver/mongodb] add receiver.mongodb.removeDatabaseAttr Alpha feature gate (#27621) пре 1 година
scraper_test.go c27d0561d9 [receiver/mongodb] add receiver.mongodb.removeDatabaseAttr Alpha feature gate (#27621) пре 1 година

README.md

MongoDB Receiver

Status
Stability beta: metrics
Distributions contrib, observiq, sumo
Issues Open issues Closed issues
Code Owners @djaglowski, @schmikei

This receiver fetches stats from a MongoDB instance using the golang mongo driver. Stats are collected via MongoDB's dbStats and serverStatus commands.

Purpose

The purpose of this receiver is to allow users to monitor metrics from standalone MongoDB clusters. This includes non-Atlas managed MongoDB Servers.

Prerequisites

This receiver supports MongoDB versions:

  • 4.0+
  • 5.0

Mongodb recommends to set up a least privilege user (LPU) with a clusterMonitor role in order to collect metrics. Please refer to lpu.sh for an example of how to configure these permissions.

Configuration

The following settings are optional:

  • hosts (default: [localhost:27017]): list of host:port or unix domain socket endpoints.
    • For standalone MongoDB deployments this is the hostname and port of the mongod instance
    • For replica sets specify the hostnames and ports of the mongod instances that are in the replica set configuration. If the replica_set field is specified, nodes will be autodiscovered.
    • For a sharded MongoDB deployment, please specify a list of the mongos hosts.
  • username: If authentication is required, the user can with clusterMonitor permissions can be provided here.
  • password: If authentication is required, the password can be provided here.
  • collection_interval: (default = 1m): This receiver collects metrics on an interval. This value must be a string readable by Golang's time.ParseDuration. Valid time units are ns, us (or µs), ms, s, m, h.
  • initial_delay (default = 1s): defines how long this receiver waits before starting.
  • replica_set: If the deployment of MongoDB is a replica set then this allows users to specify the replica set name which allows for autodiscovery of other nodes in the replica set.
  • timeout: (default = 1m) The timeout of running commands against mongo.
  • tls: (defaults defined here): TLS control. By default insecure settings are rejected and certificate verification is on.

Example Configuration

receivers:
  mongodb:
    hosts:
      - endpoint: localhost:27017
    username: otel
    password: ${env:MONGODB_PASSWORD}
    collection_interval: 60s
    initial_delay: 1s
    tls:
      insecure: true
      insecure_skip_verify: true

The full list of settings exposed for this receiver are documented here with detailed sample configurations here.

Metrics

The following metric are available with versions:

  • mongodb.extent.count < 4.4 with mmapv1 storage engine
  • mongodb.session.count >= 3.0 with wiredTiger storage engine
  • mongodb.cache.operations >= 3.0 with wiredTiger storage engine
  • mongodb.connection.count with attribute active is available >= 4.0
  • mongodb.index.access.count >= 4.0

Details about the metrics produced by this receiver can be found in metadata.yaml

Feature gate configurations

See the Collector feature gates for an overview of feature gates in the collector.

ALPHA: receiver.mongodb.removeDatabaseAttr

The feature gate receiver.mongodb.removeDatabaseAttr once enabled will remove database name attribute, because both resource and datapoint attributes are called database.

This feature gate will eventually be enabled by default, and eventually the old implementation will be removed. It aims to give users time to migrate to the new implementation. The target release for this featuregate to be enabled by default is 0.94.0.