Add support for message-batch (v2) payloads#1411
Conversation
| def get_telemetry_data(self): | ||
| yield from self.get_data(path_filters="/telemetry/proxy/api/v2/apmtelemetry") | ||
|
|
||
| def get_flattened_telemetry_data(self): |
There was a problem hiding this comment.
IIUC, we want to keep all test logics used in get_telemetry_data applied on sub-payloads if request_type == "message-batch".
What about using the same function, but with an optional argument, set by default to True ?
get_telemetry_data(self, flatten_message_batches=True) ?
There was a problem hiding this comment.
IIUC, we want to keep all test logics used in get_telemetry_data applied on sub-payloads
Yes, in most cases. There are some cases (where we're operating at the "request" level rather than the "payload" level) where we don't want that logic though, hence adding this additional method.
What about using the same function, but with an optional argument, set by default to True
Yep, that works for me 🙂 I'll update to that approach instead 👍
Also, I've just realised that telemetry has some explicit additional scenarios, e.g. TELEMETRY_METRIC_GENERATION_DISABLED etc. I assume I should add the run-all-scenarios to this (after making the change)?
Thanks!
There was a problem hiding this comment.
I assume I should add the run-all-scenarios to this (after making the change)?
yep :)
There was a problem hiding this comment.
Done 🙂 There were some failing tests, but AFAICT they're probably flaky as they don't touch the telemetry stuff. Is it ok to just retry them? (Not sure of norms on this repo yet!)
Add optional param to get_telemetry_data() instead. Update previous usages of get_telemetry_data() that _shouldn't_ be flattened
f034041 to
e938fcb
Compare
Description
Add support for v2 telemetry
message-batchpayloads by "flattening" the batch into multiple requests. Not all tests require this, but many do.Motivation
The telemetry tests commonly assert for particular message types, but when you use
message-batch, the messages are nested inside the payload. So instead of this:{ "request": { "content": { "api_version": "v1", "request_type": "app-started", "payload": {} } } }, { "request": { "content": { "api_version": "v1", "request_type": "app-dependencies-loaded", "payload": {} } }you have something like this:
{ "request": { "content": { "api_version": "v2", "request_type": "message-batch", "payload": [ { "request_type": "app-started", "payload": {} }, { "request_type": "app-dependencies-loaded", "payload": {} } ] } } }To handle that, added an extra helper function. As well as
get_telemetry_data()there's now alsoget_flattened_telemetry_data()Workflow
Once your PR is reviewed, you can merge it! ❤️
Reviewer checklist
run-all-scenarioslabel (more info).build-some-imagelabel is present