Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Setting msg_type field to unsupport value results in empty string Xmidt-Messag-Type header with delivered event. #67

Closed
ilawjr opened this issue Jan 12, 2022 · 3 comments
Assignees
Labels
bug Something isn't working

Comments

@ilawjr
Copy link

ilawjr commented Jan 12, 2022

If you set the msg_type field to 2 (or another unsupported int value) the event is delivered with "X-Xmidt-Message-Type": [""]

  1. setup and register listener (example uses basin). Then submit event to caduceus such as:

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"}

  1. retrieve event from listener.

{"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.

@ilawjr ilawjr added the bug Something isn't working label Jan 12, 2022
@kristinapathak
Copy link
Contributor

I think if we get an unsupported event type, caduceus shouldn't try to deliver that event.

@ilawjr
Copy link
Author

ilawjr commented Jan 12, 2022

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.

@kristinapathak
Copy link
Contributor

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants