Skip to content

Example Application

brharrington edited this page Mar 9, 2013 · 4 revisions

The easiest way to get started is to run the example application. The commands to get the demo app running are:

$ git clone https://github.com/Netflix/servo.git
$ cd servo
$ ./gradlew servo-example:run

This will kick off a simple web server that by default listens on port 12345 and logs metrics to the /tmp directory every 5 seconds. The main endpoint just echoes back whatever data is received in the request. To see it actually do something in another terminal run a command to send some data to the server, for example:

$ seq 1 100 | xargs -n1 curl -s 'http://localhost:12345/echo' -d; echo
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100

You can then grep the output files and see that the bytesReceived counter shows we received data:

$ grep -P '^bytesReceived\s+.*class=EchoHandler.*' /tmp/servo-example_* | tail -n5
/tmp/servo-example_2013_09_03_04_02_41_773.log:bytesReceived	class=EchoHandler,type=COUNTER	2013-09-03T04:02:41.773	0.0
/tmp/servo-example_2013_09_03_04_02_46_779.log:bytesReceived	class=EchoHandler,type=COUNTER	2013-09-03T04:02:46.778	38.36163836163836
/tmp/servo-example_2013_09_03_04_02_51_785.log:bytesReceived	class=EchoHandler,type=COUNTER	2013-09-03T04:02:51.784	0.0
/tmp/servo-example_2013_09_03_04_02_56_790.log:bytesReceived	class=EchoHandler,type=COUNTER	2013-09-03T04:02:56.789	0.0
/tmp/servo-example_2013_09_03_04_03_01_796.log:bytesReceived	class=EchoHandler,type=COUNTER	2013-09-03T04:03:01.795	0.0
Clone this wiki locally