GithubHelp home page GithubHelp logo

isabella232 / promql-langserver Goto Github PK

View Code? Open in Web Editor NEW

This project forked from prometheus-community/promql-langserver

0.0 0.0 0.0 2.15 MB

PromQL language server

License: Apache License 2.0

Go 90.52% Makefile 0.65% Batchfile 0.02% TypeScript 8.78% Dockerfile 0.03%

promql-langserver's Introduction

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.

promql-langserver's People

Contributors

slrtbtfs avatar nexucis avatar dependabot-preview[bot] avatar weastel avatar haibeey avatar squat avatar apupier avatar nevill avatar prombot avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.