Download the PHP package jcchavezs/zipkin-instrumentation-symfony without Composer
On this page you can find all versions of the php package jcchavezs/zipkin-instrumentation-symfony. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download jcchavezs/zipkin-instrumentation-symfony
More information about jcchavezs/zipkin-instrumentation-symfony
Files in jcchavezs/zipkin-instrumentation-symfony
Package zipkin-instrumentation-symfony
Short Description A Zipkin integration for Symfony applications
License MIT
Informations about the package zipkin-instrumentation-symfony
Zipkin Instrumentation for Symfony
A Zipkin instrumentation for Symfony applications
Installation
Getting started
This Symfony bundle provides a kernel listener that can be used to trace
HTTP requests. In order to use it, it is important that you declare
the listener by adding this to your app/config/services.yml
or any other
dependency injection declaration.
@zipkin.default_tracing
is a Zipkin\DefaultTracing
instance which is being
built based on the configuration (add this to app/config/config.yml
):
Samplers
Besides always
, and never
there are three other sampling strategies: by path, by route and by percentage, however it is also possible yo use your own sampler.
It is important to mention that the sampling decision is made on two situations: a) when a new trace is being started, b) when the extracted context does not include a sampling decision.
By path
This is for those cases where you want to make a sampling decision based on the url path:
This sampler uses the Symfony\Component\HttpFoundation\RequestStack
meaning that it won't work in event loop enviroments. For event loop environments, use a requestSampler
in the HTTP Server Tracing.
By route
This is for those cases where you want to make a sampling decision based on the symfony route:
This sampler uses the Symfony\Component\HttpFoundation\RequestStack
meaning that it won't work in event loop enviroments. For event loop environments, use a requestSampler
in the HTTP Server Tracing.
By percentage
This one is for those cases where you want to sample only a percentage of the requests (a.k.a "Sampling rate")
Custom samplers
You can pass a custom sampler as long as it implements the Zipkin\Sampler
interface. You just need to use the service id
declared in the service container.
Reporters
By default, the bundle reports to Log
reporter which wraps @logger
.
HTTP reporter
This is the most common use case, it reports to a HTTP backend of Zipkin
Default tags
You can add tags to every span being created by the tracer. This functionality is useful when you need to add tags like instance name.
Custom Tracing
Although this bundle provides a tracer based on the configuration parameters
under the zipkin
node, you can inject your own tracing component
to the
kernel listener as long as it implements the Zipkin\Tracing
interface:
Span customization
By default spans include usual HTTP information like method, path or status code but there are cases where user wants to add more information in the spans based on the request (e.g. request_id
or a query parameter). In such cases one can extend the HttpServerParser
to have access to the request and tag the span:
and the parser would look like:
HTTP Client
This bundle includes an adapter for HTTP Client. For more details, read this doc.
Contributing
All contributions and feedback are welcome.
Unit testing
Run the unit tests with:
E2E testing
On every build we run a end to end (E2E) test against a symfony application.
This test run in our CI tests but it can be also reproduced in local.
All versions of zipkin-instrumentation-symfony with dependencies
symfony/http-kernel Version ^4.4||^5.0
symfony/http-foundation Version <6.0
symfony/routing Version ^4.4||^5.0
symfony/dependency-injection Version ^4.4||^5.0
openzipkin/zipkin Version ^2.0.2 || ^3.0