edgex-go: Reading Id not set when using Redis

🐞 Bug Report

Affected Services

The issue is located in: Core Data Redis DB

Is this a regression?

Yes, the previous version in which this bug was not present was: Fuji with Mongo & Geneva with Mongo. Unsure about Fuji with Redis

Description and Minimal Reproduction

Edit Geneva Redis secure compose file to set App Service Configurable profile to http-export. Create Postman Mock endpoint Run Geneva Redis compose file Edit App Service Configurable http-export pipeline in Consul to set the url for HttpJsonExport to the mock endpoint View data sent to Mock endpoint which will look like this:

id: "34511beb-ba3f-43b2-a2dc-c2a40fd40422"
device: "Random-Boolean-Device"
origin: 1590508601358048800
readings: Array(1)
0: {…}
origin: 1590508601253235500
device: "Random-Boolean-Device"
name: "Bool"
value: "true"
valueType: "Bool"

Doing the same with Mongo compose file results in data exported that looks like this:

id: "7d698e4b-6916-4b91-aa76-52c5ef52f0af"
device: "Random-Boolean-Device"
origin: 1590511191026868700
readings: Array(1)
0: {…}
id: "31020d1a-e0c6-425f-87d3-ca506b3c1feb"
origin: 1590511190862357500
device: "Random-Boolean-Device"
name: "Bool"
value: "true"
valueType: "Bool"

πŸ”₯ Exception or Error

None

🌍 Your Environment

Deployment Environment:

EdgeX Version: Geneva Redis

Anything else relevant?

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Comments: 15 (15 by maintainers)

Commits related to this issue

Most upvoted comments

@AnthonyMBonafide , I agree that it is a bit strange that AddEvent is able to modify the Event/Reading when it appears to have a copy, but it is doing it…

I used the Mongo AddEvent() as a guide and added e.Readings[i].Id = id here: https://github.com/edgexfoundry/edgex-go/blob/master/internal/pkg/db/redis/data.go#L1085 And now I have Reading Ids when recieved off the Message Bus.

Please give this a try and verify it works for you. THX!

@andresrinivasan, I think the issue is here where the Id is created and persisted but then set on the reading, r, so that it is there when pushed onto the Message Bus. https://github.com/edgexfoundry/edgex-go/blob/master/internal/pkg/db/redis/data.go#L1085