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

Adding support for multiple-entities in one request #142

Merged

Conversation

kopiro
Copy link
Contributor

@kopiro kopiro commented May 5, 2021

Feel free to close this PR if you don't see the need, but there are some scenarios when a request contains multiple events, and you wanna visualize them separately in the panel.

This was exactly my need, therefore I added the support for this and thought that maybe could be valuable for you to consider this.

The implementation is simple, if parseUrls returns an array, we send multiple messages to the panel and treat them as fake-multiple requests. To avoid that this request is flagged as "redirect", I've also added a flag that should visualize this in the panel.

A simple implementation for a Provider would be this:

parseUrl(rawUrl, postDataStr) {
        let url = new URL(rawUrl);
        const postData = JSON.parse(postDataStr);
        return postData.events.map(event => {
            const data = this.parseEvent(url, event);
            return {
                "provider": {
                    "name":    this.name,
                    "key":     this.key,
                    "type":    this.type,
                    "columns": this.columnMapping,
                    "groups":  this.groups
                },
                "data": data
            };
        });
    }

@coveralls
Copy link

Coverage Status

Coverage remained the same at 90.038% when pulling 55cc0e3 on kopiro:multiple-entries-per-request into 1387da6 on MisterPhilip:master.

@MisterPhilip MisterPhilip self-requested a review May 7, 2021 05:14
@MisterPhilip MisterPhilip self-assigned this May 7, 2021
@MisterPhilip
Copy link
Owner

This is great, thanks! I've been trying to figure out good ways to display this since it can be misleading either way. Let me review and let you know if there are any issues!

@marcusrbrown
Copy link

Hi, wanted to leave a gentle ping here. We also have a need for this feature.

@MisterPhilip
Copy link
Owner

Sorry, I've been out taking a mental break from Omnibug the past few months. I'll be looking at merging this in this month, stay tuned!

@MisterPhilip MisterPhilip merged commit f0ea2d7 into MisterPhilip:master Oct 23, 2021
@MisterPhilip
Copy link
Owner

Thanks for the PR! It'll take some time for this to fully kick in since each of the applicable providers will need to be updated, but this is a great building block for me to work off of.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants