gopaljha/laravel-datadog
Composer 安装命令:
composer require gopaljha/laravel-datadog
包简介
A simple package to wrap DataDog API for Timeseries metrics
README 文档
README
Laravel DataDog
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 gopaljha/laravel-datadog
$providers = [ GopalJha\LaravelDataDog\LaravelDataDogServiceProvider::class, ]
Publish the config file
php artisan vendor:publish --provider="GopalJha\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', ['tag' => 'one', 'tag' => 'two']);
You can also send a custom host if you require.
\DataDog::increment('app.pageview', ['tag' => 'one', 'tag' => 'two'], 'example.com');
统计信息
- 总下载量: 24
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 1
- 点击次数: 1
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2020-04-10