Weave Code
Code Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message
Php Datadogstatsd

Php Datadogstatsd Laravel Package

datadog/php-datadogstatsd

DogStatsD client for PHP from Datadog. Send metrics, events, and service checks to the Datadog Agent via UDP or UDS, with support for tags, sampling, buffering, and namespacing. Useful for instrumenting PHP apps and services.

View on GitHub
Deep Wiki
Context7

A PHP client for DogStatsd

Frequently asked questions about Php Datadogstatsd
How do I install this package in a Laravel project?
Add the package via Composer with `composer require datadog/php-datadogstatsd`. Ensure the PHP sockets extension is enabled (`--enable-sockets` at compile time). For Laravel-specific wrappers, consider `laravel-datadog-helper` for tighter integration.
What Laravel versions does this package support?
The package itself has no Laravel-specific dependencies, but it works with all modern Laravel versions (8.x, 9.x, 10.x). Test thoroughly on your target version, as it relies on PHP 5.6+ (though PHP 8.x is recommended).
Can I use this for Laravel queue workers (Horizon/Redis)?
Yes. The package’s UDP/UDS support is ideal for queue workers, but enable the new error handler (v1.7.1+) to log socket failures. Pair with Laravel’s `retry()` helper for critical metrics to fall back to HTTP if UDP fails.
How do I handle socket errors in production?
Configure the error handler in your `config/datadog.php` to emit structured metrics (e.g., `statsd.socket_errors`) and trigger Datadog alerts. For critical paths, extend the handler to retry via the Datadog HTTP API.
Does this package support namespacing metrics in Laravel?
Yes. Use the `namespace` config option (e.g., `namespace: 'laravel.app'`) to prefix all metrics. Combine with tags (e.g., `['env:production', 'service:api']`) for granular filtering in Datadog.
What’s the performance impact of using UDP vs. UDS?
UDP is faster (~1ms overhead) but unreliable; UDS (Unix Domain Sockets) is slower (~2ms) but more stable for local Datadog Agent setups. Benchmark both in your Laravel environment using `hhrm/benchmark` to choose.
How do I correlate Datadog metrics with Laravel logs?
Use the `tags` parameter to include Laravel’s `request_id` or `job_id` (e.g., `['request_id:'.$request->id]`). For queue jobs, log socket errors to Monolog with the job’s UUID for end-to-end tracing.
What alternatives exist for Laravel Datadog integration?
For Laravel-specific solutions, consider `laravel-datadog-helper` (wraps this package) or `spatie/laravel-monitoring` for built-in Laravel metrics. For advanced observability, combine this with `datadog/datadog-api-client` for HTTP fallbacks.
How do I test this package in a Laravel CI pipeline?
Mock the Datadog Agent using a local UDP listener (e.g., `ncat -ul 8125`) or a test double like `mockery`. Verify metrics with `phpunit` assertions on `DogStatsd`’s `increment()`/`gauge()` methods, ignoring actual network calls.
Can I buffer metrics for offline Laravel workers?
Yes. Enable the `buffer` config option to queue metrics in memory (or use Redis via `predis/predis`). Flush buffers on shutdown or when the Agent reconnects, ensuring no data loss during network outages.
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
terminal42/code-quality-tools
codifyo/ts-generator-bundle
andydefer/laravel-cluster
testo/fiber
mintobit/jobqueue
a4sex/maintenance-bundle
a4sex/entity-date-update
a4sex/client-identifier
a4sex/base-utilites
a4sex/key-value-storage
a4sex/micro-status
chilldev/dependency-injection-extra
datinglibre/datinglibre-app-api
biberltd/corebundle
bricre/symfony-bundle-test
biberltd/logbundle
dominium/http-adapter-bundle
dominium/google-analytics
a4sex/auto-clean-entity
christhompsontldr/laravel-inky