chaseconey / laravel-datadog-helper by chaseconey

A Laravel Datadog helper package.
1,716,866
74
4
Package Data
Maintainer Username: chaseconey
Maintainer Contact: chasiepoo@gmail.com (Chase Coney)
Package Create Date: 2016-08-02
Package Last Update: 2022-02-09
Home Page:
Language: PHP
License: MIT
Last Refreshed: 2024-11-29 15:18:42
Package Statistics
Total Downloads: 1,716,866
Monthly Downloads: 48,725
Daily Downloads: 974
Total Stars: 74
Total Watchers: 4
Total Forks: 19
Total Open Issues: 0

laravel-datadog-helper

Latest Version on Packagist Software License Build Status Coverage Status Quality Score Total Downloads StyleCI

Laravel Datadog Helper helps you get your application metrics integrated into Laravel as fast as possible.

Requirements

  • Laravel >= 5
  • Datadog API Key

Features

  • Adds Datadog facade that wraps the official DataDog/php-datadogstatsd library
  • Provides middleware for tracking response time metrics automatically
  • Allows prefixing all metrics that are sent for the whole application with common prefix

Installation

Require this package with composer.

composer require chaseconey/laravel-datadog-helper

Laravel 5.5 uses Package Auto-Discovery, so doesn't require you to manually add the ServiceProvider.

If you would like to install the request metric tracking middleware, add the Datadog middleware class like so:


// app/Http/Kernel.php

protected $middleware = [
    ...

    \ChaseConey\LaravelDatadogHelper\Middleware\LaravelDatadogMiddleware::class
];

Without Auto-Discovery (or Laravel < 5.5)

If you don't use auto-discovery, or you are using an older version of Laravel, add the ServiceProvider to the providers array in config/app.php


// config/app.php

'providers' => [
    ...
    
    ChaseConey\LaravelDatadogHelper\LaravelDatadogHelperServiceProvider::class,
];

If you want to use the facade, add this to your facades in config/app.php:


// config/app.php

'aliases' => [
    ...
    
    'Datadog' => ChaseConey\LaravelDatadogHelper\Datadog::class
];

For configuration options, copy the package config to your local config with the publish command:

php artisan vendor:publish --provider="ChaseConey\LaravelDatadogHelper\LaravelDatadogHelperServiceProvider"

Examples

This library wraps the official DataDog/php-datadogstatsd library. All functions are inherited from the core implementation provided by this library with the exception of replacing Datadogstatsd with Datadog (the facade).

For example:

Instead of doing Datadogstatsd::increment('my.sweet.metrics'), you would use Datadog::increment('my.sweet.metrics').

For a full set of usage examples, check out the library's usage README.

Change log

Please see CHANGELOG for more information what has changed recently.

Contributing

Please see CONTRIBUTING and CONDUCT for details.

Credits

License

The MIT License (MIT). Please see License File for more information.