| 1 |
# HTTP Client-Server Example |
| 2 |
|
| 3 |
An HTTP client connects to an HTTP server. |
| 4 |
They both generate span information to `stdout`. |
| 5 |
These instructions expect you have [docker-compose](https://docs.docker.com/compose/) installed. |
| 6 |
|
| 7 |
Bring up the `http-server` and `http-client` services to run the example: |
| 8 |
|
| 9 |
```sh |
| 10 |
docker-compose up --detach http-server http-client |
| 11 |
``` |
| 12 |
|
| 13 |
The `http-client` service sends just one HTTP request to `http-server` and then exits. |
| 14 |
View the span and metric generated to `stdout` in the logs: |
| 15 |
|
| 16 |
```sh |
| 17 |
docker-compose logs http-client |
| 18 |
``` |
| 19 |
|
| 20 |
View the span generated by `http-server` in the logs: |
| 21 |
|
| 22 |
```sh |
| 23 |
docker-compose logs http-server |
| 24 |
``` |
| 25 |
|
| 26 |
Shut down the services when you are finished with the example: |
| 27 |
|
| 28 |
```sh |
| 29 |
docker-compose down |
| 30 |
``` |