newrelic/newrelic-php-agent

Add support for custom segments

Opened this issue · 3 comments

Summary

There is currently no way to instrument custom segments within a PHP application. This feature is present in other New Relic agents, so it was surprising to me that this feature is absent.

Desired Behavior

I should be able to call, for example, newrelic_segment_start('example-segment');, run logic or call functions, and then call newrelic_segment_end(); and have this be displayed in the New Relic APM.

Possible Solution

I propose that newrelic_segment_start() and newrelic_segment_end() be implemented, adding this functionality.

Additional context

We have various complex logical processes in our application which would benefit from being able to categorise certain sets of logic under segments.

Hi @foresturquhart

Please look at newrelic_start_transaction and newrelic_end_transaction to see if they provide the functionality you are looking for.

@zsistla Unfortunately we're already using these to start and end the transaction for the HTTP request or command execution.