PHPackages                             silpo-tech/trace-bundle - 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. [Framework](/categories/framework)
4. /
5. silpo-tech/trace-bundle

ActiveSymfony-bundle[Framework](/categories/framework)

silpo-tech/trace-bundle
=======================

Trace bundle for Symfony

v1.0.0(7mo ago)01.9k↓15.4%MITPHPPHP &gt;=8.3CI passing

Since Sep 25Pushed 7mo agoCompare

[ Source](https://github.com/silpo-tech/TraceBundle)[ Packagist](https://packagist.org/packages/silpo-tech/trace-bundle)[ RSS](/packages/silpo-tech-trace-bundle/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (1)Dependencies (13)Versions (3)Used By (0)

Trace Bundle
============

[](#trace-bundle)

[![CI](https://github.com/silpo-tech/TraceBundle/workflows/CI/badge.svg)](https://github.com/silpo-tech/TraceBundle/actions)[![codecov](https://camo.githubusercontent.com/b916501ca012cf292e4a0d84ab3e10f5aa77575f6bcc23098824097e468426b9/68747470733a2f2f636f6465636f762e696f2f67682f73696c706f2d746563682f547261636542756e646c652f6272616e63682f6d61696e2f67726170682f62616467652e737667)](https://codecov.io/gh/silpo-tech/TraceBundle)[![License: MIT](https://camo.githubusercontent.com/fdf2982b9f5d7489dcf44570e714e3a15fce6253e0cc6b5aa61a075aac2ff71b/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4c6963656e73652d4d49542d79656c6c6f772e737667)](https://opensource.org/licenses/MIT)

A Symfony bundle for distributed tracing and request correlation across microservices.

Features
--------

[](#features)

- **Request ID Generation**: Automatically generates unique trace IDs for incoming requests
- **Request ID Propagation**: Forwards trace IDs to outgoing HTTP requests via Guzzle middleware
- **Logging Integration**: Adds trace IDs to Monolog log entries
- **Console Support**: Generates trace IDs for console commands
- **Sentry Integration**: Enriches Sentry transactions with trace information
- **Message Bus Support**: Correlates messages with trace IDs (requires silpo-tech/message-bus-bundle)

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

[](#installation)

```
composer require silpo-tech/trace-bundle
```

Configuration
-------------

[](#configuration)

Add the bundle to your `config/bundles.php`:

```
return [
    // ...
    TraceBundle\TraceBundle::class => ['all' => true],
];
```

### Bundle Configuration

[](#bundle-configuration)

Create `config/packages/trace.yaml`:

```
trace:
    id_header_name: 'X-Request-Id'        # Header name for trace ID (default)
    id_log_extra_name: 'requestId'        # Log field name for trace ID (default)
    autoconfigure_handlers: true          # Auto-configure Guzzle handlers (default)
```

Usage
-----

[](#usage)

### HTTP Requests

[](#http-requests)

The bundle automatically:

1. Extracts trace ID from incoming request headers (`X-Request-Id` by default)
2. Generates a new UUID if no trace ID is present
3. Adds the trace ID to response headers
4. Propagates trace ID to outgoing HTTP requests via Guzzle middleware

### Logging

[](#logging)

Trace IDs are automatically added to all log entries:

```
$logger->info('Processing user request');
// Log will include: {"message": "Processing user request", "extra": {"requestId": "uuid-here"}}
```

### Console Commands

[](#console-commands)

For console commands, a trace ID is automatically generated and available throughout the command execution.

### Manual Access

[](#manual-access)

You can access the current trace ID programmatically:

```
use TraceBundle\Storage\TraceIdStorageInterface;

class YourService
{
    public function __construct(
        private TraceIdStorageInterface $traceIdStorage
    ) {}

    public function someMethod(): void
    {
        $traceId = $this->traceIdStorage->get();
        // Use trace ID as needed
    }
}
```

Integration
-----------

[](#integration)

### Sentry

[](#sentry)

When `sentry/sentry` is installed, the bundle automatically enriches Sentry transactions with trace information.

### Message Bus

[](#message-bus)

When `silpo-tech/message-bus-bundle` is installed, trace IDs are automatically propagated through message bus operations.

Requirements
------------

[](#requirements)

- PHP ≥8.3
- Symfony ≥6.4|^7.0

Dependencies
------------

[](#dependencies)

### Required

[](#required)

- `symfony/http-kernel`
- `symfony/dependency-injection`
- `symfony/config`
- `ramsey/uuid`
- `monolog/monolog`
- `guzzlehttp/guzzle`
- `symfony/yaml`

### Optional

[](#optional)

- `sentry/sentry` - For Sentry integration
- `silpo-tech/message-bus-bundle` - For message bus correlation

Testing
-------

[](#testing)

```
composer install
vendor/bin/phpunit
```

License
-------

[](#license)

This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.

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

[](#contributing)

This is a proprietary package. Please contact the maintainers for contribution guidelines.

###  Health Score

39

—

LowBetter than 86% of packages

Maintenance63

Regular maintenance activity

Popularity21

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity51

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 73.7% 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

Unknown

Total

1

Last Release

236d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/f9891deddc63cb60dd472af17aee913a559f29defbe861135037dbbdf99449a6?d=identicon)[food-tech-devs](/maintainers/food-tech-devs)

---

Top Contributors

[![ypft](https://avatars.githubusercontent.com/u/157708858?v=4)](https://github.com/ypft "ypft (14 commits)")[![Avariya](https://avatars.githubusercontent.com/u/13464158?v=4)](https://github.com/Avariya "Avariya (4 commits)")[![panayotovyura](https://avatars.githubusercontent.com/u/8473688?v=4)](https://github.com/panayotovyura "panayotovyura (1 commits)")

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Code StylePHP CS Fixer

Type Coverage Yes

### Embed Badge

![Health badge](/badges/silpo-tech-trace-bundle/health.svg)

```
[![Health](https://phpackages.com/badges/silpo-tech-trace-bundle/health.svg)](https://phpackages.com/packages/silpo-tech-trace-bundle)
```

###  Alternatives

[shopware/platform

The Shopware e-commerce core

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

The Laravel Framework.

34.7k509.9M17.0k](/packages/laravel-framework)[shopware/core

Shopware platform is the core for all Shopware ecommerce products.

595.2M386](/packages/shopware-core)[sylius/sylius

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

8.4k5.6M651](/packages/sylius-sylius)[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)[ec-cube/ec-cube

EC-CUBE EC open platform.

78527.0k1](/packages/ec-cube-ec-cube)

PHPackages © 2026

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