-
Notifications
You must be signed in to change notification settings - Fork 939
Performance Monitoring too many events in queue breaks feature entirely #9067
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
Comments
I couldn't figure out how to label this issue, so I've labeled it for a human to triage. Hang tight. |
After seemingly fixing the issue, I reloaded the page several more times, and started seeing the issue again: Performance: Tries left: 2. Sure enough, the number of events in the request body is back up to 195 log events. They all seem to have the same timestamp on them as well (right now): This is unfortunately happening when refreshing the page and just sitting on the Profile Page of my appilcation: It looks like there is a mechanism to grab only some events from the queue, and using a constant called |
I think you are right about this being a request size issue. I was able to reproduce the issue with this snippet (plain JS, no angular needed):
I decreased MAX_EVENT_COUNT_PER_REQUEST to 20, and it was fine. I walked through the code and it seems like both I hand-edited MAX_EVENT_COUNT_PER_REQUEST to 100 and it correctly sent everything in 2 chunks, one with 100 events and one with 26. I actually think it's not that safe for the splitting logic to depend on event count when it should probably depend on byte size - either that or we could just try to keep the event count well below the max. I'll see if I can talk to someone on the Performance Monitoring team and see how they want to approach it. Edit: This is the logic that would have to be changed: |
Just out of curiosity, I'd love to learn more about what hundreds of individual event objects represent in a seemingly short period of time or if some of these events are redundant. I'm unfamiliar with the details about what goes into an individual event. But maybe there is some documentation I haven't discovered yet |
Firebase Performance will automatically capture each network request and PerformanceMeasure as a separate events. Some frameworks like React do automatically create a number of PerformanceMeasures which we would capture. |
@raymondlam that makes sense but I still would imagine that the number of events would be less than hundreds in a short period of time while minimizing user interaction and page navigation. Without navigating away from my profile page, it seemed to have many events pertaining to visiting the profile page. What fields on these events tell me what the even represents so I can further assess whether these events are redundant or not? |
@jakehockey10 You can take a look at the If you breakpoint the same line of code as above, you can run the following to see the traces and network request information we collect.
The If you could provide a snippet of duplicate |
Thanks for the suggestion and the snippet! I took what you gave me here and investigated all the URLs. Looks like ~60% of the events that have a Maybe this is by design, but I noticed that a lot of them are for sections of the app that I haven't visited yet. The rest of the I realize that this is a tool meant to be used in production so this might not be as much of a problem there if this many events are due to running a locally running It also does seem like the limits have request size have changed recently. It seems that this limit might be currently 64 KiB which is pretty small. Today, the number of events amount to ~120KiB: |
Looks like 100 is right around the threshold for me. This is my quick test: |
Operating System
Pop OS
Environment (if applicable)
Angular, Chrome
Firebase SDK Version
9
Firebase SDK Product(s)
Performance
Project Tooling
I'm using Angular 19 with @angular/fire
Detailed Problem Description
I was attempting to use the Performance Monitoring feature, and from the start, it wouldn't send any of the events that are automatically tracked. It also wouldn't send any of my custom traces (I had one for testing when I realized the built in monitoring wasn't working).
Eventually, after a couple of days on StackOverflow and GitHub, researching the issue, I found the source code for this in my Chrome DevTools, found the spot where the request via navigator.sendBeacon and, if necessary, fetch, will post the events to the logging endpoint. Unfortunately, if an error is encountered, the catch block doesn't capture the error in a variable, so I wasn't sure what the error was.
Then I ran across another issue in another repository where the navigator.sendBeacon call was returning false, and one suggested that it might be because the request body is too large. Sure enough, I set a breakpoint on the call to the endpoint, and there was hundreds of events in the request body. So I removed all but one of them in the debugger, and let it roll. Events started streaming in finally.
I'm not sure how the events accumulated this much without any of them being sent to the logging endpoint, as this was my first few days trying to use the feature. But now events are streaming in. I'm not sure if this will happen again or what caused it, but I wanted to report this issue in hopes that handling the request body being too large might be something worth handling in the firebase sdk itself as I don't seem to see a way to get a hold of these events in my code.
Steps and code to reproduce issue
The text was updated successfully, but these errors were encountered: