xmidt-org / caduceus

The Xmidt server for delivering events written in Go.
Apache License 2.0
16 stars 21 forks source link

Remove any logic specific to Device ID #229

Open kristinapathak opened 3 years ago

kristinapathak commented 3 years ago

Currently, caduceus parses the device ID in two places: https://github.com/xmidt-org/caduceus/blob/453f1410b1f109beeac7d9141eb20df4c86292d6/outboundSender.go#L582 https://github.com/xmidt-org/caduceus/blob/b2866f45a7891e20b49c005aaf46dd70baf247e8/outboundSender.go#L391

In talking with @schmidtw, we have reason to believe some consumers are using the device ID header, and we should probably keep that accurate. The part of the webhook struct that provides regex to apply against the device ID was more intended as a way to provide regex against the wrp.Source, so perhaps we could change the api to reflect that better without changing the Caduceus logic.

In our discussion, we didn't think Caduceus should be responsible for parsing the device ID from the event. Talaria knows the device ID already, so if it passes it to Caduceus, Caduceus could forward it - either as an http header or a new field in the wrp.

These are just options we discussed; further discussion is needed.


Update: Given our discussion, these are the changes needed in Caduceus:

This is dependent on https://github.com/xmidt-org/wrp-go/issues/53 and https://github.com/xmidt-org/webpa-common/issues/514.

kristinapathak commented 3 years ago

Discussion with the team today led to these decisions:

  1. Caduceus will not do anything to parse or determine the Device ID.
  2. We will remove the Matcher field in the webhook struct for the webhook registration API, and remove logic in Caduceus that uses it.
  3. Add a new required field in the WRP SimpleEvent that indicates the DeviceID. Caduceus will no longer have a special header for the Device ID specifically and instead will have a header for it that matches the other fields.

Most of these decisions affect other repos. The main change needed for this issue is for Caduceus to no longer use the webhook Matcher field for anything, and to only use the wrphttp package to add the wrp headers.