Search by

enthusiast / worker-template

konstantin_popov

There is no license information available for the latest version (1.2.9) of this package.

Base worker parts

Package info

github.com/gfsx0259/worker-template

pkg:composer/enthusiast/worker-template

Statistics

Installs: 320

Dependents: 1

Suggesters: 0

Stars: 0

Open Issues: 0

1.2.9 2026-09-11 09:04 UTC

README

Sharing common worker parts: instrumentation, queue logic etc.

Kafka tracing

AbstractBufferedConsumer does not manage spans. Lifecycle is owned by open-telemetry/opentelemetry-auto-ext-rdkafka:

  1. KafkaConsumer::consume → start consumer span (+ parent from message traceparent)
  2. app processes the message (PSR-3 span-events hook writes to current span)
  3. acknowledgecommit / commitAsync → end span

Do not call Span::getCurrent()->end() in the consumer loop: it races the commit hook and leaks context scopes, so later messages inherit the same trace.

PSR-3 → span events (Jaeger-friendly)

Jaeger does not store OTLP Logs / Loki streams. This package can hook every PSR-3 logger call onto the active span as an event (Span::addEvent).

Works alongside open-telemetry/opentelemetry-auto-psr3 (inject / export).

Enable

OTEL_PHP_PSR3_SPAN_EVENTS=true
OTEL_PHP_PSR3_SPAN_EVENTS_LEVEL=info

Disable:

OTEL_PHP_DISABLED_INSTRUMENTATIONS=psr3-span-events

Requires ext-opentelemetry. Registered via Composer files autoload (_register_psr3_span_events.php) — no DI changes in apps.