Closed ilawjr closed 2 years ago
I think if we get an unsupported event type, caduceus shouldn't try to deliver that event.
If we go that route, caduceus should probably reject the request with a 400.
As a side note, It looks like msg_type=11 results in Unknown.
Discussed with @schmidtw and we think the best backwards compatible solution is to make enum values for 0, 1, and 2. 2 is meant to be for Authorization Status. 0 and 1 should both be Invalid
. Since an enum cannot be two values, I think something like Invalid0
and Invalid1
should work? If possible, they can both result in the same string though.
Caduceus or any other service can check the MessageType
after decoding the wrp to determine if it's valid. Caduceus is only interested in sending SimpleEvents
so can return 400 for any other MessageType
.
If you set the msg_type field to 2 (or another unsupported int value) the event is delivered with "X-Xmidt-Message-Type": [""]
example {"msg_type":2,"source":"dns:talaria.xmidt.example.com","dest":"event: xmidt-test","transaction_uuid": "9284a7ad-8cae-4cca-8b7d-dda69e2b0e62","content_type": "json","accept": "","status": 504,"rdr": 0,"headers": ["a:b","b:c","d:e"],"metadata": {"/boot-time":"1542834188","/last-reconnect-reason":"spanish inquisition"},"spans": [["Luke","Skywalker","1234", "5678","0"],["Lord","Vader","1234","5678","1"] ],"include_spans": true,"path": "/online","payload": "[redacted]","service_name": "qa","url":"updown","partner_ids":["comcast"],"session_id": "1wksX1ckVakUcgIzXh0S1sSHvK8"}
{"Method": "POST", "URL": "/api/v1/responder", "Body": "[redacted]", "Headers": {"Accept-Encoding": ["gzip"], "Content-Length": ["164"], "Content-Type": ["json"], "User-Agent": ["Go-http-client/1.1"], "X-Webpa-Device-Id": ["dns:talaria.xmidt.example.com"], "X-Webpa-Device-Name": ["dns:talaria.xmidt.example.com"], "X-Webpa-Event": ["xmidt-test"], "X-Webpa-Signature": ["sha1=01c9014ea319ff29a5ffa2c6650a992bc9b1370b"], "X-Webpa-Transaction-Id": ["9284a7ad-8cae-4cca-8b7d-dda69e2b0e62"], "X-Xmidt-Include-Spans": ["true"], "X-Xmidt-Message-Type": [""], "X-Xmidt-Metadata": ["/boot-time=1542834188", "/last-reconnect-reason=spanish inquisition"], "X-Xmidt-Partner-Id": ["comcast"], "X-Xmidt-Path": ["/online"], "X-Xmidt-Request-Delivery-Response": ["0"], "X-Xmidt-Source": ["dns:talaria.xmidt.example.com"], "X-Xmidt-Span": ["Luke,Skywalker,1234,5678,0", "Lord,Vader,1234,5678,1"], "X-Xmidt-Status": ["504"], "X-Xmidt-Transaction-Uuid": ["9284a7ad-8cae-4cca-8b7d-dda69e2b0e62"]}}
The current expected behavior is undefined, and part of this issue will be to determine what we expect.