jamesmills / laravel-datadog
A simple package to wrap DataDog API for Timeseries metrics
Installs: 468
Dependents: 0
Suggesters: 0
Security: 0
Stars: 1
Watchers: 1
Forks: 0
Open Issues: 0
Type:package
Requires
- php: >=7
- laravel/framework: 5.8.* || ^6
Requires (Dev)
- friendsofphp/php-cs-fixer: ^2.12
README
A simple package to use DataDog Series Metric using their API via TCP
Why?
Because some people cannot install the DataDog Agent or StatsD. So we have to use DataDog API to send data. Using the API losses the advantage of using UDP (unblocking) calls. This package gives you a nice way to send metric information and also make sure the jobs are queued.
Other packages
This package should only be used if you also find yourslef in the unique situation where you cannot use the DataDog Agent. Make sure you investigate the below packages first.
Installation
Pull in the package using Composer
composer require jamesmills/laravel-datadog
Publish the config file
php artisan vendor:publish --provider="JamesMills\LaravelDataDog\LaravelDataDogServiceProvider" --tag=config
Set your DataDog API key in your .env
file using the key DATADOG_KEY
.
How to use
Increment a Metric
\DataDog::increment('app.pageview');
Increment a Metric with tagging and Host
A powerful feature of DataDog is the ability to tag things.
\DataDog::increment('app.pageview', ['my:tag:one', 'my:tag:two']);
You can also send a custom host if you require.
\DataDog::increment('app.pageview', ['my:tag:one', 'my:tag:two'], 'my.host.com');
Changelog
Please see CHANGELOG for more information what has changed recently.
Contributing
Please see CONTRIBUTING for details.
Security
If you discover any security related issues, please email james@jamesmills.co.uk instead of using the issue tracker.
Treeware
You're free to use this package, but if it makes it to your production environment I would highly appreciate you buying the world a tree.
It’s now common knowledge that one of the best tools to tackle the climate crisis and keep our temperatures from rising above 1.5C is to plant trees. If you contribute to my forest you’ll be creating employment for local families and restoring wildlife habitats.
You can buy trees at my forest here offset.earth/jamesmills
Credits
License
The MIT License (MIT). Please see License File for more information.