GithubHelp home page GithubHelp logo

isabella232 / promgrep Goto Github PK

View Code? Open in Web Editor NEW

This project forked from sourcegraph/promgrep

0.0 0.0 0.0 15 KB

small utility searches Go code for prometheus metrics declarations

License: Apache License 2.0

Go 100.00%

promgrep's Introduction

promgrep

Intro

promgrep is a small utility to search for the locations in Go code where Prometheus metrics are declared.

Usage

Run promgrep in the root directory of your Go project (where your go.mod file is).

Without args

promgrep

promgrep will list the locations of all the metric declarations together with the metric names and help strings.

With one argument: name of a metric

promgrep some:metric:name

promgrep will search for the location of that particular metric declaration.

Matching

promgrep is doing static analysis and therefore can only deduce values of arguments to metric construction function calls if those arguments are basic literals.

For cases where arguments are not derived it uses partial matching and assigns a relative score to each partial match (in the range [0..100] with 0 meaning no match and 100 meaning exact match).

The matching function also accepts partial metric names to search for, so you can run

promgrep some:partial:metric:name

and it will list all metric declarations that contain this partial name.

Output

The code locations in the promgrep output are of the form

relative_path_to_file:line_number

and should be clickable in Emacs buffers, Goland terminals and other tools that parse format and make it navigable. Clicking on an output line should get you to the place in code where the declaration is.

promgrep's People

Contributors

uwedeportivo avatar sqs avatar elizabethstirling avatar gbrik 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.