patrickkerrigan / php-xray

A PHP instrumentation library for AWS X-Ray
BSD 3-Clause "New" or "Revised" License
63 stars 26 forks source link

Add segment with start and end time #4

Closed soukicz closed 5 years ago

soukicz commented 5 years ago

Thank you for this great library! We are currently trying to implement it to our project and I wanted to contribute by implementing Doctrine and Symfony.

Best way to implement Doctrine is to use its logger where I can get query details like sanitized query and duration. Problem is that I can't use current segment methods to record query because I can't use begin/end before and after query. I have only end time and duration. What would be the best solution? 1) add optional arguments with time to begin+end methods 2) add new method setTime($begin, $end) 3) create new segment class with this implemented and keep it in the new DoctrineXRay package

I will create necessary PR but I just wanted to consult this tiny change first.

soukicz commented 5 years ago

Nevermind. Extending of existing SqlSegment is so easy that there is no point in adding extra methods. I thought it will be lot more complicated to override default behaviour :)

patrickkerrigan commented 5 years ago

No worries, glad to hear it was easy to extend!

Let me know if you end up publishing your package on Composer, and I'll add a link to it here if you like