msstc4symfony / metrics-bridge-profiling
Exports msstc4symfony/profiling-bundle span durations as msstc4symfony/metrics-bundle Prometheus metrics
Package info
github.com/msstc4symfony/metrics-bridge-profiling
Type:symfony-bundle
pkg:composer/msstc4symfony/metrics-bridge-profiling
Requires
- php: >=8.2
- composer-runtime-api: >=2.2
- monolog/monolog: ^3.5
- msstc4symfony/metrics-bundle: ^2.0
- msstc4symfony/profiling-bundle: ^2.0
- psr/log: ^2.0|^3.0
- symfony/config: ^7.4|^8.0
- symfony/dependency-injection: ^7.4|^8.0
- symfony/http-kernel: ^7.4|^8.0
Requires (Dev)
- friendsofphp/php-cs-fixer: ^3.76
- phpstan/extension-installer: ^1.4
- phpstan/phpstan: ^2.1
- phpstan/phpstan-strict-rules: ^2.0
- phpstan/phpstan-symfony: ^2.0
- phpunit/phpunit: >=11.0
- promphp/prometheus_client_php: ^2.6
- rector/rector: ^2.1
- roave/security-advisories: dev-latest
- symfony/filesystem: ^7.4|^8.0
- symfony/framework-bundle: ^7.4|^8.0
- symfony/monolog-bundle: ^3.11|^4.0
Suggests
None
Provides
None
Conflicts
Replaces
None
This package is auto-updated.
Last update: 2026-12-04 07:01:14 UTC
README
Exports the duration of every span recorded by
msstc4symfony/profiling-bundle as a
Prometheus histogram of
msstc4symfony/metrics-bundle:
symfony_profiling_span_duration_histogram_seconds{application, component, message}
message is the span message, lower-cased, with everything but [a-z0-9_-] replaced by _
(request orders_list → request_orders_list). The duration is the one fixed by
SpanInterface::end(). Buckets: 0.1, 0.5, 1, 3, 5, 10, 15, 30, 60, 180 seconds.
Compatibility
| Bridge | PHP | Symfony | metrics-bundle | profiling-bundle |
|---|---|---|---|---|
| 2.0 | 8.2+ | 7.4, 8.x | ^2.0 | ^2.0 |
| 1.1 | 8.2+ | 7.4, 8.x | ^1.4 | ^1.1 |
| 1.0 | 8.4+ | 7.4, 8.x | ^1.0 | ^1.0 |
Symfony 8.x needs PHP 8.4; on PHP 8.2 and 8.3 Composer installs Symfony 7.4.
Installation
composer require msstc4symfony/metrics-bridge-profiling
Register the three bundles in config/bundles.php:
Msstc4Symfony\MetricsBundle\MetricsBundle::class => ['all' => true], Msstc4Symfony\ProfilingBundle\ProfilingBundle::class => ['all' => true], Msstc4Symfony\MetricsBridgeProfiling\MetricsBridgeProfilingBundle::class => ['all' => true],
Nothing to configure: what gets recorded is decided by the profiling-bundle configuration (routes, commands, messages, span prefixes).
Cardinality
Every distinct span message is a new time series. Keep messages low-cardinality
(request orders_show, not request /orders/42); put ids into the span context, which is
never exported.
Public API
The bundle class Msstc4Symfony\MetricsBridgeProfiling\MetricsBridgeProfilingBundle and the metric definition
Msstc4Symfony\MetricsBridgeProfiling\Infrastructure\Metrics\ProfilingMetric (its name, labels and buckets are what
dashboards rely on). The collector, the end-span processor and the compiler pass are @internal.
A metric the recorder cannot write is logged to metrics-bundle's metrics_bundle channel (not counted by
symfony_error) and never fails the span.
Local development
composer-ci.json installs metrics-bundle and profiling-bundle.
COMPOSER=composer-ci.json composer install
COMPOSER=composer-ci.json make check
make test
make fix
License
MIT, see LICENSE.