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 nameSupported versionsInstrumentation package
AWS SDK for PHP (aws/aws-sdk-php)>= 3.0.0, < 4.0.0open-telemetry/opentelemetry-auto-aws-sdk
CakePHP>= 4.0.0, < 6.0.0open-telemetry/opentelemetry-auto-cakephp
CodeIgniter 4>= 4.3.0, < 5.0.0open-telemetry/opentelemetry-auto-codeigniter
Doctrine DBAL>= 3.0.0, < 6.0.0open-telemetry/opentelemetry-auto-doctrine
Guzzle>= 7.0.0, < 9.0.0open-telemetry/opentelemetry-auto-guzzle
HTTPlug (php-http/httplug)>= 2.0.0, < 3.0.0open-telemetry/opentelemetry-auto-http-async
Laravel>= 6.0.0, < 14.0.0open-telemetry/opentelemetry-auto-laravel
Magento 2 (magento/framework)>= 103.0.0, < 104.0.0open-telemetry/opentelemetry-auto-magento2
MongoDB PHP library (mongodb/mongodb)>= 1.15.0, < 3.0.0open-telemetry/opentelemetry-auto-mongodb
OpenAI PHP client (openai-php/client)Not yet documented upstreamopen-telemetry/opentelemetry-auto-openai-php
PSR-3 loggers (psr/log)>= 1.0.0, < 4.0.0open-telemetry/opentelemetry-auto-psr3
PSR-6 caches (psr/cache)>= 1.0.0, < 4.0.0open-telemetry/opentelemetry-auto-psr6
PSR-14 event dispatchers (psr/event-dispatcher)>= 1.0.0, < 2.0.0open-telemetry/opentelemetry-auto-psr14
PSR-15 middleware (psr/http-server-middleware)>= 1.0.0, < 2.0.0open-telemetry/opentelemetry-auto-psr15
PSR-16 caches (psr/simple-cache)>= 1.0.0, < 4.0.0open-telemetry/opentelemetry-auto-psr16
PSR-18 HTTP clients (psr/http-client)>= 1.0.0, < 2.0.0open-telemetry/opentelemetry-auto-psr18
ReactPHP HTTP (react/http)>= 1.11.0, < 2.0.0open-telemetry/opentelemetry-auto-reactphp
Slim>= 4.0.0, < 5.0.0open-telemetry/opentelemetry-auto-slim
Symfony (symfony/http-kernel)Not yet documented upstreamopen-telemetry/opentelemetry-auto-symfony
Yii 2>= 2.0.13, < 3.0.0open-telemetry/opentelemetry-auto-yii

Check your applications before you instrument

☝️

Public preview feature

You 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.

  1. From the left navigation rail, select Data & integrations > Add data.
  2. 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.
  1. 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:

  1. Follow the steps in Install the OpenTelemetry extension in the OpenTelemetry documentation to install the required operating system and PECL packages.
  2. Import the libraries.
    1. 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
    1. Use the following commands for Wordpress apps:
    composer require \
        open-telemetry/sdk \
        open-telemetry/exporter-otlp \ 
        open-telemetry/opentelemetry-auto-wordpress
  3. 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.


Did this page help you?