From 240bab59a3f46241958ddcf14fad5f0f24cf2f31 Mon Sep 17 00:00:00 2001 From: Zhengda Lu Date: Thu, 5 Sep 2024 07:03:49 -0400 Subject: [PATCH] [mongo] enable inferred schema collection by default (#18502) --- mongo/assets/configuration/spec.yaml | 2 +- mongo/changelog.d/18502.added | 1 + mongo/datadog_checks/mongo/config.py | 5 ++--- mongo/datadog_checks/mongo/data/conf.yaml.example | 4 ++-- 4 files changed, 6 insertions(+), 6 deletions(-) create mode 100644 mongo/changelog.d/18502.added diff --git a/mongo/assets/configuration/spec.yaml b/mongo/assets/configuration/spec.yaml index ec160b2f1e20c..defd4a34db300 100644 --- a/mongo/assets/configuration/spec.yaml +++ b/mongo/assets/configuration/spec.yaml @@ -247,7 +247,7 @@ files: Enable collection of schemas. Requires `dbm: true`. value: type: boolean - example: false + example: true - name: collection_interval description: | Set the schemas collection interval in seconds. Each collection involves sampling documents diff --git a/mongo/changelog.d/18502.added b/mongo/changelog.d/18502.added new file mode 100644 index 0000000000000..22942c0e13fc3 --- /dev/null +++ b/mongo/changelog.d/18502.added @@ -0,0 +1 @@ +Enables MongoDB inferred schema collection by default (DBM only). diff --git a/mongo/datadog_checks/mongo/config.py b/mongo/datadog_checks/mongo/config.py index 2de39bb9a1068..78e3b9c690c87 100644 --- a/mongo/datadog_checks/mongo/config.py +++ b/mongo/datadog_checks/mongo/config.py @@ -196,9 +196,8 @@ def slow_operations(self): @property def schemas(self): enabled = False - if self.dbm_enabled is True and self._schemas_config.get('enabled') is True: - # if DBM is enabled and the schemas config is enabled, then it is enabled - # By default, schemas collection is disabled + if self.dbm_enabled is True and self._schemas_config.get('enabled') is not False: + # if DBM is enabled and the schemas config is not explicitly disabled, then it is enabled enabled = True max_collections = self._schemas_config.get('max_collections') return { diff --git a/mongo/datadog_checks/mongo/data/conf.yaml.example b/mongo/datadog_checks/mongo/data/conf.yaml.example index 52508bf2924d0..25140de02139f 100644 --- a/mongo/datadog_checks/mongo/data/conf.yaml.example +++ b/mongo/datadog_checks/mongo/data/conf.yaml.example @@ -186,10 +186,10 @@ instances: # # schemas: - ## @param enabled - boolean - optional - default: false + ## @param enabled - boolean - optional - default: true ## Enable collection of schemas. Requires `dbm: true`. # - # enabled: false + # enabled: true ## @param collection_interval - number - optional - default: 600 ## Set the schemas collection interval in seconds. Each collection involves sampling documents