PHP Guzzle - Add info to span


Is it possible to intercept the Span that is created when using Guzzle in PHP?
I want to add labels to the span instead of creating my own span.
getCurrentSpan() is always empty before and after I $client->get() something, and afterwards the Transaction has filled spansToSend, but I can't access it, right?

Thanks for your help!

Hi @seba1. Welcome to the forum!
Unfortunately there is no easy solution to your problem. We do have an issue in our backlog - Support filters to discard/modify events · Issue #67 · elastic/apm-agent-php · GitHub that should address this use case. I will see if we can give it higher priority but I cannot commit on when it will be available.

A possible workaround is to use Elastic APM PHP Agent's public API by wrapping calls to Guzzle client and create spans with the required labels.

Hello! Thank you for the response.

For now I'm creating custom Spans, yes, that just doubles the amount in the Overview for each request. Not a big problem, but just a bit redundant :slight_smile:


This topic was automatically closed 20 days after the last reply. New replies are no longer allowed.