Download the PHP package jcleng/hyperf-opentelemetry-zincsearch without Composer
On this page you can find all versions of the php package jcleng/hyperf-opentelemetry-zincsearch. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download jcleng/hyperf-opentelemetry-zincsearch
More information about jcleng/hyperf-opentelemetry-zincsearch
Files in jcleng/hyperf-opentelemetry-zincsearch
Package hyperf-opentelemetry-zincsearch
Short Description Hyperf tracer driver for OpenTelemetry with ZincSearch exporter
License Apache-2.0
Informations about the package hyperf-opentelemetry-zincsearch
hyperf-opentelemetry-zincsearch
Hyperf tracer driver for OpenTelemetry with ZincSearch exporter.
This package provides a Hyperf tracer driver that uses the OpenTelemetry SDK with a ZincSearch exporter, bridged to Hyperf's OpenTracing abstraction via the opentracing-shim.
Architecture
Installation
The dependency jcleng/opentelemetry-exporter-zincsearch will be resolved
automatically from Packagist.
Configuration
Publish the config file (or create config/autoload/opentracing.php manually):
Set the default driver and ZincSearch connection in .env:
Config Reference
The opentracing.tracer.zincsearch config block:
| Key | Type | Required | Default | Description |
|---|---|---|---|---|
driver |
string | Yes | - | Must be ZincSearchTracerFactory::class |
app.name |
string | No | skeleton |
Service name used in trace resource attributes |
zinc_url |
string | Yes | http://127.0.0.1:4080 |
ZincSearch base URL |
zinc_password |
string | Yes | - | Base64-encoded Basic auth credential |
index_name |
string | No | exporter_zincsearch |
Target ZincSearch index name |
timeout |
float | No | 5.0 |
HTTP request timeout in seconds |
Usage
Once configured, Hyperf's built-in tracer aspects (Guzzle, Redis, DB, RPC, etc.) will automatically create spans and export them to ZincSearch.
Enable specific tracers in .env:
Swoole Coroutine Compatibility
This package uses a custom CoroutineSafeSpanProcessor instead of the
OpenTelemetry SDK's SimpleSpanProcessor. The official SimpleSpanProcessor
activates/detaches an OpenTelemetry context scope around every export call.
In a Swoole coroutine environment, Fiber::getCurrent() returns null inside
coroutines, so all coroutines share the same context scope stack. When the
export HTTP request yields the coroutine, another coroutine's scope activation
corrupts the shared stack, causing Scope: unexpected call to Scope::detach()
errors.
CoroutineSafeSpanProcessor eliminates this by not activating any context
scope during export — the ZincSearch exporter only makes an HTTP POST and does
not depend on the OpenTelemetry context.
If you use other OpenTelemetry components that also activate scopes, you can additionally suppress debug scope warnings via environment variable:
Trace Export Recursion Prevention
When TRACER_ENABLE_GUZZLE=true, Hyperf's HttpClientAspect intercepts all
GuzzleHttp\Client requests via AOP and creates trace spans. Without protection,
the Transport's own Guzzle request to ZincSearch would be intercepted, creating
a new span that triggers another export, forming an infinite recursion:
This package prevents the loop by passing 'no_aspect' => true in the Guzzle
request options via the guzzle_options config key. HttpClientAspect
checks this option and skips tracing when set. In non-Hyperf environments,
Guzzle silently ignores unknown options, so the exporter package remains
framework-agnostic.
You can customize guzzle_options in config/autoload/opentracing.php:
License
Apache-2.0
All versions of hyperf-opentelemetry-zincsearch with dependencies
hyperf/contract Version ~3.1.0
hyperf/tracer Version ~3.1.0
jcleng/opentelemetry-exporter-zincsearch Version ^1.0
open-telemetry/opentracing-shim Version ^0.0.3
open-telemetry/sdk Version ^1.9
open-telemetry/sem-conv Version ^1.0
opentracing/opentracing Version ^1.0
psr/log Version ^1.1 || ^2.0 || ^3.0