When device resource sets mapping, the Tags content will be lost after transformation
gq-tang opened this issue Β· comments
π Bug Report
Affected Services [REQUIRED]
The issue is located in:https://github.com/edgexfoundry/device-sdk-go/blob/main/internal/transformer/transform.go
Is this a regression?
Yes, the previous version in which this bug was not present was: ....Description and Minimal Reproduction [REQUIRED]
When device resource sets mapping, the Tags content will be lost after transformation.
I set the Tags in AsyncValues.
CommandValues: []*sdkModels.CommandValue{
{
DeviceResourceName: resourceName,
Type: typ,
Value: pro.DataValue,
Origin: time.Now().UnixNano(),
Tags: map[string]string{
"gatewayId": req.GatewayId,
},
},
}
But there is no tag information in the received event
π₯ Exception or Error
// ResourceOperation mapping
ro, err := cache.Profiles().ResourceOperation(device.ProfileName, cv.DeviceResourceName)
if err != nil {
// this allows SDK to directly read deviceResource without deviceCommands defined.
lc.Debugf("failed to read ResourceOperation: %v", err)
} else if len(ro.Mappings) > 0 {
newCV, ok := mapCommandValue(cv, ro.Mappings)
if ok {
cv = newCV // cv is override, tags is empty now
}
}
for key, value := range cv.Tags { //
tags[key] = value
}
π Your Environment
Deployment Environment:
EdgeX Version [REQUIRED]:
github.com/edgexfoundry/device-sdk-go/v3 v3.0.0-dev.38
Anything else relevant?