Skip to content

Commit d7d3155

Browse files
Pierre-L42claude
andauthored
Fix ddev snmp generate-profile-from-mibs to use modern metric_tags fields (#23543)
* Fix snmp generate-profile-from-mibs to use modern metric_tags symbol field The ddev meta snmp generate-profile-from-mibs command was emitting table metric tags using the deprecated `column` field, which the SNMP Profile Manager rejects on upload. Switch to the modern `symbol` field per the MetricTagConfig schema in datadog-agent's profiledefinition. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * Rename changelog fragment to match PR number Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * Accept `symbol` in TableColumnHasTagValidator The schema in datadog-agent's profiledefinition deprecated `column` in favour of `symbol` for table metric tags. Extend the local validate-profile validator so profiles using the modern `symbol` field are not flagged as missing tags. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent f315e2a commit d7d3155

3 files changed

Lines changed: 6 additions & 5 deletions

File tree

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Make `generate-profile-from-mibs` emit `symbol` instead of the deprecated `column` field on table metric tags, and accept `symbol` in `validate-profile`.

datadog_checks_dev/datadog_checks/dev/tooling/commands/meta/snmp/generate_profile.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -639,17 +639,17 @@ def _add_profile_row_node(
639639
oid_name = alias['name']
640640

641641
index = {'MIB': mib, 'tag': oid_name}
642-
column = {'name': oid_name}
642+
symbol = {'name': oid_name}
643643
index_oid = _find_oid_by_name(mib, oid_name, mibs_directories, json_mib_directory, source, compiled_mibs_path)
644644
if index_oid is not None:
645-
column['OID'] = index_oid
645+
symbol['OID'] = index_oid
646646
index_table_oid = '.'.join(index_oid.split('.')[:-2])
647647
index_table_name = _find_name_by_oid(
648648
mib, index_table_oid, mibs_directories, json_mib_directory, source, compiled_mibs_path
649649
)
650650
if index_table_name is not None:
651651
index['table'] = index_table_name
652-
index['column'] = column
652+
index['symbol'] = symbol
653653
metric_tags.append(index)
654654

655655
profile_oid_collection[table_oid]['metric_tags'] = metric_tags

datadog_checks_dev/datadog_checks/dev/tooling/commands/meta/snmp/validators/validator.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -271,7 +271,7 @@ def validate(self, profile, path):
271271
if not all_metric_tags_are_valid:
272272
self.fail(
273273
"metric_tables defined in lines {} are not valid. \
274-
\nmetric_tags must have 'column' or 'index' value".format(lines)
274+
\nmetric_tags must have 'symbol', 'column' or 'index' value".format(lines)
275275
)
276276

277277
if not self.result.failed:
@@ -281,7 +281,7 @@ def check_metric_tags_are_valid(self, metric_tags):
281281
all_tags_are_valid = True
282282
lines = []
283283
for metric_tag in metric_tags:
284-
if not (metric_tag.get('column') or metric_tag.get('index')):
284+
if not (metric_tag.get('symbol') or metric_tag.get('column') or metric_tag.get('index')):
285285
all_tags_are_valid = False
286286
lines.append(metric_tag.get('__line__'))
287287

0 commit comments

Comments
 (0)