open-telemetry/api
OpenTelemetry PHP API package providing the core interfaces and no-op implementations for tracing, metrics, and context propagation. Use it to instrument libraries and apps while remaining exporter/SDK agnostic and compatible with OpenTelemetry.
opentelemetry-php-contrib).opentelemetry-python, opentelemetry-go)."OpenTelemetry’s PHP API is a strategic investment to standardize observability across our PHP services. By adopting this open standard, we’ll:
- Reduce debugging time by 40%+ with end-to-end request tracing (e.g., track a user’s checkout flow from frontend to payment processor).
- Cut costs by replacing proprietary tools (e.g., New Relic) with a vendor-neutral solution that works across clouds (AWS, GCP, Azure).
- Future-proof compliance with GDPR/audit requirements by instrumenting data flows automatically.
- Accelerate feature development by reusing auto-instrumentation for Laravel/Symfony, reducing manual setup. This aligns with our 2024 observability roadmap and requires minimal upfront effort—just a Composer dependency and configuration."
"This is the official OpenTelemetry API for PHP, giving us:
- Standardized instrumentation for traces, metrics, and logs (no more homegrown solutions).
- Auto-instrumentation hooks for Laravel/Symfony to trace HTTP requests, database queries, and queues with minimal code.
- Multi-backend support: Export to Jaeger, Prometheus, or OTLP collectors without rewriting instrumentation.
- Active community: Backed by the OpenTelemetry project (CNCF) with regular updates. Implementation path:
- Add
open-telemetry/apitocomposer.json.- Integrate with an exporter (e.g.,
opentelemetry/exporter-otlp).- Instrument critical paths (e.g., API routes, background jobs) using the
SpanAPI. Example:use OpenTelemetry\API\Trace\TracerInterface; $tracer = \OpenTelemetry\API\GlobalTracer::getTracer('my-service'); $span = $tracer->spanBuilder('process-order')->startSpan(); try { // Business logic } finally { $span->end(); } ```" *Dependencies:* - PHP 8.1+. - Backend storage (e.g., Jaeger, Prometheus) for visualization."*
"This enables:
- Consistent telemetry across PHP services, simplifying monitoring dashboards and alerts.
- Context propagation for logs/metrics (e.g., correlate a failed payment with its trace ID).
- Cost-efficient scaling: Use OTLP exporters to send data to your preferred backend (e.g., Tempo for traces, Prometheus for metrics). Key ask: Ensure the OTLP collector/endpoint is configured to receive PHP telemetry (default port: 4317)."*
Call to Action: "Let’s prototype this in [Service X] by [date] to validate the impact on debugging time and cost. I’ll provide a spike plan with instrumentation examples."
How can I help you explore Laravel packages today?