PHPackages                             yakovlef/telegraf-metrics-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. [Logging &amp; Monitoring](/categories/logging)
4. /
5. yakovlef/telegraf-metrics-bundle

ActiveSymfony-bundle[Logging &amp; Monitoring](/categories/logging)

yakovlef/telegraf-metrics-bundle
================================

Symfony bundle for collecting and sending metrics to Telegraf/InfluxDB via UDP protocol

v1.0.0(10mo ago)65MITPHPPHP &gt;=8.1

Since Jun 17Pushed 10mo ago1 watchersCompare

[ Source](https://github.com/yakovlef/telegraf-metrics-bundle)[ Packagist](https://packagist.org/packages/yakovlef/telegraf-metrics-bundle)[ Docs](https://github.com/yakovlef/telegraf-metrics-bundle)[ RSS](/packages/yakovlef-telegraf-metrics-bundle/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependencies (4)Versions (2)Used By (0)

TelegrafMetricsBundle
=====================

[](#telegrafmetricsbundle)

Symfony bundle for sending metrics to Telegraf/InfluxDB via UDP protocol.

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

[](#installation)

```
composer require yakovlef/telegraf-metrics-bundle
```

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

[](#configuration)

Add to your `config/bundles.php`:

```
Yakovlef\TelegrafMetricsBundle\TelegrafMetricsBundle::class => ['all' => true],
```

Configure in `config/packages/telegraf_metrics.yaml`:

```
telegraf_metrics:
    namespace: 'my_app'
    client:
        url: 'http://localhost:8086'
        udpPort: 8089
```

Usage
-----

[](#usage)

### Basic Example

[](#basic-example)

```
use Yakovlef\TelegrafMetricsBundle\Collector\MetricsCollectorInterface;

class UserController
{
    public function __construct(
        private MetricsCollectorInterface $metricsCollector
    ) {}

    public function register(): Response
    {
        // Your business logic here...

        // Send metrics
        $this->metricsCollector->collect('user_registration', [
            'count' => 1
        ], [
            'source' => 'web', //source for example web, mobile, api
            'country' => 'US' //country of the user
        ], );

        return new JsonResponse(['status' => 'success']);
    }
}
```

### Advanced Examples

[](#advanced-examples)

```
// Performance metrics
$this->metricsCollector->collect('api_response', [
    'response_time' => 145.2,
    'memory_usage' => 1024
], [
    'endpoint' => '/api/users',
    'method' => 'GET',
    'status' => '200'
]);

// Business metrics
$this->metricsCollector->collect('order_created', [
    'amount' => 99.99,
    'items_count' => 3
], [
    'payment_method' => 'credit_card',
    'currency' => 'USD'
]);

// Error tracking
$this->metricsCollector->collect('application_error', [
    'count' => 1
], [
    'type' => 'database_connection',
    'severity' => 'critical'
]);
```

Telegraf Configuration
----------------------

[](#telegraf-configuration)

Configure Telegraf to accept UDP input:

```
# /etc/telegraf/telegraf.conf

[[inputs.socket_listener]]
  service_address = "udp://:8089" # This port must match the one in telegraf_metrics.yaml
  data_format = "influx"
```

Prometheus &amp; Grafana Support
--------------------------------

[](#prometheus--grafana-support)

In addition to InfluxDB, you can also use this bundle to send metrics to **Prometheus** via Telegraf.

Telegraf will act as a proxy: it receives metrics via UDP and exposes them to Prometheus via the `/metrics` HTTP endpoint.

### Telegraf Configuration Example

[](#telegraf-configuration-example)

```
# Output: expose metrics for Prometheus
[[outputs.prometheus_client]]
  listen = ":9273"
  metric_version = 2
  path = "/metrics"
```

### Prometheus Configuration

[](#prometheus-configuration)

```
scrape_configs:
  # Telegraf metrics
  - job_name: 'telegraf'
    static_configs:
      - targets: ['localhost:9273']
    scrape_interval: 10s
    metrics_path: /metrics
```

Ensure that the host and port match the actual Telegraf service in your environment.

Concepts
--------

[](#concepts)

- **Measurement**: The metric name (e.g., `api_response`, `user_registration`)
- **Tags**: Key-value pairs for filtering and grouping (e.g., `status`, `country`)
- **Fields**: Actual measured values (e.g., `response_time`, `count`, `amount`)

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

[](#requirements)

- PHP 8.1+
- Symfony 6.4+ or 7.0+

License
-------

[](#license)

MIT

###  Health Score

31

—

LowBetter than 68% of packages

Maintenance53

Moderate activity, may be stable

Popularity9

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity45

Maturing project, gaining track record

 Bus Factor1

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

328d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/1c3771402475b7546f9158982918876a669f49cfabf3f331ddb16b410dfdcb39?d=identicon)[novator](/maintainers/novator)

---

Top Contributors

[![yakovlef](https://avatars.githubusercontent.com/u/4018068?v=4)](https://github.com/yakovlef "yakovlef (1 commits)")

---

Tags

symfonymonitoringMetricsinfluxdbtelegraf

### Embed Badge

![Health badge](/badges/yakovlef-telegraf-metrics-bundle/health.svg)

```
[![Health](https://phpackages.com/badges/yakovlef-telegraf-metrics-bundle/health.svg)](https://phpackages.com/packages/yakovlef-telegraf-metrics-bundle)
```

###  Alternatives

[inspector-apm/inspector-symfony

Code Execution Monitoring for Symfony applications.

2830.1k2](/packages/inspector-apm-inspector-symfony)[friendsofopentelemetry/opentelemetry-bundle

Traces, metrics, and logs instrumentation within your Symfony application

638.6k](/packages/friendsofopentelemetry-opentelemetry-bundle)[lamoda/metrics

Library for handling and displaying custom project metrics

371.9k](/packages/lamoda-metrics)

PHPackages © 2026

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