Search by

open-telemetry / opentelemetry-auto-phalcon

opentelemetry-php

OpenTelemetry auto-instrumentation for the Phalcon PHP framework

Package info

github.com/opentelemetry-php/contrib-auto-phalcon

Homepage

pkg:composer/open-telemetry/opentelemetry-auto-phalcon

Statistics

Installs: 0

Dependents: 0

Suggesters: 0

Stars: 0

Open Issues: 0

0.1.0 2026-10-01 00:19 UTC

This package is auto-updated.

Last update: 2026-10-01 00:24:36 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 Phalcon auto-instrumentation

This is an OpenTelemetry auto-instrumentation package for applications built on the Phalcon PHP framework.

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

Requirements

  • PHP >= 8.2 — hook() observes internal/extension functions (what every method on compiled Phalcon classes is) via Zend Observer API support added in PHP 8.2; on 8.1 hooks register but never fire.
  • OpenTelemetry extension
  • OpenTelemetry SDK and exporters (required to actually export traces)
  • Phalcon 5.x (ext-phalcon)

Overview

A request can reach Phalcon through several different entry points, and no single one of them covers every app — auto-instrumentation hooks all of them so exactly one root span is created regardless of which style the application uses:

  • Phalcon\Mvc\Application::handle() — full MVC apps.
  • Phalcon\Mvc\Micro::handle() — Micro apps, which route straight to a handler callable and never touch a dispatcher.
  • Phalcon\Cli\Console::handle() — CLI tasks (INTERNAL span, no HTTP attributes).
  • Phalcon\Dispatcher\AbstractDispatcher::dispatch() — fallback root, only when none of the above already started one (e.g. an app building and dispatching a Mvc\Dispatcher directly, without a surrounding Application).

The root span is named after the matched route when the application uses named routes, its raw pattern when it has one and isn't a raw-regex default route, and falls back to {controller}/{action} ({task}/{action} for CLI) otherwise.

AbstractDispatcher::callActionMethod() produces one child span (INTERNAL kind) per controller action actually invoked, including one for a forward()-ed action (Phalcon's forward() doesn't re-enter dispatch(); it makes dispatch()'s own internal loop run callActionMethod() again for the new action) and for an app manually re-dispatching to resolve a nested resource.

Installation via composer

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

Installing dependencies and executing tests

From the repository root, using the Makefile (runs inside this repo's Docker image, so you don't need PHP or Phalcon installed locally):

$ PROJECT=Instrumentation/Phalcon PHP_VERSION=8.2 make install
$ PROJECT=Instrumentation/Phalcon PHP_VERSION=8.2 make test

make all runs style, static analysis, and tests together. See make help for the full list of targets.

Configuration

The extension can be disabled via runtime configuration:

OTEL_PHP_DISABLED_INSTRUMENTATIONS=phalcon