Send PHP application data to Observe
This page describes how to install the Observe Agent, then instrument your PHP applications to send data to Observe by Snowflake.
To manually instrument custom logic, see Instrumentation for PHP in the OpenTelemetry documentation.
Supported libraries and frameworks
OpenTelemetry auto-instruments the following PHP libraries and frameworks on PHP 8.1 and later. Install each library's instrumentation package with Composer, alongside the OpenTelemetry PHP extension. These libraries are supported by OpenTelemetry but are not certified for compatibility with Observe by Snowflake APM. For the upstream list, see Instrumentation in the OpenTelemetry PHP contrib repository on GitHub.
| Library name | Supported versions | Instrumentation package |
|---|---|---|
| AWS SDK for PHP (aws/aws-sdk-php) | >= 3.0.0, < 4.0.0 | open-telemetry/opentelemetry-auto-aws-sdk |
| CakePHP | >= 4.0.0, < 6.0.0 | open-telemetry/opentelemetry-auto-cakephp |
| CodeIgniter 4 | >= 4.3.0, < 5.0.0 | open-telemetry/opentelemetry-auto-codeigniter |
| Doctrine DBAL | >= 3.0.0, < 6.0.0 | open-telemetry/opentelemetry-auto-doctrine |
| Guzzle | >= 7.0.0, < 9.0.0 | open-telemetry/opentelemetry-auto-guzzle |
| HTTPlug (php-http/httplug) | >= 2.0.0, < 3.0.0 | open-telemetry/opentelemetry-auto-http-async |
| Laravel | >= 6.0.0, < 14.0.0 | open-telemetry/opentelemetry-auto-laravel |
| Magento 2 (magento/framework) | >= 103.0.0, < 104.0.0 | open-telemetry/opentelemetry-auto-magento2 |
| MongoDB PHP library (mongodb/mongodb) | >= 1.15.0, < 3.0.0 | open-telemetry/opentelemetry-auto-mongodb |
| OpenAI PHP client (openai-php/client) | Not yet documented upstream | open-telemetry/opentelemetry-auto-openai-php |
| PSR-3 loggers (psr/log) | >= 1.0.0, < 4.0.0 | open-telemetry/opentelemetry-auto-psr3 |
| PSR-6 caches (psr/cache) | >= 1.0.0, < 4.0.0 | open-telemetry/opentelemetry-auto-psr6 |
| PSR-14 event dispatchers (psr/event-dispatcher) | >= 1.0.0, < 2.0.0 | open-telemetry/opentelemetry-auto-psr14 |
| PSR-15 middleware (psr/http-server-middleware) | >= 1.0.0, < 2.0.0 | open-telemetry/opentelemetry-auto-psr15 |
| PSR-16 caches (psr/simple-cache) | >= 1.0.0, < 4.0.0 | open-telemetry/opentelemetry-auto-psr16 |
| PSR-18 HTTP clients (psr/http-client) | >= 1.0.0, < 2.0.0 | open-telemetry/opentelemetry-auto-psr18 |
| ReactPHP HTTP (react/http) | >= 1.11.0, < 2.0.0 | open-telemetry/opentelemetry-auto-reactphp |
| Slim | >= 4.0.0, < 5.0.0 | open-telemetry/opentelemetry-auto-slim |
| Symfony (symfony/http-kernel) | Not yet documented upstream | open-telemetry/opentelemetry-auto-symfony |
| Yii 2 | >= 2.0.13, < 3.0.0 | open-telemetry/opentelemetry-auto-yii |
Check your applications before you instrument
Public preview featureYou may access and use this preview feature solely for internal evaluation purposes. Previews are provided as-is. Your use of this preview is subject to the Snowflake Preview Terms located at https://www.snowflake.com/en/legal.
Run observe instrumentation audit in your project to check each application's PHP version and Composer packages against OpenTelemetry's support, using the versions resolved in composer.lock. Pass a CycloneDX SBOM with --sbom to check the packages your dependencies pull in too. See Check OpenTelemetry readiness with the Observe by Snowflake CLI.
Get the Observe Agent
Use the Add Data portal in the product to get the Observe Agent installed in your environment.
- From the left navigation rail, select Data & integrations > Add data.
- In the Observe Agent section, pick your environment, then follow the instructions to create a data ingest token and install the Observe Agent.
Depending on the environment you select, you are asked to select some options for installing and configuring the Observe Agent.
Customize your Observe Agent installation in Kubernetes with the following options:
- Decide what data you want to collect: logs and/or metrics.
- Whether or not to enable fleet monitoring.
- Specify the environment value (
deployment.environment.name) to enable usage and cost breakdowns.
Customize your Observe Agent installation on Linux, macOS, or Windows with the following options:
- Decide what data you want to collect: logs and/or metrics.
- Whether or not to enable fleet monitoring.
- Specify usage attribution tags for service (
service.name), environment (deployment.environment.name), and team (team.name) so you can break down your Observe usage and cost in reports.
- Follow the remainder of the instructions to install the Observe Agent and verify that your data is being received.
After the Observe Agent is installed, you can Instrument your PHP application.
Instrument your PHP application
Perform the following steps:
- Follow the steps in Install the OpenTelemetry extension in the OpenTelemetry documentation to install the required operating system and PECL packages.
- Import the libraries.
- Use the following commands for regular PHP apps:
composer require \ open-telemetry/sdk \ open-telemetry/exporter-otlp \ open-telemetry/opentelemetry-auto-slim \ open-telemetry/opentelemetry-auto-psr18- Use the following commands for Wordpress apps:
composer require \ open-telemetry/sdk \ open-telemetry/exporter-otlp \ open-telemetry/opentelemetry-auto-wordpress - Set the following environment variables. Replace the placeholders such as
${YOUR_SERVICE_NAME}with the actual information from your environment.OTEL_SERVICE_NAME=${YOUR_SERVICE_NAME} OTEL_RESOURCE_ATTRIBUTES=deployment.environment=${YOUR_APP_ENVIRONMENT} OTEL_EXPORTER_OTLP_ENDPOINT=http://${YOUR_OBSERVE_AGENT_ENDPOINT}:4318 OTEL_TRACES_EXPORTER=otlp OTEL_METRICS_EXPORTER=otlp OTEL_LOGS_EXPORTER=otlp OTEL_PHP_AUTOLOAD_ENABLED=true
Next steps
Navigate to Traces in your Observe by Snowflake tenant to view traces from your application.
- Use Trace Explorer to find traces in your environment.
- Use service management to view your services and their dependencies.
- Monitor and track new deployments on your service.
- View logs associated with a trace.
- Use the APM reference to see what data is collected by APM.
Updated 5 days ago