PHPackages                             zorzi23/custom-auto-open-telemetry - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. zorzi23/custom-auto-open-telemetry

ActiveLibrary

zorzi23/custom-auto-open-telemetry
==================================

211[1 PRs](https://github.com/Zorzi23/Caop/pulls)PHP

Since Jul 1Pushed 10mo agoCompare

[ Source](https://github.com/Zorzi23/Caop)[ Packagist](https://packagist.org/packages/zorzi23/custom-auto-open-telemetry)[ RSS](/packages/zorzi23-custom-auto-open-telemetry/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependenciesVersions (1)Used By (0)

📡 PHP Auto Custom OpenTelemetry Library
=======================================

[](#-php-auto-custom-opentelemetry-library)

A PHP library for **automatic telemetry using [OpenTelemetry](https://opentelemetry.io/)**, enabling function and method monitoring via YAML configuration with minimal code changes.

---

🎞️ Installation
---------------

[](#️-installation)

Install via Composer from [Packagist](https://packagist.org/packages/zorzi23/custom-auto-open-telemetry):

```
composer require zorzi23/custom-auto-open-telemetry
```

[View on Packagist »](https://packagist.org/packages/zorzi23/custom-auto-open-telemetry)

---

⚙️ Requirements
---------------

[](#️-requirements)

- PHP &gt;= 8.0
- `opentelemetry` PHP extension enabled
- Required PHP extensions: `json`, `curl`, etc.
- Core dependencies:

    - `open-telemetry/opentelemetry`
    - `open-telemetry/sdk`
    - `open-telemetry/exporter-otlp`
    - `symfony/yaml`
    - `zorzi23/object_flow`

---

🛠️ PHP Configuration (`php.ini`)
--------------------------------

[](#️-php-configuration-phpini)

```
[opentelemetry]
extension=opentelemetry.so
opentelemetry.allow_stack_extension=1

OTEL_PHP_AUTOLOAD_ENABLED=true
OTEL_SERVICE_NAME=your-service-name
OTEL_EXPORTER_OTLP_PROTOCOL=http/protobuf
OTEL_EXPORTER_OTLP_ENDPOINT=http://192.168.197.33:4318
OTEL_PROPAGATORS=baggage,tracecontext
;OTEL_TRACES_EXPORTER=console ; Uncomment for local testing only
```

---

📅 YAML Configuration Example
----------------------------

[](#-yaml-configuration-example)

The library uses YAML files to declare which functions, methods, or classes should be instrumented. The structure supports nested `children` to define span hierarchies.

Example main config (`telemetry_config.yml`):

```
version: 1.0
name: 'Caop'
entities:
  - class: "CaOp\\Template\\TelemetryTemplates"
    method: "handleRequest"
    span_name: 'RequestInfo 😎'
    include:
      - file: "curl_telemetry_config.yml"
      - file: "postgres_telemetry_config.yml"
```

- The included YAML files (e.g., `curl_telemetry_config.yml`, `postgres_telemetry_config.yml`) define detailed instrumentation rules for specific libraries or domains.
- Each included file contains its own `entities` section specifying functions, span attributes, sensitive data masking, etc.

---

🚀 Usage Example
---------------

[](#-usage-example)

```
