open-telemetry/opentelemetry-auto-wordpress

OpenTelemetry auto-instrumentation for Wordpress

0.0.16 2024-06-29 06:06 UTC

This package is auto-updated.

Last update: 2024-10-29 07:12:12 UTC


README

Releases Issues Source Mirror Latest Version Stable

This is a read-only subtree split of https://github.com/open-telemetry/opentelemetry-php-contrib.

OpenTelemetry Wordpress auto-instrumentation

Please read https://opentelemetry.io/docs/instrumentation/php/automatic/ for instructions on how to install and configure the extension and SDK.

Requirements

  • OpenTelemetry extension
  • OpenTelemetry SDK + exporter (required to actually export traces)
  • WordPress installation
  • OpenTelemetry SDK Autoloading configured

Overview

OpenTelemetry depends on composer, unlike Wordpress. This extension was developed against johnpbloch/wordpress-core, but it should also work with other installation methods.

An example in Docker of extending the official Wordpress image to enable auto-instrumentation: https://github.com/open-telemetry/opentelemetry-php-contrib/tree/main/examples/instrumentation/Wordpress

apache

Configure (eg via .htaccess) a PHP prepend file to initialize composer:

php_value auto_prepend_file /var/www/vendor/autoload.php

This will install the composer autoloader before running Wordpress. As part of composer autoloading, scripts are executed for installed modules, importantly:

  • OpenTelemetry SDK Autoloader
  • this library's _register.php file

Installation via composer

$ composer require open-telemetry/opentelemetry-auto-wordpress

Configuration

The extension can be disabled via runtime configuration:

OTEL_PHP_DISABLED_INSTRUMENTATIONS=wordpress