Download the PHP package kaz29/cakephp-otel-plugin without Composer

On this page you can find all versions of the php package kaz29/cakephp-otel-plugin. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package cakephp-otel-plugin

CakePHP OpenTelemetry Plugin

Tests

日本語版🇯🇵

A CakePHP 5 plugin that adds OpenTelemetry instrumentation to your application. It uses ext-opentelemetry's zend_observer hooks to automatically generate spans for Controller and Table operations without any code changes.

Requirements

Installation

Load the plugin in config/bootstrap.php or Application::bootstrap():

Instrumented Targets

Target Span name example
Controller::invokeAction App\Controller\UsersController::index
Table::find Users.find(all)
Table::save Users.save
Table::delete Users.delete

Excluding Instrumentation

Some endpoints — health checks called every few seconds by load balancers and orchestrators, for example — generate high volumes of low-value spans that bloat your telemetry backend. You can opt out specific Controller/action pairs from instrumentation:

Matching is exactcontroller must be the fully-qualified class name and action must match the action name verbatim. The single exception is 'action' => '*', which matches every action of that controller. '*' is not allowed on controller.

While an excluded action is executing, child Table::find/save/delete calls and custom-hook spans are also suppressed, so a single rule cleans up the whole subtree. Once the action returns, instrumentation resumes for subsequent requests.

This setting only affects HTTP requests dispatched through Controller::invokeAction. CLI commands are not instrumented in the first place.

Custom Instrumentation

You can instrument any class method by registering custom hooks. The plugin uses the same \OpenTelemetry\Instrumentation\hook() mechanism as the built-in Controller/Table instrumentation.

Note: Controller::invokeAction, Table::find, Table::save, and Table::delete are already instrumented by the plugin. Do not register them as custom hooks — doing so would create duplicate spans.

Via Configure (simple)

Via static registration (advanced)

Use CustomInstrumentation::register() when you need dynamic attributes via callback:

Options

Option Type Default Description
class string (required) Fully qualified class name
method string (required) Method name to hook
spanName string\|null FQCN::method Custom span name
kind int KIND_INTERNAL SpanKind constant
attributes array [] Static span attributes
attributeCallback Closure\|null null fn($instance, $params, $class, $function): array — use register() instead of Configure for this option

Environment Variables

OtelErrorLoggingMiddleware

A PSR-15 middleware that catches 500-level exceptions and emits them as OpenTelemetry log records. The log is automatically associated with the current span, so you can view related errors directly in your trace backend (Jaeger, Grafana Tempo, etc.).

Setup

Add it after ErrorHandlerMiddleware in your Application::middleware():

TraceAwareLogger

A PSR-3 LoggerInterface decorator that automatically injects trace_id / span_id into log context.

License

MIT


All versions of cakephp-otel-plugin with dependencies

PHP Build Version
Package Version
Requires php Version ^8.1
ext-opentelemetry Version *
cakephp/cakephp Version ^5.0
open-telemetry/api Version ^1.0
open-telemetry/sdk Version ^1.0
open-telemetry/exporter-otlp Version ^1.0
psr/log Version ^2.0 || ^3.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package kaz29/cakephp-otel-plugin contains the following files

Loading the files please wait ...