Yes I realized that to manipulate the AST (and the AST will of course 
change as new functions and features are added) much like codemirror-promql 
moved into the Prometheus repository to get updates as they come to PromQL 
that somewhere in the Prometheus repo itself would be a good starting point.

How would you all feel of adding the commands under a "--experimental" flag 
as David suggested? I'd be happy to make the "--experimental" flag addition 
too David if you like, also happy to wait too until that's available if 
that's preferential.


On Wednesday, October 5, 2022 at 5:55:58 AM UTC-4 Julius Volz wrote:

> The versioning aspect is a good point, I hadn't thought of that.
>
> If we make promtool's scope broader than what I proposed, it's IMO still a 
> question of where we draw the line in terms of niche specialized use cases. 
> The proposes features in 
> https://github.com/prometheus/prometheus/pull/11411 are kind of 
> borderline to me in that regard, but I also wouldn't be unhappy if they 
> went into promtool.
>
> On Wed, Oct 5, 2022 at 11:25 AM Julien Pivotto <[email protected]> 
> wrote:
>
>> I think the opposite - Prometheus contains PromQL, it's same codebase,
>> same version. It makes sense to have those tools in promtool as well, so
>> it is shipped to everyone, and has a known version.
>>
>> On 05 Oct 11:22, Julius Volz wrote:
>> > 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
>> .
>>
>> -- 
>> Julien Pivotto
>> @roidelapluie
>>
>

-- 
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/41dc988f-b46c-49d0-aa2c-e09865d883c5n%40googlegroups.com.

Reply via email to