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

Chore/implement global max trace items #89

Merged

Conversation

dstepe
Copy link
Contributor

@dstepe dstepe commented Oct 12, 2020

Closes #85

This took a little more work than I expected, but I think it covers the expected use cases. I'm still looking at EventCollector tests and want to make note about some behaviors in the docs. I wanted to get this out as a draft, though.

I replaced the CustomCollectorTest with EventDataCollectorTest. The original test did not seem to be actually testing a "custom" collector, just using it as a way to test the abstract EventDataCollector. I believe this approach is more explicit and obvious.

The use of the microtime() function makes testing difficult, so I added an EventClock class which is injected where needed and will provide the time.

The one caveat to how the item limit works relates to when events are added. If a collector were to collect events during the request, but only call addMeasure() at the end of the request, the events may not be collected even if they occurred earlier in the transaction. (This is how the original philkra Laravel package handled DB queries for example.) I don't know that anyone will ever run into this, but I want to figure out how to explain it in the docs just in case.

@arkaitzgarro
Copy link
Owner

Looking good, thanks for the fix! I have nothing really to add, looking forward to the PR 👍

@dstepe dstepe marked this pull request as ready for review October 13, 2020 12:52
@dstepe
Copy link
Contributor Author

dstepe commented Oct 13, 2020

I think this is ready. I'd like to spend time on the event collectors, but that's better done in separate PRs.

I see there is a new failing check for styleci, but I get a 404 when I try to view the details for it. What needs to be done for that to pass?

@countless-integers countless-integers changed the title Chore/implment global max trace items Chore/implement global max trace items Oct 13, 2020
@countless-integers
Copy link
Collaborator

My spider sense tells me that if you push anything to this branch this check won't be triggered any more. I think @arkaitzgarro disabled it for now.

@arkaitzgarro
Copy link
Owner

I see there is a new failing check for styleci, but I get a 404 when I try to view the details for it. What needs to be done for that to pass?

Yes, I disabled it. I wanted to know if the Laravel preset was linting variable cases, but it didn't. Looks like an interesting service though, will take a look in the future.

@dstepe dstepe force-pushed the chore/implment-global-max-trace-items branch from 1c62d5d to 4e2befe Compare October 13, 2020 13:33
@dstepe
Copy link
Contributor Author

dstepe commented Oct 13, 2020

That's a good opportunity fix a typo in the README and clean up the commits. All is good now.

@dstepe
Copy link
Contributor Author

dstepe commented Oct 18, 2020

@arkaitzgarro This should be ready now if it looks good to you.

@dstepe dstepe force-pushed the chore/implment-global-max-trace-items branch from 4e2befe to c69ea15 Compare October 18, 2020 15:01
@dstepe
Copy link
Contributor Author

dstepe commented Oct 18, 2020

I rebased on to master and fixed a unit test impacted by my changes.

@dstepe dstepe force-pushed the chore/implment-global-max-trace-items branch from 7d789e8 to 07d01c8 Compare October 18, 2020 18:53
Copy link
Owner

@arkaitzgarro arkaitzgarro left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changes are looking good, some tests need to be updated though. We added missing tests for collectors, but in this PR the EventDataCollector class constructor expects 5 parameters instead of 3. Could you update the broken tests? We can merge it right after.

@dstepe
Copy link
Contributor Author

dstepe commented Oct 19, 2020

How about I rebase this branch onto master again and see how it looks? I think that might be better than merging master into the branch. I have a little bit of time now to look at it.

@dstepe dstepe force-pushed the chore/implment-global-max-trace-items branch from c3bd82f to 8397db2 Compare October 19, 2020 11:16
@dstepe
Copy link
Contributor Author

dstepe commented Oct 19, 2020

My apologies. I saw the some of the other branches being merged and began making the fixes for the new Collector tests on this branch. That caused the conflicts you experienced. I rebased on to the latest master, cleaned up the tests and force pushed. All the Collector tests are working now.

@arkaitzgarro arkaitzgarro merged commit c1417a6 into arkaitzgarro:master Oct 19, 2020
@dstepe dstepe deleted the chore/implment-global-max-trace-items branch October 19, 2020 11:57
@arkaitzgarro arkaitzgarro mentioned this pull request Oct 21, 2020
@arkaitzgarro arkaitzgarro mentioned this pull request Oct 27, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Max trace items is applied per collector rather than to total events
3 participants