Skip to content

Commit 01c0789

Browse files
authored
[NDM][Cisco SD-WAN] Make sure to copy device tags (#34939)
1 parent a48091e commit 01c0789

File tree

3 files changed

+14
-3
lines changed

3 files changed

+14
-3
lines changed

pkg/collector/corechecks/network-devices/cisco-sdwan/payload/devices.go

+1-2
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,7 @@ func GetDevicesMetadata(namespace string, devices []client.Device) []devicemetad
3434
func GetDevicesTags(namespace string, devices []client.Device) map[string][]string {
3535
deviceTags := make(map[string][]string)
3636
for _, device := range devices {
37-
deviceTags[device.SystemIP] = buildDeviceTags(namespace, device)
38-
deviceTags[device.SystemIP] = append(deviceTags[device.SystemIP], fmt.Sprintf("%s:%s", DeviceUserTagResourcePrefix, buildDeviceID(namespace, device)))
37+
deviceTags[device.SystemIP] = append(buildDeviceTags(namespace, device), fmt.Sprintf("%s:%s", DeviceUserTagResourcePrefix, buildDeviceID(namespace, device)))
3938
}
4039
return deviceTags
4140
}

pkg/collector/corechecks/network-devices/cisco-sdwan/report/metrics.go

+2-1
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ import (
1515
"github.com/DataDog/datadog-agent/pkg/aggregator/sender"
1616
"github.com/DataDog/datadog-agent/pkg/collector/corechecks/network-devices/cisco-sdwan/client"
1717
"github.com/DataDog/datadog-agent/pkg/collector/corechecks/network-devices/cisco-sdwan/payload"
18+
"github.com/DataDog/datadog-agent/pkg/networkdevice/utils"
1819
"github.com/DataDog/datadog-agent/pkg/util/log"
1920
)
2021

@@ -369,7 +370,7 @@ func (ms *SDWanSender) getDeviceTags(systemIP string) []string {
369370
if !ok {
370371
return []string{"system_ip:" + systemIP}
371372
}
372-
return tags
373+
return utils.CopyStrings(tags)
373374
}
374375

375376
func (ms *SDWanSender) getPrefixedDeviceTags(prefix string, systemIP string) []string {
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# Each section from every release note are combined when the
2+
# CHANGELOG.rst is rendered. So the text needs to be worded so that
3+
# it does not depend on any information only available in another
4+
# section. This may mean repeating some details, but each section
5+
# must be readable independently of the other.
6+
#
7+
# Each section note must be formatted as reStructuredText.
8+
---
9+
fixes:
10+
- |
11+
Cisco SD-WAN: fix an issue that could lead to incorrect metrics tagging.

0 commit comments

Comments
 (0)