Re: [prometheus-developers] Would tooling for PromQL formatting/manipulation be useful and where should it live?

2022-10-06 Thread Julius Volz
Ok, let's do it then, preferably with some --experimental flag for now.

On Wed, Oct 5, 2022 at 10:46 PM Julien Pivotto 
wrote:

> Promtool check metrics is an example that also does not call an API on
> Prometheus side.
>
> I think a subcommand Promtool promql would be acceptable to me.
>
> On 05 Oct 09:06, r...@chronosphere.io wrote:
> > 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 <
> roidel...@prometheus.io>
> > > 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 
> 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 <
> r...@chronosphere.io>
> > >> 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 

Re: [prometheus-developers] Would tooling for PromQL formatting/manipulation be useful and where should it live?

2022-10-05 Thread Julien Pivotto
Promtool check metrics is an example that also does not call an API on
Prometheus side.

I think a subcommand Promtool promql would be acceptable to me.

On 05 Oct 09:06, r...@chronosphere.io wrote:
> 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  
> > 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  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  
> >> 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 prometheus-devel...@googlegroups.com.
> >> > > > To view this discussion on the web visit
> >> > > 
> >> 

Re: [prometheus-developers] Would tooling for PromQL formatting/manipulation be useful and where should it live?

2022-10-05 Thread Frederic Branczyk
I’m not sure your use cases match, but I’ve always wanted something like
prepared statements where something like a “?” operator could be an
expression placeholder, possibly even restricted to something like a label
matcher, or just a label-value, etc.

I think there might be overlap in the use cases but if not then sorry for
the noise.

On Wed 5. Oct 2022 at 18:45, Matthias Rampke  wrote:

> Re: drawing the line – I often feel like "specialized" tools that try to
> solve all advanced use cases end up with very complex and hard to use
> configuration (looking at you, relabeling). I often find it more pleasant
> to express what I want to do as *code*. What would an API look like that
> you or others could use to build their own tools for their specific needs,
> without making it part of any particular CLI?
>
> In general, is there a mock-up or reference of the interface you propose?
>
> /MR
>
> On Wed, Oct 5, 2022 at 4:06 PM r...@chronosphere.io 
> wrote:
>
>> 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 
>>> 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  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 
 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 

Re: [prometheus-developers] Would tooling for PromQL formatting/manipulation be useful and where should it live?

2022-10-05 Thread Matthias Rampke
Re: drawing the line – I often feel like "specialized" tools that try to
solve all advanced use cases end up with very complex and hard to use
configuration (looking at you, relabeling). I often find it more pleasant
to express what I want to do as *code*. What would an API look like that
you or others could use to build their own tools for their specific needs,
without making it part of any particular CLI?

In general, is there a mock-up or reference of the interface you propose?

/MR

On Wed, Oct 5, 2022 at 4:06 PM r...@chronosphere.io 
wrote:

> 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 
>> 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  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 
>>> 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 

Re: [prometheus-developers] Would tooling for PromQL formatting/manipulation be useful and where should it live?

2022-10-05 Thread r...@chronosphere.io
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  
> 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  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  
>> 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 prometheus-devel...@googlegroups.com.
>> > > > 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 prometheus-devel...@googlegroups.com.
>> > > To view this discussion on the web visit
>> > > 
>> 

Re: [prometheus-developers] Would tooling for PromQL formatting/manipulation be useful and where should it live?

2022-10-05 Thread Julius Volz
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 
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  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 
> 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 prometheus-developers+unsubscr...@googlegroups.com.
> > > > 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 prometheus-developers+unsubscr...@googlegroups.com.
> > > 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 prometheus-developers+unsubscr...@googlegroups.com.
> > 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 

Re: [prometheus-developers] Would tooling for PromQL formatting/manipulation be useful and where should it live?

2022-10-05 Thread Julien Pivotto
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  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  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 prometheus-developers+unsubscr...@googlegroups.com.
> > > 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 prometheus-developers+unsubscr...@googlegroups.com.
> > 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 prometheus-developers+unsubscr...@googlegroups.com.
> 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 prometheus-developers+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/prometheus-developers/Yz1Nn6JYQcHbR8sN%40nixos.


Re: [prometheus-developers] Would tooling for PromQL formatting/manipulation be useful and where should it live?

2022-10-05 Thread Julius Volz
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  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  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 prometheus-developers+unsubscr...@googlegroups.com.
> > 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 prometheus-developers+unsubscr...@googlegroups.com.
> 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 prometheus-developers+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/prometheus-developers/CA%2BT6Yoy6q16DUOTW0Tt8aCL6J4SV%2BfeKpqapz%2BsYgTRqAMemMQ%40mail.gmail.com.


Re: [prometheus-developers] Would tooling for PromQL formatting/manipulation be useful and where should it live?

2022-10-05 Thread David Leadbeater
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  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 prometheus-developers+unsubscr...@googlegroups.com.
> 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 prometheus-developers+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/prometheus-developers/CAP9KPhDebQUp3jMHjHgK4QzDuMd9Q6d1i2aXUkpBJQBRYKUrWg%40mail.gmail.com.