Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Grafana integration example #2408

Merged
merged 5 commits into from
Sep 1, 2020
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
reorg into folders, add hotROD dashboard, add basic description to RE…
…ADME

Signed-off-by: fktkrt <fktkrt@gmail.com>
  • Loading branch information
fktkrt committed Aug 29, 2020
commit 91900d64f22794596f1d328a5baa3120736e9c90
52 changes: 41 additions & 11 deletions examples/grafana-integration/README.md
Original file line number Diff line number Diff line change
@@ -1,16 +1,15 @@
# Hot R.O.D. - Rides on Demand - Grafana integration

This is the Hot R.O.D. demo application that consists of the same components as the `examples/hotrod/`, only Grafana and Loki integration is added to this setup, so you can correlate logs and traces in one application.
This is the Hot R.O.D. demo application that consists of the same components as the `examples/hotrod/`, only Grafana, Loki and Prometheus integration is added to this setup, so you can correlate logs, metrics and traces in one application.
fktkrt marked this conversation as resolved.
Show resolved Hide resolved

## Running
## Running via `docker-compose`

### Run everything via `docker-compose`
### Prerequisites

* Clone the Jaeger repository `git clone https://github.com/jaegertracing/jaeger.git`, then `cd examples/grafana-integration`

#### Prerequisites
* Download `docker-compose.yml` from https://github.com/jaegertracing/jaeger/blob/master/examples/grafana-integration/docker-compose.yml
* Download the `datasources.yaml` from the `examples/grafana-integration/` folder
* All services will log to Loki via the loki docker logging plugin.
To install run this on the host once:
To install run this on the host:

```bash
docker plugin install \
Expand All @@ -19,8 +18,39 @@ grafana/loki-docker-driver:latest \
--grant-all-permissions
```

#### Deploy the local setup
* Run Grafana and Loki integration with Jaeger backend using HotROD demo with `docker-compose -f path-to-yml-file up`
* Access Grafana UI at http://localhost:3000 and HotROD app at http://localhost:8080
* Shutdown / cleanup with `docker-compose -f path-to-yml-file down`
### Deploy the services

Pull up the services: `docker-compose up`
fktkrt marked this conversation as resolved.
Show resolved Hide resolved

### Access the services
* HotROD application at http://localhost:8080
* Access Grafana UI at http://localhost:3000
fktkrt marked this conversation as resolved.
Show resolved Hide resolved

### Explore with Loki

Currently the most powerful way to correlate application logs with traces can be performed via Grafana's Explore interface.

After setting the datasource to Loki, all the log labels become available, and can be easily filtered using [Loki's LogQL query language](https://grafana.com/docs/loki/latest/logql/).

For example after selecting the compose project, errors can be filtered with the following expression:
fktkrt marked this conversation as resolved.
Show resolved Hide resolved

```
{compose-project="grafana-integration"} |= "error"
```

which will list the redis timeout events.

### HotROD - Metrics and logs overview dashboard

Since the HotROD application can expose its metrics in Prometheus' format, these can be also used during investigation.

This example includes a dashboard, which contains a log panel, which displays the logs for the selected services in real time. These can be also filtered by a search field.
fktkrt marked this conversation as resolved.
Show resolved Hide resolved

There are also panels to display the ratio/percentage of errors in the current timeframe.

Additionally, there are graphs for each service, visualing the rate of the requests and showing latency percentiles.

### Clean up

To stop the containers use `docker-compose -f path-to-yml-file down`
fktkrt marked this conversation as resolved.
Show resolved Hide resolved

16 changes: 9 additions & 7 deletions examples/grafana-integration/docker-compose.yaml
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
version: '2'

services:
grafana:
image: grafana/grafana:7.1.4
ports:
- '3000:3000'
volumes:
- ./datasources.yaml:/etc/grafana/provisioning/datasources/datasources.yaml
- ./grafana/provisioning/:/etc/grafana/provisioning/
logging:
driver: loki
options:
Expand All @@ -16,6 +17,7 @@ services:
ports:
- '3100:3100'
command: -config.file=/etc/loki/local-config.yaml
# send Loki traces to Jaeger
environment:
- JAEGER_AGENT_HOST=jaeger
- JAEGER_AGENT_PORT=6831
Expand All @@ -39,9 +41,9 @@ services:
hotrod:
image: jaegertracing/example-hotrod:latest
ports:
- "8080:8080"
- "8083:8083"
command: ["-m", "prometheus","all"]
- '8080:8080'
- '8083:8083'
command: ["-m","prometheus","all"]
environment:
- JAEGER_AGENT_HOST=jaeger
- JAEGER_AGENT_PORT=6831
Expand All @@ -51,11 +53,11 @@ services:
loki-url: 'http://localhost:3100/api/prom/push'

prometheus:
image: prom/prometheus:v2.19.0
image: prom/prometheus:v2.19.1
volumes:
- ./prometheus.yml:/etc/prometheus/prometheus.yml:ro
- ./prometheus/prometheus.yml:/etc/prometheus/prometheus.yml:ro
ports:
- 9090:9090
- '9090:9090'
command:
- --config.file=/etc/prometheus/prometheus.yml
logging:
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
apiVersion: 1
fktkrt marked this conversation as resolved.
Show resolved Hide resolved

providers:
- name: 'HotROD'
orgId: 1
folder: ''
type: file
disableDeletion: false
editable: true
options:
path: /etc/grafana/provisioning/dashboards
Loading