DataDog / kong-plugin-ddtrace

Datadog APM Plugin for Kong Gateway
Apache License 2.0
15 stars 7 forks source link

Allow agent host to be configured via environment variable #6

Closed zarakay closed 1 year ago

zarakay commented 1 year ago

We use datadog APM all over our infrastructure. Our applications are containerised and run on ECS, so we resolve the ip of the host that the application is running on during boot time based on the documentation here https://docs.datadoghq.com/containers/amazon_ecs/apm/?tab=ec2metadataendpoint

Similarly, we run Kong as a container on our ECS cluster and we deploy our Kong configuration separately through the use of deck. Since each Kong container replica can run on a different host, we need each instance of the plugin to use a different ip. To achieve this, it would be useful to allow the plugin to dynamically fetch the agent ip from an environment variable instead of having a static value.

zarakay commented 1 year ago

Did some more digging here, I believe this is now natively solvable using the vault system that is now a part of Kong. https://docs.konghq.com/gateway/latest/kong-enterprise/secrets-management/#what-can-be-stored-as-a-secret

The only thing this plugin needs to do, is to make the agent_endpoint field referenceable, similar to how it is in the native datadog plugin

https://github.com/Kong/kong/blob/master/kong/plugins/datadog/schema.lua#L78