This guide shows you how to use the Elastic Distribution of OpenTelemetry PHP (EDOT PHP) to instrument your PHP application and send OpenTelemetry data to an Elastic Observability deployment.
Already familiar with OpenTelemetry? It's an explicit goal of this distribution to introduce no new concepts outside those defined by the wider OpenTelemetry community.
New to OpenTelemetry? This section will guide you through the minimal configuration options to get EDOT PHP set up in your application. You do not need any existing experience with OpenTelemetry to set up EDOT PHP initially. If you need more control over your configuration after getting set up, you can learn more in the OpenTelemetry documentation.
Before getting started, you'll need somewhere to send the gathered OpenTelemetry data so it can be viewed and analyzed. EDOT PHP supports sending data to any OpenTelemetry protocol (OTLP) endpoint, but this guide assumes you are sending data to an Elastic Observability cloud deployment. You can use an existing one or set up a new one.
Expand for setup instructions
To create your first Elastic Observability deployment:
- Sign up for a free Elastic Cloud trial or sign into an existing account.
- Go to https://cloud.elastic.co/home.
- Click Create deployment.
- When the deployment is ready, click Open to visit your Kibana home page (for example,
https://{DEPLOYMENT_NAME}.kb.{REGION}.cloud.es.io/app/home#/getting_started
).
Currently only Linux operating system is supported.
Supported PHP versions are 8.1-8.4. You can find more details in supported technologies doc.
See limitations about other limitations of EDOT PHP.
To install EDOT PHP use one of the packages for supported platforms.
rpm -ivh <package-file>.rpm
dpkg -i <package-file>.deb
apk add --allow-untrusted <package-file>.apk
After installing EDOT PHP, configure and initialize it to start sending data to Elastic.
To configure EDOT PHP, at a minimum you'll need your Elastic Observability cloud deployment's OTLP endpoint and
authorization data to set a few OTLP_*
environment variables that will be available when running EDOT PHP:
OTEL_EXPORTER_OTLP_ENDPOINT
: The full URL of the endpoint where data will be sent.OTEL_EXPORTER_OTLP_HEADERS
: A comma-separated list ofkey=value
pairs that will be added to the headers of every request. This is typically used for authentication information.
You can find the values of the endpoint and header variables in Kibana's APM tutorial. In Kibana:
- Go to Setup guides.
- Select Observability.
- Select Monitor my application performance.
- Scroll down and select the OpenTelemetry option.
- The appropriate values for
OTEL_EXPORTER_OTLP_ENDPOINT
andOTEL_EXPORTER_OTLP_HEADERS
are shown there.
Here's an example:
export OTEL_EXPORTER_OTLP_ENDPOINT=https://my-deployment.apm.us-west1.gcp.cloud.es.io
export OTEL_EXPORTER_OTLP_HEADERS="Authorization=Bearer P....l"
To confirm that EDOT PHP has successfully connected to Elastic:
- Go to APM → Traces.
- You should see the name of the service to which you just added EDOT PHP. It can take several minutes after initializing EDOT PHP for the service to show up in this list.
- Click on the name in the list to see trace data.
Note
There may be no trace data to visualize unless you have used your application since initializing EDOT PHP.
- Reference all available configuration options.
- Learn more about viewing and interpreting data in the Observability guide.