mirror of
				https://github.com/juspay/hyperswitch.git
				synced 2025-10-31 18:17:13 +08:00 
			
		
		
		
	Service Monitoring
Components
- Promtail
- is a collector which ships the contents of local logs to a private Grafana Loki instance or Grafana Cloud. It is usually deployed to every machine that has applications needed to be monitored.
- Loki
- is a search engine for logs inspired by Prometheus.
- OTEL Collector
- is vendor-agnostic way to receive, process and export telemetry data.
- Tempo
- is a distributed tracing backend.
- Grafana
- is a query frontend to output data.
How to run
cd monitoring
# start containers
docker-compose up -d
# FIXME: maybe we can remove manual setups with help of a config or automation?
Set up logs monitor
- Go to page of grafana: http://127.0.0.1:3000/
- Use login and password "admin"
- Add Loki data source: http://loki:3100
- "Save & Exit" should give "Data source connected and labels found." if everything is okay.
- Go to "Explore" tab and make a query "{job="varlogs"} |= ``".
Set up logs monitor along with tracing
- Navigate to Grafana
- Enter "admin" for both username and password [skip if it asks for updating the password]
- Add data source (Tempo)
- select Tempo
- set URLtohttp://tempo:3200
- save
 
- select 
- Add data source (Loki)
- select Loki
- make it default
- set URLtohttp://loki:3100
- add Derived fields-
- set Nametotrace_id
- set Regextotrace_id":"(.*?)"(?=,|}|$)
- set URLto${__value.raw}
- set URL labeltoTempo
- enable Internal linkand selectTempo
- save
 
- Navigate to Explore
- Add query [example, job=router]
Notes:
- Use trace_idin logs to jump to Tempo view to visualize the tracing.
- Searching through recent trace ids is also possible by selecting appropriate Service Namein Tempo view underSearchtab. The UI also provides other filter options.
Helpful commands
- http://127.0.0.1:3100/ready
- To get status of Loki, it should give "Ready".
- docker container ls -as
- List running containers.
- docker exec -it monitoring_promtail_1 bash
- Look inside of promtail container.
- docker-compose down
- Stop containers
