https://github.com/opencodeco/hyperf-opentelemetry
OpenTelemetry instrumentation for Hyperf framework
https://github.com/opencodeco/hyperf-opentelemetry
Last synced: 3 months ago
JSON representation
OpenTelemetry instrumentation for Hyperf framework
- Host: GitHub
- URL: https://github.com/opencodeco/hyperf-opentelemetry
- Owner: opencodeco
- License: mit
- Created: 2025-09-23T12:10:33.000Z (7 months ago)
- Default Branch: main
- Last Pushed: 2025-11-07T19:17:15.000Z (6 months ago)
- Last Synced: 2026-01-06T16:46:19.573Z (4 months ago)
- Language: PHP
- Size: 142 KB
- Stars: 4
- Watchers: 0
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
Awesome Lists containing this project
README
# hyperf-opentelemetry
[]() []() []() []() []()
Instrumentation library for Hyperf applications with OpenTelemetry support.
This library enables instrumentation of Hyperf-based applications for exporting metrics, traces, and logs compatible with the OpenTelemetry standard.
---
## ✨ Features
- 📦 Ready-to-use with Swoole and Coroutine
- 📊 Custom metrics support via Meter
- 📈 Trace instrumentation for:
- HTTP requests (Hyperf\HttpServer)
- Redis
- Guzzle
- SQL queries (Hyperf\Database)
- ♻️ Integration with Swoole ContextStorage
---
## 📦 Installation
```shell
composer require opencodeco/hyperf-opentelemetry
```
---
## ⚙️ Configuration
1. Publish the configuration file
```shell
php bin/hyperf.php vendor:publish opencodeco/hyperf-opentelemetry
```
Edit the file config/autoload/open-telemetry.php to adjust settings (enable/disable features, OTLP endpoints, resource attributes, etc).
2. Configure environment variables
Example .env:
```shell
OTEL_TRACES_ENDPOINT=http://otelcol:4318/v1/traces
OTEL_METRICS_ENDPOINT=http://otelcol:4318/v1/metrics
```
3. Add instrumentation middlewares
config/autoload/middlewares.php:
```php
[
MetricMiddleware::class,
TraceMiddleware::class,
],
];
```
---
## 👨💻 Development
Build the image
```shell
make build
```
Install dependencies
```shell
make install
```
Run tests
```shell
make test
```
---
## 🤝 Contributing
Please see [CONTRIBUTING](CONTRIBUTING.md) for details.