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

[corechecks/snmp] Fix format config for column metric tags #11746

Merged
merged 6 commits into from
Apr 21, 2022

Conversation

AlexandreYang
Copy link
Member

@AlexandreYang AlexandreYang commented Apr 21, 2022

What does this PR do?

Fix format config to work with column metrics tags.

For example: https://github.com/DataDog/integrations-core/pull/11871/files#diff-7031715b315cd7cb4e97c40e1d0325fb47b864e970868d6c4b5438e9b9602bf2R27-R31

metrics:
  - MIB: MERAKI-CLOUD-CONTROLLER-MIB
    table:
      OID: 1.3.6.1.4.1.29671.1.1.4
      name: devTable
      # devTable INDEX is: devMac
    forced_type: gauge
    symbols:
      - OID: 1.3.6.1.4.1.29671.1.1.4.1.3
        name: devStatus
      - OID: 1.3.6.1.4.1.29671.1.1.4.1.5
        name: devClientCount
    metric_tags:
      # devMac is part of the devTable index
      - column:
          OID: 1.3.6.1.4.1.29671.1.1.4.1.1
          name: devMac
          format: mac_address
        tag: mac_address
      - column:
          OID: 1.3.6.1.4.1.29671.1.1.4.1.2
          name: devName
        tag: device
      - column:
          OID: 1.3.6.1.4.1.29671.1.1.4.1.9
          name: devProductCode
        tag: product
      - column:
          OID: 1.3.6.1.4.1.29671.1.1.4.1.11
          name: devNetworkName
        tag: network

Motivation

1/ bug fix for #11557

2/ needed for DataDog/integrations-core#11871

Additional Notes

image

Possible Drawbacks / Trade-offs

Describe how to test/QA your changes

Reviewer's Checklist

  • If known, an appropriate milestone has been selected; otherwise the Triage milestone is set.
  • Use the major_change label if your change either has a major impact on the code base, is impacting multiple teams or is changing important well-established internals of the Agent. This label will be use during QA to make sure each team pay extra attention to the changed behavior. For any customer facing change use a releasenote.
  • A release note has been added or the changelog/no-changelog label has been applied.
  • Changed code has automated tests for its functionality.
  • Adequate QA/testing plan information is provided if the qa/skip-qa label is not applied.
  • At least one team/.. label has been applied, indicating the team(s) that should QA this change.
  • If applicable, docs team has been notified or an issue has been opened on the documentation repo.
  • If applicable, the need-change/operator and need-change/helm labels have been applied.
  • If applicable, the config template has been updated.

@@ -90,64 +86,6 @@ type MetricsConfig struct {
Options MetricsConfigOption `yaml:"options"`
}

// GetTags retrieve tags using the metric config and values
func (mtcl MetricTagConfigList) GetTags(fullIndex string, values *valuestore.ResultValueStore) []string {
Copy link
Member Author

@AlexandreYang AlexandreYang Apr 21, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note for reviewers: GetTags has been moved to report_utils.go and renamed to getTagsFromMetricTagConfigList

Same for transformIndex

@AlexandreYang AlexandreYang changed the title Fix format for column [corechecks/snmp] Fix format for column Apr 21, 2022
@AlexandreYang AlexandreYang changed the title [corechecks/snmp] Fix format for column [corechecks/snmp] Fix format config for columns Apr 21, 2022
@AlexandreYang AlexandreYang changed the title [corechecks/snmp] Fix format config for columns [corechecks/snmp] Fix format config for column metric tags Apr 21, 2022
@AlexandreYang AlexandreYang marked this pull request as ready for review April 21, 2022 12:25
@AlexandreYang AlexandreYang requested a review from a team as a code owner April 21, 2022 12:25
Copy link
Member

@FlorianVeaux FlorianVeaux left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just to make sure I understood this PR correctly, there is some refactoring but the only real change in behavior is that we now use getColumnValuesFromSymbol in the function getTagsFromMetricTagConfigList instead of using values.GetColumnValues ?
Can you confirm my understanding is correct and I haven't missed any other change in the refactor?

@AlexandreYang
Copy link
Member Author

@FlorianVeaux Your understanding is correct. Sorry, I should have detailed that in the first place.

Copy link
Member

@FlorianVeaux FlorianVeaux left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mostly a refactor and test, the one-line behavior change looks good to me if CI is green 👍
Thanks!

@AlexandreYang AlexandreYang merged commit 4f239bf into main Apr 21, 2022
@AlexandreYang AlexandreYang deleted the alex/snmp_fix_format_column branch April 21, 2022 16:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants