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

Update Redis Enterprise to set tls_verify to true by default in check code (ECOINT-109) #2607

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions redis_enterprise/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# CHANGELOG - Redis Enterprise

## 2.0.0 / 2025-02-21

***Changed***:

* Update `tls_verify` handling in check code to ensure default is set to 'False'

## 1.1.1 / 2025-01-21

***Changed***:
Expand Down
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = '1.1.1'
__version__ = '2.0.0'
2 changes: 2 additions & 0 deletions redis_enterprise/datadog_checks/redis_enterprise/check.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ def __init__(self, name, init_config, instances):
def _parse_config(self):
self.scraper_configs = []
metrics_endpoint = self.instance.get('openmetrics_endpoint')
tls_verify = self.instance.get("tls_verify", False)
metrics = self.get_default_config()

additional = []
Expand Down Expand Up @@ -46,6 +47,7 @@ def _parse_config(self):
'namespace': self.__NAMESPACE__,
'metrics': metrics,
'metadata_label_map': {'version': 'version'},
'tls_verify': tls_verify,
}

config.update(self.instance)
Expand Down
2 changes: 2 additions & 0 deletions redis_enterprise/tests/support.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@

ERSATZ_INSTANCE = {'openmetrics_endpoint': "https://localhost:8071/metrics", 'tags': ['instance']}

SSL_INSTANCE = {"openmetrics_endpoint": "https://localhost:8071/metrics", "tls_verify": True}

EPHEMERAL = [
"rdse.bdb_avg_latency",
"rdse.bdb_avg_latency_max",
Expand Down
15 changes: 14 additions & 1 deletion redis_enterprise/tests/test_redis_enterprise.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
# from datadog_checks.dev.utils import get_metadata_metrics
from datadog_checks.redis_enterprise.check import RedisEnterpriseCheck

from .support import CHECK, DEFAULT_METRICS, EPHEMERAL, ERSATZ_INSTANCE, INSTANCE, METRICS_MAP
from .support import CHECK, DEFAULT_METRICS, EPHEMERAL, ERSATZ_INSTANCE, INSTANCE, METRICS_MAP, SSL_INSTANCE

ssl._create_default_https_context = ssl._create_unverified_context

Expand Down Expand Up @@ -116,3 +116,16 @@ def test_invalid_instance(aggregator, dd_run_check, mock_http_response):
assert True

aggregator.assert_service_check(f'{RedisEnterpriseCheck.__NAMESPACE__}.node_imaginary', count=0)


@pytest.mark.unit
def test_invalid_ssl_instance(aggregator, dd_run_check, mock_http_response):
# Create instance without tls_verify
instance = deepcopy(SSL_INSTANCE)
instance.pop('tls_verify') # Simulating missing tls_verify in config

check = RedisEnterpriseCheck(CHECK, {}, [instance])
dd_run_check(check)

# Ensure tls_verify defaults to False
assert check.scraper_configs[0]["tls_verify"] is False, "tls_verify should default to False"
Loading