Skip to content

Commit

Permalink
Add additional middleware info in README
Browse files Browse the repository at this point in the history
  • Loading branch information
chaseconey committed Aug 13, 2019
1 parent 37f7037 commit 2d42c81
Show file tree
Hide file tree
Showing 2 changed files with 96 additions and 0 deletions.
96 changes: 96 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,102 @@ For configuration options, copy the package config to your local config with the
php artisan vendor:publish --provider="ChaseConey\LaravelDatadogHelper\LaravelDatadogHelperServiceProvider"
```

## Middleware

This package comes with a handy middleware that you can add to any Laravel project to get up and running in Datadog as fast as possible.

- **Metric Name:** `request_time`
- **Value:** The time it takes Laravel to respond to request
- **Tags:**:
- `status_code`
- `url` (toggle via `datadog.middleware_disable_url_tag` config option)
- *any custom tags you have added to `datadog.global_tags`*

With just these metrics here are a couple of example graphs that you can make:

![](datadog-screen.png?raw=true)

<details><summary>Datadog Graph Config JSON</summary>
<p>

#### Max Request Time by URL

```json
{
"viz": "heatmap",
"requests": [
{
"q": "max:app.example.request_time.max{*} by {url}",
"type": null,
"style": {
"palette": "dog_classic",
"type": "solid",
"width": "normal"
},
"aggregator": "avg",
"conditional_formats": []
}
],
"autoscale": true
}
```


#### Top Pages Hit

```json
{
"viz": "toplist",
"requests": [
{
"q": "top(sum:app.example.request_time.count{*} by {url}.as_count(), 10, 'sum', 'desc')",
"type": null,
"style": {
"palette": "warm",
"type": "solid",
"width": "normal"
},
"conditional_formats": []
}
]
}
```

#### Slowest Endpoints/Pages

```json
{
"viz": "toplist",
"requests": [
{
"q": "top(max:app.example.request_time.max{*} by {url}, 10, 'max', 'desc')",
"type": null,
"style": {
"palette": "dog_classic",
"type": "solid",
"width": "normal"
},
"conditional_formats": [
{
"palette": "white_on_red",
"value": 5,
"comparator": ">"
},
{
"palette": "white_on_green",
"value": 5,
"comparator": "<="
}
]
}
]
}
```

</p>
</details>


## Examples

This library wraps the official [DataDog/php-datadogstatsd](https://github.com/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).
Expand Down
Binary file added datadog-screen.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 2d42c81

Please sign in to comment.