Skip to content

Commit 06dc694

Browse files
mwdd146980claude
andauthored
Fix traefik_mesh: version metadata never submitted due to get_version() TypeError (DataDog#23435)
* Fix traefik_mesh get_version() unused url parameter Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * Add changelog for traefik_mesh get_version fix Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * Add test_get_version to catch get_version() TypeError bug Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com> * Fix changelog filename to match PR DataDog#23435 Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com> * Use dd_run_check + assert_metadata in test_get_version Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com> * Fix ruff 0.11.10 formatting: split long call arguments Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 6861a0b commit 06dc694

3 files changed

Lines changed: 33 additions & 1 deletion

File tree

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Fix `get_version()` signature so version metadata is actually submitted.

traefik_mesh/datadog_checks/traefik_mesh/check.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ def get_mesh_ready_status(self):
8484

8585
return node_status
8686

87-
def get_version(self, url):
87+
def get_version(self):
8888
"""Fetches Traefik Proxy version from the Proxy API"""
8989

9090
version_url = urljoin(self.traefik_proxy_api_endpoint, PROXY_VERSION)

traefik_mesh/tests/test_unit.py

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,37 @@ def test_invalid_controller_service_check(aggregator, mock_http_response):
108108
aggregator.assert_service_check('traefik_mesh.controller.ready', ServiceCheck.CRITICAL)
109109

110110

111+
def test_get_version(datadog_agent, dd_run_check, mock_http_response_per_endpoint):
112+
from datadog_checks.dev.http import MockResponse
113+
114+
instance = {
115+
'openmetrics_endpoint': 'http://localhost:8080/metrics',
116+
'traefik_proxy_api_endpoint': 'http://localhost:8080',
117+
'tags': ['test:traefik_mesh'],
118+
}
119+
check = TraefikMeshCheck('traefik_mesh', {}, [instance])
120+
check.check_id = 'test:123'
121+
122+
mock_http_response_per_endpoint(
123+
{
124+
'http://localhost:8080/metrics': [MockResponse(file_path=get_fixture_path('traefik_proxy.txt'))],
125+
'http://localhost:8080/api/version': [MockResponse(file_path=get_fixture_path('mesh_proxy_version.json'))],
126+
}
127+
)
128+
dd_run_check(check)
129+
130+
datadog_agent.assert_metadata(
131+
'test:123',
132+
{
133+
'version.raw': '2.5.7',
134+
'version.scheme': 'semver',
135+
'version.major': '2',
136+
'version.minor': '5',
137+
'version.patch': '7',
138+
},
139+
)
140+
141+
111142
def test_submit_version(datadog_agent, dd_run_check, mock_http_response):
112143
check = TraefikMeshCheck('traefik_mesh', {}, [OM_MOCKED_INSTANCE])
113144
mock_http_response(file_path=get_fixture_path('traefik_proxy.txt'))

0 commit comments

Comments
 (0)