microsoft / dev-proxy

Dev Proxy is an API simulator that helps you effortlessly test your app beyond the happy path.
https://aka.ms/devproxy
MIT License
471 stars 56 forks source link

Reporters #714

Closed waldekmastykarz closed 3 months ago

waldekmastykarz commented 4 months ago

This PR shows a concept of a new architecture for request log plugins to share their reports. The idea is, that each plugin produces an object that represents its report and adds it to a central location. Then, one or more transformers can change the shape of the report. Finally, one or more reporters output the data. Using this feature, we get more flexibility for different use cases of Dev Proxy, like interactive in console, or integrated in CI where the output is automatically processed.

Transformers and reporters are implemented as request log plugins, but instead of processing request logs they work on the prepared reports.

Some considerations:

waldekmastykarz commented 3 months ago

Some considerations:

  • right now, if you don't define a transformer and reporter, you won't see the result of a request log plugin. Do we want to keep this, or should each plugin output for example by default to console and optionally to reporters?
  • right now, we separated transformers and reporters. That way, we can combine them, eg. JSON output to console, JSON output to file, etc. Is this correct, or would we rather have them combined and done in such a way, that reporters only read and output data but don't modify it (like a transformer), so that it's possible to use multiple reporters?

Thinking about it some more, I think it would be better to:

waldekmastykarz commented 3 months ago

I submitted a second PR that shows the latest structure as proposed in https://github.com/microsoft/dev-proxy/pull/714#issuecomment-2114161502