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

Reset EventDataCollectors and add Metadata after each send #77

Merged

Conversation

dstepe
Copy link
Contributor

@dstepe dstepe commented Sep 27, 2020

Closes #57

The current event collection results in problems with long running worker processes. The required metadata is not being added before each batch and the event collectors are not being cleared after sending. Overriding the base Agent::send() allows us to work around both issues as a short term fix. The base Agent package will improve the event collection process in a future release to address this. You may want to look into a better way to reset the collectors in this package.

I have tested this on my reference application with a worker queue and it appears to work as expected. However, I do not have the philkra agent package installed and cannot attest to this being fully ready to merge. I offer is a starting point for addressing the reported issue.

@dstepe dstepe force-pushed the chore/handle-events-in-long-processes branch from 3978f0f to 76842a6 Compare September 27, 2020 14:14
src/Agent.php Outdated Show resolved Hide resolved
@@ -136,4 +136,10 @@ private function toMilliseconds(float $time): float
{
return round($time * 1000, 3);
}

public function reset(): void
Copy link
Owner

Choose a reason for hiding this comment

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

Could you add this method to the AG\ElasticApmLaravel\Contracts\DataCollector interface?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done. Waiting on the checks to confirm. I rebased and squashed the commits to clean this up as well.

@dstepe dstepe force-pushed the chore/handle-events-in-long-processes branch from 5451d87 to 3763ee3 Compare September 27, 2020 18:07
src/Agent.php Outdated Show resolved Hide resolved
The old package does not include the metadata argument.
@arkaitzgarro arkaitzgarro merged commit b9d99e3 into arkaitzgarro:master Sep 28, 2020
@dstepe dstepe deleted the chore/handle-events-in-long-processes branch September 28, 2020 18:51
@cykirsch
Copy link
Contributor

@dstepe This fix was perfect, I really appreciate you handling it so quickly. 🎉

@dstepe dstepe 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.

did not recognize object type
3 participants