Download the PHP package amashukov/tracing-bundle without Composer

On this page you can find all versions of the php package amashukov/tracing-bundle. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package tracing-bundle

amashukov/tracing-bundle

A Symfony 7 bundle that stamps every inbound HTTP request with a UUIDv7 X-Request-Id, mirrors it onto every Monolog log record's extra.request_id, echoes it back on the response, and rides through Symfony Messenger so a worker logging a handler ends up with the same id the originating HTTP request held.

CI PHPStan L8 Latest Version Downloads PHP Stars

amashukov/tracing-bundle is a vendor-extractable Symfony 7 bundle for end-to-end request_id propagation. Doing this once at the right layer beats bolting it on per-call: the bundle ships the kernel listener, the resolver, the Monolog processor, the Messenger stamp, the consume-side context restorer, validation at the trust boundary, and the CLI fallback so every console run / cron / worker logs {"request_id":"..."} instead of an empty extra block. Drop it into a Symfony 7 project, get the same id flowing through the FE fetch, the controller, every log line on every channel, the response header, and the queue-bound worker that picks the message up minutes later — with zero App\* namespace coupling.

Features

Installation

Symfony Flex registers the bundle automatically. If you don't run Flex, add it manually:

Requirements

Usage

After install — no further config. Every request automatically:

  1. Receives a request_id attribute on the Request.
  2. Logs extra.request_id in every Monolog record.
  3. Mirrors X-Request-Id on the response.

Reading the id inside a service

Browser side (Nuxt 3 / 4 plugin)

Playwright per-test echo

Then debug any failing run:

Every BE event scoped to that one test, no cross-spec noise.

CORS allow header

If the FE talks to a different origin, allow the header on both directions:

Messenger integration (sync → queue → worker)

When a Messenger message crosses the sync → queue boundary, the worker process has no RequestStack. The bundle's middleware closes that gap.

Dispatch side (HTTP request handler):

Consume side (worker process):

Per W3C Trace Context spec Non-HTTP Protocol Support and the Symfony Messenger official middleware pattern ($envelope->last(ReceivedStamp::class) discriminates dispatch vs consume).

Class catalogue

Class What it does
Http\RequestIdListener kernel.request (priority 256) reads X-Request-Id, validates as 36-char hex UUID, generates UUIDv7 via symfony/uid when missing or malformed. kernel.response (priority -256) mirrors the id onto the response header. Main-request only.
Http\RequestIdResolverInterface Narrow contract current(): string. Services depend on the interface; the bundle wires the alias.
Http\RequestIdResolver final readonly implementation. Reads request_id off the main request first, falls back to WorkerRequestIdContext (when running inside Messenger), then to the cli constant.
Monolog\RequestIdProcessor Tagged monolog.processor. Attaches extra.request_id to every LogRecord on every channel. Pre-existing extra keys preserved.
Messenger\RequestIdStamp Immutable StampInterface value object carrying one string (the originating request's id).
Messenger\RequestIdMessengerMiddleware Dual-path Messenger middleware. Dispatch: attaches new RequestIdStamp($resolver->current()) to the envelope if not already present. Consume (ReceivedStamp present): reads the stamp, writes the id to WorkerRequestIdContext before calling the next middleware, clears in finally.
Messenger\WorkerRequestIdContext Single-cell mutable state holder for the worker's current message id. Read by RequestIdResolver::current() when there is no HTTP request.

Validation

Incoming X-Request-Id is rejected when:

Rejected → bundle generates a fresh UUIDv7.

CLI fallback

In CLI context (no Request on RequestStack, no WorkerRequestIdContext value set), the resolver returns the literal cli. Every console command / one-shot cron task logs {"request_id":"cli"} instead of an empty extra block — log-aggregator queries stay consistent regardless of execution mode.

Trace Context (W3C traceparent)

This bundle deliberately implements the X-Request-Id header pattern only (Heroku / Cloudflare CF-Ray style). For W3C Trace Context (traceparent / OpenTelemetry alignment) pair this bundle with the official open-telemetry/opentelemetry-php-instrumentation-symfony — the two are complementary, not alternatives.

Testing

Suite covers: valid UUIDv7 accept, mixed-case header lowercased, five invalid-header regen cases (missing, too short, too long, wrong charset, SQL-injection-looking string), response header mirror, sub-request skip, subscribed-events shape, CLI fallback (no request / no attribute / non-string attribute), extra.request_id attach with pre-existing extras preserved, Messenger stamp value semantics, worker-context set/get/clear, middleware dispatch path, middleware consume path, middleware finally clears between messages.

License

MIT — see LICENSE.

Author

Andrei Mashukov[email protected]


All versions of tracing-bundle with dependencies

PHP Build Version
Package Version
Requires php Version >=8.3
monolog/monolog Version ^3.0
symfony/config Version ^7.0
symfony/dependency-injection Version ^7.0
symfony/event-dispatcher Version ^7.0
symfony/http-foundation Version ^7.0
symfony/http-kernel Version ^7.0
symfony/uid Version ^7.0
symfony/yaml Version ^7.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package amashukov/tracing-bundle contains the following files

Loading the files please wait ...