Implementation of the Language Server Protocol for PromQL.
- 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)
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.
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.
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.
-
Install the YouCompleteMe Plugin.
-
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
-
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')] \ }, \ ]
The Vim command :YcmDebugInfo
gives status information and points to logfiles.
- Install package
LSP
,LSP-promql
viaPackage Control
. - Follow the installation instruction.
Refer to CONTRIBUTING.md
Apache License 2.0, see LICENSE.