PHPackages                             jcchavezs/zipkin-symfony - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Logging &amp; Monitoring](/categories/logging)
4. /
5. jcchavezs/zipkin-symfony

Abandoned → zipkin-instrumentation-symfonySymfony-bundle[Logging &amp; Monitoring](/categories/logging)

jcchavezs/zipkin-symfony
========================

A Zipkin integration for Symfony applications

3.1.0(4y ago)241.1k14[7 issues](https://github.com/jcchavezs/zipkin-instrumentation-symfony/issues)[2 PRs](https://github.com/jcchavezs/zipkin-instrumentation-symfony/pulls)MITPHPCI failing

Since Jan 22Pushed 3y ago2 watchersCompare

[ Source](https://github.com/jcchavezs/zipkin-instrumentation-symfony)[ Packagist](https://packagist.org/packages/jcchavezs/zipkin-symfony)[ RSS](/packages/jcchavezs-zipkin-symfony/feed)WikiDiscussions master Synced today

READMEChangelog (10)Dependencies (10)Versions (38)Used By (0)

Zipkin Instrumentation for Symfony
==================================

[](#zipkin-instrumentation-for-symfony)

[![Build Status](https://camo.githubusercontent.com/2751c3779f0098c22859e689e50dfedf660b05b5f3f69c847485de92e7a521ba/68747470733a2f2f7472617669732d63692e6f72672f6a6363686176657a732f7a69706b696e2d696e737472756d656e746174696f6e2d73796d666f6e792e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/jcchavezs/zipkin-instrumentation-symfony)[![CircleCI](https://camo.githubusercontent.com/1d482b8eb9a3f369d024c6373682defc44294e2604577ffdcb1cb8eaa0fb5fba/68747470733a2f2f636972636c6563692e636f6d2f67682f6a6363686176657a732f7a69706b696e2d696e737472756d656e746174696f6e2d73796d666f6e792f747265652f6d61737465722e7376673f7374796c653d737667)](https://circleci.com/gh/jcchavezs/zipkin-instrumentation-symfony/tree/master)[![Latest Stable Version](https://camo.githubusercontent.com/7f2189066e808394c8df782aec2af8b37e8372e0cce259b51a714c9cb3fbab93/68747470733a2f2f706f7365722e707567782e6f72672f6a6363686176657a732f7a69706b696e2d696e737472756d656e746174696f6e2d73796d666f6e792f762f737461626c65)](https://packagist.org/packages/jcchavezs/zipkin-instrumentation-symfony)[![Minimum PHP Version](https://camo.githubusercontent.com/824c5c4ccb56537db3b3b53bb43d7b8edc6286f3b3d1705525e0821dfd22d27e/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f7068702d253345253344253230372e312d3838393242462e737667)](https://php.net/)[![Total Downloads](https://camo.githubusercontent.com/885e3a232df32a0139a851d5f550c82f06bde692411636323745a3a4b705358f/68747470733a2f2f706f7365722e707567782e6f72672f6a6363686176657a732f7a69706b696e2d696e737472756d656e746174696f6e2d73796d666f6e792f646f776e6c6f616473)](https://packagist.org/packages/jcchavezs/zipkin-instrumentation-symfony)[![License](https://camo.githubusercontent.com/b9efb8e7eb77899d2a7abdc390f6424bee01238f3469e4786d1ba992d89653f9/68747470733a2f2f706f7365722e707567782e6f72672f6a6363686176657a732f7a69706b696e2d696e737472756d656e746174696f6e2d73796d666f6e792f6c6963656e7365)](https://packagist.org/packages/jcchavezs/zipkin-instrumentation-symfony)

A Zipkin instrumentation for Symfony applications

Installation
------------

[](#installation)

```
composer require jcchavezs/zipkin-instrumentation-symfony
```

Getting started
---------------

[](#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](https://symfony.com/doc/current/components/dependency_injection.html) declaration.

```
services:
  tracing_kernel_listener:
    class: ZipkinBundle\KernelListener
    arguments:
      - "@zipkin.default_http_server_tracing"
      - "@zipkin.route_mapper"
      - "@logger"
    tags:
      - { name: kernel.event_listener, event: kernel.request, priority: 2560 }
      - { name: kernel.event_listener, event: kernel.response, priority: -2560 }
      - { name: kernel.event_listener, event: kernel.exception }
      - { name: kernel.event_listener, event: kernel.terminate }
```

`@zipkin.default_tracing` is a `Zipkin\DefaultTracing` instance which is being built based on the configuration (add this to `app/config/config.yml`):

```
zipkin:
  noop: false # if set to true, no request will be traced
  service_name: my_service # the name of the service
  sampler:
    type: percentage
    percentage: 0.1
```

Samplers
--------

[](#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

[](#by-path)

This is for those cases where you want to make a sampling decision based on the url path:

```
zipkin:
  ...
  sampler:
    type: path
    path:
      included_paths:
        - "/my/resource/[0-9]"
      excluded_paths:
        - "/another/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

[](#by-route)

This is for those cases where you want to make a sampling decision based on the symfony route:

```
zipkin:
  ...
  sampler:
    type: route
    route:
      included_routes:
        - "my_route"
      excluded_routes:
        - "another_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

[](#by-percentage)

This one is for those cases where you want to sample only a percentage of the requests (a.k.a "Sampling rate")

```
zipkin:
  ...
  sampler:
    type: percentage
    percentage: 0.1
```

### Custom samplers

[](#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.

```
zipkin:
  ...
  sampler:
    type: custom
    custom: my_service_name
```

Reporters
---------

[](#reporters)

By default, the bundle reports to `Log` reporter which wraps `@logger`.

### HTTP reporter

[](#http-reporter)

This is the most common use case, it reports to a HTTP backend of Zipkin

```
zipkin:
  ...
  reporter:
    type: http
    http:
      endpoint_url: http://zipkin:9411/api/v2/spans
      timeout: ~
```

Default tags
------------

[](#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.

```
services:
  tracing_kernel_listener:
    class: ZipkinBundle\KernelListener
    arguments:
      - "@zipkin.default_http_server_tracing"
      - "@zipkin.route_mapper"
      - "@logger"
      - { instance: %instance_name% }
    tags:
      - { name: kernel.event_listener, event: kernel.request, priority: 2560 }
      - { name: kernel.event_listener, event: kernel.response, priority: -2560 }
      - { name: kernel.event_listener, event: kernel.exception }
      - { name: kernel.event_listener, event: kernel.terminate }
```

Custom Tracing
--------------

[](#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:

```
services:
  tracing_kernel_listener:
    class: ZipkinBundle\KernelListener
    arguments:
      - "@my_own_http_server_tracing"
      - "@zipkin.route_mapper"
      - "@logger"
    tags:
      - { name: kernel.event_listener, event: kernel.request, priority: 2560 }
      - { name: kernel.event_listener, event: kernel.response, priority: -2560 }
      - { name: kernel.event_listener, event: kernel.exception }
      - { name: kernel.event_listener, event: kernel.terminate }
```

Span customization
------------------

[](#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:

```
services:
  search.http_server_tracing:
    class: Zipkin\Instrumentation\Http\Server\HttpServerTracing
    arguments:
      - "@zipkin.default_tracing"
      - "@zipkin.route_mapper"
      - "@search_http_parser" # my own parser

  tracing_kernel_listener:
    class: ZipkinBundle\KernelListener
    arguments:
      - "@search.http_server_tracing"
      - "@logger"
      - { instance: %instance_name% }
    tags:
      - { name: kernel.event_listener, event: kernel.request, priority: 2560 }
      - { name: kernel.event_listener, event: kernel.response, priority: -2560 }
      - { name: kernel.event_listener, event: kernel.exception }
      - { name: kernel.event_listener, event: kernel.terminate }

  search_http_parser:
    class: My\Search\HttpServerParser
```

and the parser would look like:

```
namespace My\Search;

use Zipkin\Instrumentation\Http\Server\DefaultHttpServerParser;
use Zipkin\Instrumentation\Http\Server\Response;
use Zipkin\Instrumentation\Http\Server\Request;
use Zipkin\Propagation\TraceContext;
use Zipkin\SpanCustomizer;

final class HttpServerParser extends DefaultHttpServerParser {
    public function request(Request $request, TraceContext $context, SpanCustomizer $span): void {
        parent::request($request, $context, $span);
        if (null !== ($searchKey = $request->getHeader('search_key'))) {
            $span->tag('search_key', $searchKey);
        }
    }
}
```

HTTP Client
-----------

[](#http-client)

This bundle includes an adapter for HTTP Client. For more details, read [this doc](src/ZipkinBundle/Components/HttpClient/README.md).

Contributing
------------

[](#contributing)

All contributions and feedback are welcome.

### Unit testing

[](#unit-testing)

Run the unit tests with:

```
composer test
```

### E2E testing

[](#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](./tests/E2E/README.md).

###  Health Score

37

—

LowBetter than 83% of packages

Maintenance15

Infrequent updates — may be unmaintained

Popularity27

Limited adoption so far

Community18

Small or concentrated contributor base

Maturity75

Established project with proven stability

 Bus Factor1

Top contributor holds 93.5% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~44 days

Recently: every ~112 days

Total

33

Last Release

1600d ago

Major Versions

1.1.1 → 2.0.02018-05-14

2.4.2 → 3.0.02020-10-02

2.5.0 → 3.0.12020-10-23

### Community

Maintainers

![](https://www.gravatar.com/avatar/8b5352392ac3b571d5e5d144f6e992040e46726c0863552882cdd8d2577c2eb7?d=identicon)[jcchavezs](/maintainers/jcchavezs)

---

Top Contributors

[![jcchavezs](https://avatars.githubusercontent.com/u/3075074?v=4)](https://github.com/jcchavezs "jcchavezs (188 commits)")[![dimonchuk](https://avatars.githubusercontent.com/u/11705953?v=4)](https://github.com/dimonchuk "dimonchuk (7 commits)")[![Korbeil](https://avatars.githubusercontent.com/u/944409?v=4)](https://github.com/Korbeil "Korbeil (3 commits)")[![iamtankist](https://avatars.githubusercontent.com/u/1786341?v=4)](https://github.com/iamtankist "iamtankist (1 commits)")[![nirnanaaa](https://avatars.githubusercontent.com/u/1064750?v=4)](https://github.com/nirnanaaa "nirnanaaa (1 commits)")[![wmozejkostp](https://avatars.githubusercontent.com/u/153089363?v=4)](https://github.com/wmozejkostp "wmozejkostp (1 commits)")

---

Tags

distributed-tracinghacktoberfesthttp-clienthttp-server-middlewaresymfony-bundlezipkin

###  Code Quality

TestsPHPUnit

Code StylePHP\_CodeSniffer

### Embed Badge

![Health badge](/badges/jcchavezs-zipkin-symfony/health.svg)

```
[![Health](https://phpackages.com/badges/jcchavezs-zipkin-symfony/health.svg)](https://phpackages.com/packages/jcchavezs-zipkin-symfony)
```

###  Alternatives

[symfony/framework-bundle

Provides a tight integration between Symfony components and the Symfony full-stack framework

3.6k235.4M9.7k](/packages/symfony-framework-bundle)[sylius/sylius

E-Commerce platform for PHP, based on Symfony framework.

8.4k5.6M651](/packages/sylius-sylius)[shopware/platform

The Shopware e-commerce core

3.3k1.5M3](/packages/shopware-platform)[sulu/sulu

Core framework that implements the functionality of the Sulu content management system

1.3k1.3M152](/packages/sulu-sulu)[prestashop/prestashop

PrestaShop is an Open Source e-commerce platform, committed to providing the best shopping cart experience for both merchants and customers.

9.0k15.4k](/packages/prestashop-prestashop)[contao/core-bundle

Contao Open Source CMS

1231.6M2.3k](/packages/contao-core-bundle)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
