A dedicated endpoint for real user monitoring. A beacon backend for your application.
Works with boomerang and statsc.
From your application, you can send GET
requests to the beacon endpoint like so:
http://example.com/my/applicationname?redirect=619ms&cache=4ms&dns=0ms&connect=1ms&firstByte=715ms&items=30g
This will send the following metrics via statsd for further processing:
my.applicationname.redirect:619|ms
my.applicationname.cache:4|ms
my.applicationname.dns:0|ms
my.applicationname.connect:1|ms
my.applicationname.firstByte:715|ms
my.applicationname.items:30|g
Beacon is used with a time-series database like this:
client --> beacon --> statsd --> graphite/influxdb/opentsdb/...
We've included a docker-compose.yml
file to try this out.
docker build -t mre/beacon .
docker run -it --rm -p 80:80 mre/beacon
Running this with Docker as shown above is the preferred method, but if you
have to install it locally, here's how to do it:
- Run
composer install
- Start a server with this directory as a document root.
For testing, you can use the builtin PHP webserver:php -S 0.0.0.0:8000
- (Optional) For beatiful URLs, enable rewrite rules and put a
.htaccess
file into that folder with the following entry:RewriteRule ^(.*)$ index.php?handler=$1 [L,QSA]
Keys consist of upper and lowercase separated by dots or underscores.
Examples: foo, FOO, FOO_BAR, FOO.BAR, FOO.bar, foo.BAR, foo.bar.baz, foo.bar_baz
All statsd datatypes are supported. Those are:
Name | Long name | Usage |
---|---|---|
c | Counter | A record of an event occuring |
g | Gauge | A snapshot value of a variable |
ms | Time | A record of how long an event took, in milliseconds |
s | Set | Unique occurences of events between flushes |
For more info, see the official statsd documentation.
Values are negative or positive int or float numbers. Examples: 123, -123, 1.0, -1.0
Beacon logo created by Ahmed Elzahra from the Noun Project. Thanks!