Skip to content

feat(visibility): Add vespa metrics visibility using prometheus and grafana #83

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

Merged
merged 3 commits into from
Oct 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
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
1 change: 1 addition & 0 deletions deployment/docker-compose.dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ services:
restart: always
networks:
xyne:
driver: bridge
volumes:
vespa-data:
driver: local
62 changes: 62 additions & 0 deletions deployment/docker-compose.metrics.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
version: "3.9"

services:
prometheus:
image: "prom/prometheus"
container_name: xyne-prometheus
volumes:
- ./prometheus-selfhosted.yml:/etc/prometheus/prometheus-selfhosted.yml
ports:
- "9090:9090"
command:
- "--config.file=/etc/prometheus/prometheus-selfhosted.yml"
networks:
- xyne
grafana:
image: grafana/grafana
container_name: xyne-grafana
volumes:
- ./grafana/provisioning:/etc/grafana/provisioning
ports:
- "3002:3000"
networks:
- xyne
vespa:
image: vespaengine/vespa
container_name: vespa
hostname: vespa-container
ports:
- "8080:8080"
- "19071:19071"
volumes:
- ../server/vespa-data:/opt/vespa/var
networks:
- xyne
restart: always
logging:
driver: json-file
options:
max-size: "50m"
max-file: "6"

xyne-db:
image: postgres
container_name: xyne-db
environment:
POSTGRES_USER: xyne
POSTGRES_PASSWORD: xyne
POSTGRES_DB: xyne
ports:
- "${XYNE_DB_PORT:-5432}:5432"
volumes:
- ../server/xyne-data:/var/lib/postgresql/data
networks:
- xyne
restart: always
networks:
xyne:
driver: bridge
volumes:
vespa-data:
driver: local

16 changes: 16 additions & 0 deletions deployment/prometheus-selfhosted.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
global:
scrape_interval: 10s
scrape_timeout: 10s


scrape_configs:


- job_name: 'xyne-data-ingest'


metrics_path: /prometheus/v1/values


static_configs:
- targets: ['vespa:8080']
37 changes: 37 additions & 0 deletions observability/docs/observability.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
## Steps to run the metrics dashboard

To run the metrics, from the root folder run this command in the terminal
```sh
docker-compose -f deployment/docker-compose.metrics.yml up
```

### Ensure Prometheus is up and running
To ensure **Prometheus** is up and running
- Navigate to `http://localhost:9090/`.
- If Prometheus is running correctly you'll land in the dashboard.
- Then Navigate to Status > Targets.
- This will take to the lost of targets from which metrics is getting scraped. In our case you should see `xyne-data-ingest` table having an `up` state.
- This confirms that prometheus is able to scrape vespa's data correctly.


### Set-up Grafana metrics

To set up **Grafana** dashboad :
- Navigate to `http://localhost:3002/` in your browser.
- To log in use the default username and password (admin)
- Once you see the dashboard, Navigate to Connections using the Nav bar to the left.
- Under Connections you will find a tab for `Data Sources`. Navigate to that and look for `Prometheus`.
- In the `Settings` section of the Prometheus Data Source, paste the connection URL `http://xyne-prometheus:9090`. This is URL for the prometheus instance running in docker.
- Now scroll down to Save and Test your connection. It should show a `Successful` message.
- Now using the same Nav bar to the left, navigate to `Dashboards`.
- Once on the dashboard page you will see the `New` button in the top right corner. Click on that button and select the `import` option.
- Now in the import section, either upload or paste the `grafana-metrics.json` file in the setup folder of this directory.
- Click on load and then import.
- You should now have the dashboard imported successfully. Navigate back to the Dashboard section and you should see the `Xyne Metrics` dashboard up.
- Initially you will have to:
- Click on the dashboard.
- Hover on the panel and click on the menu (the three dots to the top-right of the panel), and click edit.
- In the `Queries` tab select the **prometheus** datasource which you've just added.
- Click on `Run Queries` to get the results.
- Follow the same steps for the rest of the panels.

Loading
Loading