• Stars
    star
    176
  • Rank 215,731 (Top 5 %)
  • Language
    Go
  • License
    Apache License 2.0
  • Created about 5 years ago
  • Updated 20 days ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

PromQL language server

CircleCI Go Report Card GoDoc golangci-lint

promql-lsp

Implementation of the Language Server Protocol for PromQL.

Roadmap

  • Connect to IDEs and text editors over
    • Stdio
    • Websocket
    • HTTP
  • Sync document content with the client
  • Support plain PromQL queries
  • Support queries inside yaml files (e.g. alertmanager configuration)
  • Connect to a prometheus instance to get label and metric data
  • Show error messages for incorrect queries in the client
  • Show documentation on hover
    • Type information
    • Function documentation
    • Aggregator documentation
    • Keyword documentation
    • Metric and label help strings from a prometheus instance
  • Completion
    • Functions
    • Metrics
    • Recording Rules
    • Aggregators
    • Labels
    • Label Values
    • Context sensitive, i.e respecting function argument types
  • Signature information for functions (while typing)
  • (Linting)
  • (Formatting)

Some Screenshots

Completion in VS Code

Completion in VS Code

Metric metadata from a Prometheus Server

Metric Metadata in VS Code

Viewing documentation right from your editor

Docs in VS Code

Vim and other editors are supported, too

Vim

Using the Language Server

A Language Server on its own is not very useful. You need some Language Client to use it with.

The following Language Clients have been tested with this language server. More will be added in the future.

Feel free to reach out if you want to use it with another Editor/Tool.

Reading this documentation can help you in your work.

VS Code

There exists a VS Code extension based on this language server: https://github.com/slrtbtfs/vscode-prometheus

It is used as the main test platform for this language server.

Since it isn't published on the Extensions Marketplace yet, you'll have to follow the somewhat more complicated installation steps described in the README there.

(Neo)Vim

With Vim, currently only PromQL queries inside YAML files work without additional support. Generally the experience with Vim is more buggy than with VS Code.

Setup

  1. Install the YouCompleteMe Plugin.

  2. Put the configuration following configuration file for the language server in .vim/promql-lsp.yaml.

     # Change this adress to the address of the prometheus server you want to use for metadata
     prometheus_url: http://localhost:9090
     rpc_trace: text
    
  3. Add the following to your .vimrc

     let g:ycm_language_server = [
       \   { 'name': 'promql',
       \     'filetypes': [ 'yaml' ],
       \     'cmdline': [ 'promql-langserver', '--config-file', expand('~/.vim/promql-lsp.yaml')]
       \   },
       \ ]
    

Debugging

The Vim command :YcmDebugInfo gives status information and points to logfiles.

Sublime Text 3

  1. Install package LSP, LSP-promql via Package Control.
  2. Follow the installation instruction.

Contributing

Refer to CONTRIBUTING.md

License

Apache License 2.0, see LICENSE.

More Repositories

1

helm-charts

Prometheus community Helm charts
Mustache
4,981
star
2

windows_exporter

Prometheus exporter for Windows machines
Go
2,858
star
3

postgres_exporter

A PostgreSQL metric exporter for Prometheus
Go
2,720
star
4

elasticsearch_exporter

Elasticsearch stats exporter for Prometheus
Go
1,910
star
5

PushProx

Proxy to allow Prometheus to scrape through NAT etc.
Go
715
star
6

json_exporter

A prometheus exporter which scrapes remote JSON by JSONPath
Go
631
star
7

node-exporter-textfile-collector-scripts

Scripts for node-exporter's textfile collector
Python
490
star
8

ipmi_exporter

Remote IPMI exporter for Prometheus
Go
459
star
9

avalanche

Prometheus/OpenMetrics endpoint series generator for load testing.
Go
393
star
10

ansible

Ansible Collection for Prometheus
Python
357
star
11

jiralert

JIRA integration for Prometheus Alertmanager
Go
333
star
12

pro-bing

A library for creating continuous probers
Go
317
star
13

bind_exporter

Prometheus exporter for BIND
Go
299
star
14

smartctl_exporter

Export smartctl statistics to prometheus
Go
289
star
15

systemd_exporter

Exporter for systemd unit metrics
Go
283
star
16

prom-label-proxy

A proxy that enforces a given label in a given PromQL query.
Go
262
star
17

stackdriver_exporter

Google Stackdriver Prometheus exporter
Go
254
star
18

prometheus-playground

Turnkey sandbox projects demonstrating a wide variety of Prometheus use cases
Go
164
star
19

pgbouncer_exporter

Prometheus exporter for PgBouncer
Go
138
star
20

ecs_exporter

Prometheus exporter for Amazon Elastic Container Service (ECS)
Go
78
star
21

vscode-promql

This is supposed to become a PromQL extension for vs code.
TypeScript
52
star
22

monaco-promql

PromQL support for the Monaco code editor
TypeScript
31
star
23

community

Prometheus & The Ecosystem Community Meeting Information
20
star
24

prometheus-community

13
star
25

snmp

Tools and configurations for translating SNMP into Prometheus
11
star
26

kitefactory

Makefile
3
star
27

sublimelsp-promql

PromQL support for Sublime LSP plugin, using promql-langserver
Python
2
star