# PHP Guzzle - Add info to span

**URL:** <https://discuss.elastic.co/t/php-guzzle-add-info-to-span/330788>\
**Category:** APM\
**Tags:** php\
**Created:** [April 26, 2023, 6:06am UTC](https://discuss.elastic.co/t/php-guzzle-add-info-to-span/330788 "2023-04-26T06:06:32Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![seba1](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/seba1/32/120217_2.png) [@seba1](https://discuss.elastic.co/u/seba1)\
**Post date:** [April 26, 2023, 6:06am UTC](https://discuss.elastic.co/t/php-guzzle-add-info-to-span/330788/1 "2023-04-26T06:06:32Z")

</div>

Hello!

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!

---

<div class="post-metadata">

**Author:** ![Sergey\_Kleyman](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/sergey_kleyman/32/39333_2.png) [@Sergey\_Kleyman](https://discuss.elastic.co/u/Sergey_Kleyman)\
**Post date:** [April 27, 2023, 7:28am UTC](https://discuss.elastic.co/t/php-guzzle-add-info-to-span/330788/2 "2023-04-27T07:28:14Z")

</div>

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](https://github.com/elastic/apm-agent-php/issues/67) 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](https://www.elastic.co/guide/en/apm/agent/php/current/public-api.html) by wrapping calls to Guzzle client and create spans with the required labels.

---

<div class="post-metadata">

**Author:** ![seba1](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/seba1/32/120217_2.png) [@seba1](https://discuss.elastic.co/u/seba1)\
**Post date:** [April 27, 2023, 7:50am UTC](https://discuss.elastic.co/t/php-guzzle-add-info-to-span/330788/3 "2023-04-27T07:50:46Z")

</div>

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 🙂

Thanks!

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [May 18, 2023, 3:51am UTC](https://discuss.elastic.co/t/php-guzzle-add-info-to-span/330788/4 "2023-05-18T03:51:13Z")

</div>

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