2424 'datadog.snmp.submitted_metrics' ,
2525]
2626
27+ SKIPPED_TAGS = ['loader' ]
28+
29+ CORE_ONLY_TAGS = ['device_namespace:default' ]
30+
2731
2832def test_e2e_metric_types (dd_agent_check ):
2933 instance = common .generate_container_instance_config (SUPPORTED_METRIC_TYPES )
@@ -63,7 +67,7 @@ def test_e2e_v3_explicit_version(dd_agent_check):
6367 assert_python_vs_core (dd_agent_check , config , expected_total_count = 511 + 5 )
6468
6569
66- def test_e2e_regex_match (dd_agent_check , aggregator ):
70+ def test_e2e_regex_match (dd_agent_check ):
6771 metrics = [
6872 {
6973 'MIB' : "IF-MIB" ,
@@ -124,23 +128,6 @@ def test_e2e_regex_match(dd_agent_check, aggregator):
124128 ]
125129 assert_python_vs_core (dd_agent_check , config )
126130
127- config ['init_config' ]['loader' ] = 'core'
128- aggregator .reset ()
129- aggregator = dd_agent_check (config , rate = True )
130-
131- # raw sysName: 41ba948911b9
132- aggregator .assert_metric (
133- 'snmp.devices_monitored' ,
134- tags = [
135- 'digits:41' ,
136- 'remainder:ba948911b9' ,
137- 'letter1:4' ,
138- 'letter2:1' ,
139- 'loader:core' ,
140- 'snmp_device:' + instance ['ip_address' ],
141- ],
142- )
143-
144131
145132def test_e2e_scalar_oid_retry (dd_agent_check ):
146133 scalar_objects_with_tags = [
@@ -358,6 +345,7 @@ def assert_python_vs_core(
358345 python_config ['init_config' ]['loader' ] = 'python'
359346 core_config = deepcopy (config )
360347 core_config ['init_config' ]['loader' ] = 'core'
348+ core_config ['init_config' ]['collect_device_metadata' ] = 'false'
361349 metrics_to_skip = metrics_to_skip or []
362350
363351 # building expected metrics (python)
@@ -368,12 +356,14 @@ def assert_python_vs_core(
368356 if stub .name in metrics_to_skip :
369357 continue
370358 stub = normalize_stub_metric (stub )
371- python_metrics [(stub .name , stub .type , tuple (sorted (stub .tags )))].append (stub )
359+ python_metrics [(stub .name , stub .type , tuple (sorted (list ( stub .tags ) + CORE_ONLY_TAGS )))].append (stub )
372360
373361 python_service_checks = defaultdict (list )
374362 for _ , service_checks in aggregator ._service_checks .items ():
375363 for stub in service_checks :
376- python_service_checks [(stub .name , stub .status , tuple (sorted (stub .tags )), stub .message )].append (stub )
364+ python_service_checks [
365+ (stub .name , stub .status , tuple (sorted (list (stub .tags ) + CORE_ONLY_TAGS )), stub .message )
366+ ].append (stub )
377367
378368 total_count_python = sum (len (stubs ) for stubs in python_metrics .values ())
379369
@@ -426,7 +416,7 @@ def assert_python_vs_core(
426416
427417
428418def normalize_stub_metric (stub ):
429- tags = [t for t in stub .tags if not t . startswith ( 'loader:' )] # Remove `loader` tag
419+ tags = [t for t in stub .tags if not is_skipped_tag ( t )] # Remove skipped tag
430420 return MetricStub (
431421 stub .name ,
432422 stub .type ,
@@ -435,3 +425,10 @@ def normalize_stub_metric(stub):
435425 stub .hostname ,
436426 stub .device ,
437427 )
428+
429+
430+ def is_skipped_tag (tag ):
431+ for skipped_tag in SKIPPED_TAGS :
432+ if tag .startswith ('{}:' .format (skipped_tag )):
433+ return True
434+ return False
0 commit comments