sarigue/curlmetry
最新稳定版本:v1.0.0
Composer 安装命令:
composer require sarigue/curlmetry
包简介
OpenTelemetry Client (SigNoz compatible) for PHP 5.6
README 文档
README
Curlmetry
🌀 PSR-18 / PSR-7 OpenTelemetry trace exporter for PHP 5.6 — powered by curl
Curlmetry is a lightweight tracing library for legacy PHP applications (5.6+).
It exports spans to SigNoz or Jaeger via HTTP, and provides a native PSR-18 client using plain curl.
No Guzzle. No Symfony. No Composer autoload hell. Just PSR + curl.
✨ Features
- 📦 PSR-18 client (native curl-based)
- 📡 Exports spans to:
- OTLP (SigNoz via HTTP JSON)
- Jaeger (via
/api/traces)
- 🔧 Span / Tracer / Scope system (OpenTelemetry-style)
- 🧵 Context management (
attach(),detach(),Scope) - 🕵️ Exception + status reporting
- 🐘 Works with PHP 5.6
📦 Installation
composer require sarigue/curlmetry
Or just clone and
require 'vendor/autoload.php';
🚀 Example: OTLP export
use Curlmetry\Tracer; use Curlmetry\Exporter\OtlpExporter; use Curlmetry\Processor\SimpleSpanProcessor; $exporter = new OtlpExporter('http://localhost:4318/v1/traces'); $processor = new SimpleSpanProcessor($exporter, 'curlmetry-demo'); $tracer = new Tracer($processor); $tracer->startActiveSpan('http.request', function ($span) { $span->setAttribute('http.method', 'GET'); $span->addEvent('processing', ['step' => 'controller']); usleep(5000); });
🌐 PSR-18 usage
use Curlmetry\Psr\CurlHttpClient; use Curlmetry\Psr\Request; $client = new CurlHttpClient(); $request = new Request( 'POST', 'http://localhost:4318/v1/traces', ['Content-Type' => ['application/json']], json_encode(['resourceSpans' => [...]]) ); $response = $client->sendRequest($request); echo $response->getStatusCode();
📚 Docs
- demo.php — standard usage
- demo-psr.php — manual PSR request
- demo-jaeger.php — Jaeger JSON exporter
🛠 Roadmap
- OTLP export (HTTP JSON)
- Jaeger export
- PSR-18 Curl client
- Scope context
- Trace context propagation (W3C)
- Batch processor
- Middleware integration
📝 License
Apache 2.0 — © 2025 Sarigue
统计信息
- 总下载量: 2
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: Apache-2.0
- 更新时间: 2025-04-20
