auxmoney/opentracing-bundle-zipkin
opentracing-php).spatie/laravel-monitoring (for structured logging) or custom Zipkin reporters could bridge the gap.auxmoney/opentracing-bundle-core (Symfony-specific) and opentracing/opentracing-php.opentracing/opentracing-php directly with a custom Zipkin reporter (e.g., open-telemetry/opentelemetry-php for OTel compatibility).AUXMONEY_OPENTRACING_SAMPLER_CLASS). Laravel’s .env can mirror Symfony’s config.TracerInterface bindings).openzipkin/zipkin). Laravel teams must ensure compatibility with Zipkin’s HTTP API.Tracer into Laravel’s Kernel).monolog handlers)?opentracing/opentracing-php (v2.0+) for tracer abstraction.HttpReporter (leveraging Laravel’s HttpClient) or use zipkin-reporter-php.X-B3-TraceId headers).open-telemetry/opentelemetry-php) for future-proofing.Monolog\Handler\ZipkinHandler.opentracing/opentracing-php and zipkin-reporter-php.use OpenTracing\Tracer;
use OpenTracing\Span;
$tracer = new \OpenTracing\Tracer();
$span = $tracer->buildSpan('laravel.route')->start();
try {
// Business logic
} finally {
$span->finish();
}
app/Http/Middleware/TracingMiddleware.php:
public function handle($request, Closure $next) {
$span = \OpenTracing\globalTracer()->buildSpan('http.request')->start();
try {
$response = $next($request);
$span->setTag('http.method', $request->method());
return $response;
} finally {
$span->finish();
}
}
zipkin-reporter-php in bootstrap/app.php:
$reporter = new \Zipkin\Reporter\Http(
'http://zipkin:9411/api/v2/spans',
new \GuzzleHttp\Client()
);
\OpenTracing\globalTracer()->registerSpanProcessor(
new \Zipkin\SpanProcessor($reporter)
);
Zipkin\Samplers\PercentageSampler (e.g., 10% sampling) via environment variables:
ZIPKIN_SAMPLER_CLASS=Zipkin\Samplers\PercentageSampler
ZIPKIN_SAMPLER_RATE=0.1
Illuminate\Queue).// app/Providers/TracingServiceProvider.php
public function register() {
$this->app->singleton(TracerInterface::class, function () {
return require __DIR__.'/../../vendor/auxmoney/opentracing-bundle-zipkin/Resources/config/services.php';
});
}
X-B3-TraceId, X-B3-SpanId, etc., are propagated across Laravel services (e.g., via tap-proxy or service containers).opentracing/opentracing-php and zipkin-reporter-php for breaking changes..env (e.g., ZIPKIN_SERVICE_NAME=laravel-app).X-B3-TraceId in monolog handlers.globalTracer() is initialized before spans are created.AUXMONEY_OPENTRACING_SAMPLER_VALUE is JSON-decodable.TRACING.md to the Laravel repo with:
laravel-debugbar or Blackfire.AsyncReporter to reduce Zipkin server load.ZIPKIN_SAMPLER_RATE based on trace volume (e.g., 1% for high-traffic APIs).| Failure | Impact | Mitigation |
|---|---|---|
| Zipkin server down | Traces lost; no distributed context. | Use local buffering (e.g., InMemorySpanStore). |
| Sampling misconfiguration | No traces or 100% overhead. | Validate `AUXMONEY_OPENTRACING_SAM |
How can I help you explore Laravel packages today?