I do feel that formatting entire rule files would be in scope for promtool, but more specialized formatting and manipulations of individual PromQL queries (while cool) should likely live in a separate tool. I see the scope of promtool to be mostly a tool to interact with both the Prometheus server, its immediately configuration files, and its TSDB directory.
On Wed, Oct 5, 2022 at 11:13 AM David Leadbeater <[email protected]> wrote: > Hi Rob, > > I wonder if PromQL related things fit in promtool given the use for > PromQL is wider than just Prometheus. I can imagine something like a > "promqltool", which might actually be backed by the promql language > server (so people can get similar things in editors too). > > However that's clearly a larger discussion, I don't see an issue with > adding some promql subcommands to promtool for now, particularly as > the formatting one exercises the code in Prometheus and is useful for > developers anyway. > > I do think it's important to get the interface right, while we don't > guarantee complete stability in promtool, it is difficult to change > without breaking people. To that end I'm thinking of adding a top > level "--experimental" flag in promtool, which can then enable the > promql subcommands. (We do have feature flags in promtool, but that > feels wrong here, as feature flags are currently shared with > prometheus.) > > David > > On Wed, 5 Oct 2022 at 07:58, Rob Skillington <[email protected]> wrote: > > > > Hey Prometheus team, > > > > Have noticed asks for tooling around reformatting/manipulating and > generally refactoring sets of queries and rule definitions (where there is > a high number of defined queries). Use cases include such cases as "I want > to duplicate a set of alerts to target different environments with > different label combinations and also conditions". > > > > I opened a PR to add some basic commands given I had seen this earlier > PR mention that there was intention for the PromQL AST pretty print > formatting to be useable from promtool: > > https://github.com/prometheus/prometheus/pull/10544 > > > > I now realize it may have been better perhaps to raise the question of > if/where it should live here before opening the PR. What would be the > reception of housing these commands in promtool and/or if not there then > where a good recommended place would be for these to live do people think? > > > > PR in question: > > https://github.com/prometheus/prometheus/pull/11411 > > > > Best, > > Rob > > > > > > > > -- > > You received this message because you are subscribed to the Google > Groups "Prometheus Developers" group. > > To unsubscribe from this group and stop receiving emails from it, send > an email to [email protected]. > > To view this discussion on the web visit > https://groups.google.com/d/msgid/prometheus-developers/CABakzZa5NKzVY5yaY-NKbuqeULx8zhOHkuTKo_QiWCpFG%2BDnxQ%40mail.gmail.com > . > > -- > You received this message because you are subscribed to the Google Groups > "Prometheus Developers" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > To view this discussion on the web visit > https://groups.google.com/d/msgid/prometheus-developers/CAP9KPhDebQUp3jMHjHgK4QzDuMd9Q6d1i2aXUkpBJQBRYKUrWg%40mail.gmail.com > . > -- You received this message because you are subscribed to the Google Groups "Prometheus Developers" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/prometheus-developers/CA%2BT6Yoy6q16DUOTW0Tt8aCL6J4SV%2BfeKpqapz%2BsYgTRqAMemMQ%40mail.gmail.com.

