Instrument your PHP application for Splunk Observability Cloud π
The OpenTelemetry PHP extension automatically instruments PHP applications using a PHP extension and available instrumentation libraries. You can send telemetry to the Splunk Distribution of OpenTelemetry Collector or directly to the Splunk Observability Cloud ingest endpoint.
To get started, use the guided setup or follow the instructions to install manually.
Generate customized instructions using the guided setup π
To generate all the basic installation commands for your environment and application, use the PHP OpenTelemetry guided setup. To access the PHP OpenTelemetry guided setup, follow these steps:
Log in to Splunk Observability Cloud.
Open the PHP OpenTelemetry guided setup . Optionally, you can navigate to the guided setup on your own:
In the navigation menu, select
.Go to the Available integrations tab, or select Add Integration in the Deployed integrations tab.
In the integration filter menu, select By Product.
Select the APM product.
Select the PHP (OpenTelemetry) tile to open the PHP OpenTelemetry guided setup.
Install the Splunk Distribution of OpenTelemetry PHP manually π
If you donβt use the guided setup, follow these steps to manually install and automatically instrument your PHP application:
Check that you meet the requirements. See OpenTelemetry PHP instrumentation compatibility and requirements.
Install the OpenTelemetry PHP extension using PECL in the command line:
sudo apt-get install gcc make autoconf pecl install opentelemetry
Download the precompiled DLL file from the releases page on GitHub.
Make sure to place the DLL in your extensionsβs directory, as defined by the value of
extension_dir
in your php.ini file.Add the extension to your php.ini file:
[opentelemetry] extension=opentelemetry.so
[opentelemetry] extension=php_opentelemetry.dll
Install the required instrumentations you need using Composer:
php composer.phar install open-telemetry/exporter-otlp:^1.0.3 php composer.phar install php-http/guzzle7-adapter:^1.0
You can also install additional instrumentations. See Supported libraries and frameworks.
Configure the basic settings in your php.ini file or using environment variables:
OTEL_PHP_AUTOLOAD_ENABLED=true \ OTEL_SERVICE_NAME="<your-service-name>" \ OTEL_RESOURCE_ATTRIBUTES="deployment.environment=<your_env>" \
Run your application.
See the OpenTelemetry PHP examples in GitHub for sample instrumentation scenarios.
To configure the instrumentation, see Instrumentation settings.
Connect RUM to APM through server trace data π
To connect Real User Monitoring (RUM) requests from mobile and web applications with server trace data, add the OpenTelemetry server timing propagator as a dependency:
php composer.phar install open-telemetry/opentelemetry-propagation-server-timing:^0.0.2
Send data directly to Splunk Observability Cloud π
By default, all telemetry is sent to the local instance of the Splunk Distribution of OpenTelemetry Collector.
To bypass the Collector and send data directly to Splunk Observability Cloud, set the following environment variables:
OTEL_EXPORTER_OTLP_TRACES_HEADERS=x-sf-token=<access_token>
OTEL_EXPORTER_OTLP_ENDPOINT=https://ingest.<realm>.signalfx.com/trace/otlp
To obtain an access token, see Retrieve and manage user API access tokens using Splunk Observability Cloud.
To find your Splunk realm, see Note about realms.
Instrumentation settings π
You can configure the OpenTelemetry PHP extension using the following settings.