File tree Expand file tree Collapse file tree 9 files changed +696
-5
lines changed
Expand file tree Collapse file tree 9 files changed +696
-5
lines changed Original file line number Diff line number Diff line change @@ -10,14 +10,20 @@ This provides access to your Grafana instance and the surrounding ecosystem.
1010- [x] List and fetch datasource information
1111- [ ] Query datasources
1212 - [x] Prometheus
13- - [ ] Loki (log queries, metric queries)
13+ - [x] Loki
14+ - [x] Log queries
15+ - [x] Metric queries
1416 - [ ] Tempo
1517 - [ ] Pyroscope
1618- [x] Query Prometheus metadata
1719 - [x] Metric metadata
1820 - [x] Metric names
1921 - [x] Label names
2022 - [x] Label values
23+ - [x] Query Loki metadata
24+ - [x] Label names
25+ - [x] Label values
26+ - [x] Stats
2127- [x] Search, create, update and close incidents
2228- [ ] Start Sift investigations and view the results
2329
@@ -41,6 +47,10 @@ This is useful if you don't use certain functionality or if you don't want to ta
4147| ` create_incident ` | Incident | Create an incident in Grafana Incident |
4248| ` add_activity_to_incident ` | Incident | Add an activity item to an incident in Grafana Incident |
4349| ` resolve_incident ` | Incident | Resolve an incident in Grafana Incident |
50+ | ` query_loki_logs ` | Loki | Query and retrieve logs using LogQL (either log or metric queries) |
51+ | ` list_loki_label_names ` | Loki | List all available label names in logs |
52+ | ` list_loki_label_values ` | Loki | List values for a specific log label |
53+ | ` query_loki_stats ` | Loki | Get statistics about log streams |
4454
4555## Usage
4656
Original file line number Diff line number Diff line change @@ -22,6 +22,7 @@ func newServer() *server.MCPServer {
2222 tools .AddDatasourceTools (s )
2323 tools .AddIncidentTools (s )
2424 tools .AddPrometheusTools (s )
25+ tools .AddLokiTools (s )
2526 return s
2627}
2728
Original file line number Diff line number Diff line change @@ -19,5 +19,20 @@ services:
1919 command :
2020 - --config.file=/etc/prometheus/prometheus.yml
2121
22- volumes :
23- var-lib-grafana :
22+ loki :
23+ image : grafana/loki:2.6.0
24+ ports :
25+ - " 3100:3100"
26+ command : -config.file=/etc/loki/loki-config.yml
27+ volumes :
28+ - ./tests/loki-config.yml:/etc/loki/loki-config.yml
29+
30+ promtail :
31+ image : grafana/promtail:2.6.0
32+ volumes :
33+ - ./tests/promtail-config.yml:/etc/promtail/config.yml
34+ - /var/log:/var/log
35+ - /var/run/docker.sock:/var/run/docker.sock
36+ command : -config.file=/etc/promtail/config.yml
37+ depends_on :
38+ - loki
Original file line number Diff line number Diff line change 1+ auth_enabled : false
2+
3+ server :
4+ http_listen_port : 3100
5+
6+ ingester :
7+ lifecycler :
8+ address : 127.0.0.1
9+ ring :
10+ kvstore :
11+ store : inmemory
12+ replication_factor : 1
13+ final_sleep : 0s
14+ chunk_idle_period : 5m
15+ chunk_retain_period : 30s
16+ wal :
17+ enabled : true
18+ dir : /loki/wal
19+
20+ compactor :
21+ working_directory : /loki/compactor
22+
23+ schema_config :
24+ configs :
25+ - from : 2020-10-24
26+ store : boltdb-shipper
27+ object_store : filesystem
28+ schema : v11
29+ index :
30+ prefix : index_
31+ period : 24h
32+
33+ storage_config :
34+ boltdb_shipper :
35+ active_index_directory : /loki/boltdb-shipper-active
36+ cache_location : /loki/boltdb-shipper-cache
37+ cache_ttl : 24h
38+ shared_store : filesystem
39+ filesystem :
40+ directory : /loki/chunks
Original file line number Diff line number Diff line change 1+ server :
2+ http_listen_port : 9080
3+
4+ positions :
5+ filename : /tmp/positions.yaml
6+
7+ clients :
8+ - url : http://loki:3100/loki/api/v1/push
9+
10+ scrape_configs :
11+ - job_name : docker
12+ docker_sd_configs :
13+ - host : unix:///var/run/docker.sock
14+ refresh_interval : 5s
15+ relabel_configs :
16+ - source_labels : ['__meta_docker_container_name']
17+ regex : ' /(.*)'
18+ target_label : ' container'
Original file line number Diff line number Diff line change @@ -13,4 +13,11 @@ datasources:
1313 uid : prometheus-demo
1414 type : prometheus
1515 access : proxy
16- url : https://prometheus.demo.prometheus.io
16+ url : https://prometheus.demo.prometheus.io
17+ - name : Loki
18+ id : 3
19+ uid : loki
20+ type : loki
21+ access : proxy
22+ url : http://loki:3100
23+ isDefault : false
Original file line number Diff line number Diff line change @@ -53,7 +53,8 @@ func TestDatasourcesTools(t *testing.T) {
5353 ctx := newTestContext ()
5454 result , err := listDatasources (ctx , ListDatasourcesParams {})
5555 require .NoError (t , err )
56- assert .Greater (t , len (result ), 0 )
56+ // Three datasources are provisioned in the test environment (Prometheus and Loki).
57+ assert .Len (t , result , 3 )
5758 })
5859
5960 t .Run ("get datasource by uid" , func (t * testing.T ) {
You can’t perform that action at this time.
0 commit comments