dd-trace-php
dd-trace-php copied to clipboard
[BUG] agent_url issue with ipv6 only Kubernetes
Bug description
It appears when using DDTrace in a IPv6 only environment, the agent url may be detected as invalid. Amazon AWS EKS now supports IPv6 only clusters
PHP version
7.4.30
Tracer version
0.73.0
Diagnostics and configuration
The DD_AGENT_HOST variable is set correctly to a IPv6 address of the DD Agent.
DD_AGENT_HOST=2a05:d01c:806:8003:xxxx:xxxx:d572:58be
This gets converted to the agent_url:
agent_url: http://2a05:d01c:806:8003:xxxx:xxxx:d572:58be:8126"
Which results in the agent_error:
URL using bad\/illegal format or missing URL
It should probably construct the url like this instead:
agent_url: http://[2a05:d01c:806:8003:xxxx:xxxx:d572:58be]:8126"
Output of phpinfo() (ddtrace >= 0.47.0)
DATADOG TRACER CONFIGURATION => {"date":"2022-07-25T02:20:37Z","os_name":"Linux lp-accounts-694f758f9c-dlcst 5.4.196-108.356.amzn2.x86_64 #1 SMP Thu May 26 12:49:47 UTC 2022 x86_64","os_version":"5.4.196-108.356.amzn2.x86_64","version":"0.73.0","lang":"php","lang_version":"7.4.21","env":"produk","enabled":true,"service":"lp-accounts","enabled_cli":false,"agent_url":"http:\/\/2a05:d01c:806:8003:xxxx:xxxx:d572:58be:8126","debug":false,"analytics_enabled":false,"sample_rate":1,"sampling_rules":[],"tags":[],"service_mapping":[],"distributed_tracing_enabled":true,"priority_sampling_enabled":true,"dd_version":"b6ec9edb","architecture":"x86_64","sapi":"cli","datadog.trace.request_init_hook":"\/opt\/datadog-php\/dd-trace-sources\/bridge\/dd_wrap_autoloader.php","open_basedir_configured":false,"uri_fragment_regex":null,"uri_mapping_incoming":null,"uri_mapping_outgoing":null,"auto_flush_enabled":false,"generate_root_span":true,"http_client_split_by_domain":true,"measure_compile_time":true,"report_hostname_on_root_span":false,"traced_internal_functions":null,"auto_prepend_file_configured":false,"integrations_disabled":"default","enabled_from_env":false,"opcache.file_cache":null,"agent_error":"URL using bad\/illegal format or missing URL"}
Hey @NickStallman,
I agree, this is not correct. As a workaround, use DD_TRACE_AGENT_URL="http://[2a05:d01c:806:8003:xxxx:xxxx:d572:58be]:8126". We will fix this issue soon.