Search by

msstc4symfony / metrics-bridge-profiling

maxim.shamaev@gmail.com

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

Statistics

Installs: 0

Dependents: 0

Suggesters: 1

Stars: 0

v2.0.0 2026-10-20 10:54 UTC

This package is auto-updated.

Last update: 2026-12-04 07:01:14 UTC


README

Build Status License: MIT

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.