ddtrace-graphql icon indicating copy to clipboard operation
ddtrace-graphql copied to clipboard

Not picking up DD_VERSION environment variable

Open arsalasif opened this issue 4 years ago • 6 comments

Hello, thanks for making this library, it's super helpful.

I'm using version 0.2.0, and I have a problem that the graphql APM service is not picking up DD_VERSION environment variable.

Any help will be really appreciated, thank you.

arsalasif avatar Dec 30 '20 14:12 arsalasif

Hi @arsalasif !

Can you check what version of ddtrace are you using? Reading their docs ~ https://github.com/DataDog/dd-trace-py/blob/16487e51380e28672337a54a9921a73fc44adf07/docs/configuration.rst#configuration ~ DD_VERSION was added in v0.36.0.

beezz avatar Dec 30 '20 15:12 beezz

Hi @beezz ! Thanks for such a quick response. I am using 0.43.0 version of dd-trace. So celery and celery-beat are able to get the version and I can see that in analytics too. But somehow it's not picking up for graphql service. Interestingly, I can see the same behavior for uvicorn service as well. Any ideas about why?

arsalasif avatar Dec 30 '20 18:12 arsalasif

Hi @beezz. Any update on this? Thank you!

arsalasif avatar Jan 07 '21 20:01 arsalasif

Hi @arsalasif! No update so far. I briefly looked into it but did not see anything obvious. Hopefully, I'll have time to take another look at the weekend.

beezz avatar Jan 13 '21 09:01 beezz

Hi @arsalasif !

I was able to track it down to this piece of code:

  • https://github.com/DataDog/dd-trace-py/blob/491c3d536fcc40e494118ceba0aa00d5c66c298a/ddtrace/tracer.py#L489-L499

Only set the version tag on internal spans.

I was able to get the version tag working by setting the environment variable DD_SERVICE to match the graphql service. By default it's graphql e.g.:

DD_SERVICE=graphql DD_VERSION=1.2.3 python app.py

If you changed the service name using the DDTRACE_GRAPHQL_SERVICE environment variable you need to set both e.g.:

DDTRACE_GRAPHQL_SERVICE=foo DD_SERVICE=foo DD_VERSION=1.2.3 python app.py

Please let me know if that works for you!

beezz avatar Jan 19 '21 09:01 beezz

Hi @beezz. I tried both approaches, one where I assigned the DDTRACE_GRAPHQL_SERVICE=web to make it same as my DD_SERVICE and container name. Another where I set DD_SERVICE=graphql. Neither approach worked unfortunately. I have no idea what's wrong here. I tried with multiple deployments and all combinations. Thank you for helping me with this!

arsalasif avatar Jan 21 '21 14:01 arsalasif