elastic / apm-agent-php

Apache License 2.0
252 stars 69 forks source link

can't set global labels from environment #1196

Closed brettmc closed 2 weeks ago

brettmc commented 2 months ago

Describe the bug Documentation suggests that you can set global labels via the environment variable ELASTIC_APM_GLOBAL_LABELS. When I set this value in an agent, I see no extra labels in APM. Searching the codebase here, I see no reference to the variable in code, just one mention in docs.

To Reproduce Steps to reproduce the behavior:

  1. Set `ELASTIC_APM_GLOBAL_LABELS=foo=bar,baz=bat"
  2. Execute the application, causing a trace to be generated
  3. View into the transaction's metadata in APM
  4. See no extra labels

Expected behavior Extra labels to be visible in APM.

intuibase commented 2 weeks ago

Hey @brettmc

I tested it by calling simple test app

ELASTIC_APM_GLOBAL_LABELS=foo=bar,baz=bat php8.2 /var/www/html/curl.php 

and got result:

Image

Could you verify if env variable was set correctly? It can be done by enabling debug level logs in agent or you can just dump env from PHP app.

Thanks, Pawel

brettmc commented 2 weeks ago

Verified that this does work. I was using a quite old version of the agent (1.5), but upgrading to the most recent version fixed it. Sorry for the noise.