DDTrace PHP
Install Dependencies¶
For the installation of the PHP APM plugin, refer to the Datadog PHP Integration Documentation.
Configuration¶
Depending on the PHP runtime environment (Apache/NGINX), there are some differences in the configuration. See the Datadog PHP Trace SDK Configuration Documentation.
A request in a Web project is like a process, which can cause a large data flow in the central resource directory. Therefore, it is recommended to turn off resource reporting:
#ENV
export DD_INSTRUMENTATION_TELEMETRY_ENABLED=false
#command
-Ddd.instrumentation.telemetry.enable=false
Environment Variable Support¶
Below are common PHP APM parameter configurations. For a complete list of parameters, refer to the Datadog Documentation.
-
DD_AGENT_HOSTINI:
datadog.agent_hostDefault:
localhostThe host address where DataKit is listening.
-
DD_TRACE_AGENT_PORTINI:
datadog.trace.agent_portDefault:
8126The port number where DataKit is listening, which should be manually set to 9529.
-
DD_ENVINI:
datadog.envDefault:
nullSets the environment information for the program, such as
prod/pre-prod. -
DD_SERVICEINI:
datadog.serviceDefault:
nullSets the APP service name.
-
DD_SERVICE_MAPPINGINI:
datadog.service_mappingDefault:
nullRenames APM service names, for example:
DD_SERVICE_MAPPING=pdo:payments-db,mysqli:orders-db. -
DD_TRACE_AGENT_CONNECT_TIMEOUTINI:
datadog.trace.agent_connect_timeoutDefault:
100Agent connection timeout configuration to DataKit (unit ms), default is 100.
-
DD_TAGSINI:
datadog.tagsDefault:
nullSets a list of tags that will be appended to each span by default, for example:
key1:value1,key2:value2. -
DD_VERSIONINI:
datadog.versionSets the service version.
-
DD_TRACE_SAMPLE_RATEINI:
datadog.trace.sample_rateDefault:
-1Sets the sampling rate from 0.0 (0%) to 1.0 (100%).