eerzho/opentelemetry-auto-class-symfony
ext-opentelemetry or OpenTelemetry PHP SDK updates.eerzho/opentelemetry-auto-class-symfony and ext-opentelemetry versions in composer.json to avoid surprises.#[Traceable] as business logic evolves.*Service classes) to avoid ad-hoc instrumentation.ext-opentelemetry or incorrect configuration.exclude).debug:container to verify instrumented services.OTEL_PHP_DISABLED_INSTRUMENTATIONS=class to toggle tracing.#[Traceable] attributes adds minimal overhead during cache:clear or cache:warmup. Test in staging with a large service count.ext-opentelemetry is optimized but may add ~1–5ms per traced method call.AlwaysOn, Probability) to reduce volume in high-cardinality systems.opentelemetry/php-instrumentation for AMQP).| Failure Scenario | Impact | Mitigation |
|---|---|---|
ext-opentelemetry crashes |
No tracing data; potential PHP crashes. | Fallback to manual spans or disable instrumentation via OTEL_PHP_DISABLED_INSTRUMENTATIONS. |
| Attribute reflection errors | Broken services or silent failures. | Validate attributes with #[Traceable] in CI (e.g., PHPStan). |
| OpenTelemetry exporter fails | Spans generated but not exported. | Configure retry logic in exporter (e.g., batching, dead-letter queues). |
| Symfony container compilation fails | No instrumented services. | Isolate the bundle in a separate environment for testing. |
| High cardinality spans | Exporter overload or storage costs. | Use sampling, attribute filtering, or resource limits (e.g., OTEL_RESOURCE_ATTRIBUTES). |
| Attribute conflicts | Unexpected behavior in custom attributes. | Test with Symfony’s attribute system (e.g., #[AsService]). |
#[Traceable] usage and attribute options.OrderService).debug:container commands).#[Traceable] attributes (e.g., PHPStan rules).#[Traceable(ignore: true)] for opt-out).OTEL_PHP_DISABLED_INSTRUMENTATIONS=class in environment variables.TraceableBundle from config/bundles.php.composer remove eerzho/opentelemetry-auto-class-symfony.Tracer->spanBuilder()).use OpenTelemetry\API\Trace\TracerInterface;
class OrderService {
public function __construct(private TracerInterface $tracer) {}
public function create(array $items): void {
$span = $this->tracer->spanBuilder('OrderService::create')->startSpan();
try {
// Business logic
} finally {
$span->end();
}
}
}
How can I help you explore Laravel packages today?