prometheus icon indicating copy to clipboard operation
prometheus copied to clipboard

Promtool: add http config support to query commands

Open FUSAKLA opened this issue 2 years ago • 5 comments

Hi,

as a followup to the previous PR from Alertmanager https://github.com/prometheus/alertmanager/pull/2764 and stale PR for promtool https://github.com/prometheus/prometheus/pull/8082

This PR adds support for HTTP config using the promconfig common package same as amtool does for query subcommands.

Works just fine, tested with base auth and bearer token.

@roidelapluie would you mind taking a look since you were actibe in both above linked PRs? :pray:

FUSAKLA avatar Oct 24 '22 23:10 FUSAKLA

@dgl would you find a second to review please?:pray:

FUSAKLA avatar Nov 15 '22 16:11 FUSAKLA

Can we move this code to Prometheus/common?

roidelapluie avatar Nov 15 '22 19:11 roidelapluie

Can we move this code to Prometheus/common?

Which part of the code do you exactly mean to move to the common? The amconfig.LoadHTTPConfigFile?

FUSAKLA avatar Nov 15 '22 20:11 FUSAKLA

yes please

roidelapluie avatar Nov 22 '22 23:11 roidelapluie

Actually it appears the function is already there, just in the test files and not used, nor by Alertmanager or Prometheus itself. Alertmanager has one additional line in that function, not sure hot to deal with this difference.

PR here https://github.com/prometheus/common/pull/415

FUSAKLA avatar Nov 26 '22 09:11 FUSAKLA

Switched to prometheus/common as agreed after https://github.com/prometheus/common/pull/415

FUSAKLA avatar Dec 09 '22 11:12 FUSAKLA

Rebased, @roidelapluie friendly bump if you would find awhile :pray:

FUSAKLA avatar Dec 15 '22 21:12 FUSAKLA

Rebased again

FUSAKLA avatar Jan 03 '23 14:01 FUSAKLA

Rebased, fuzzing seems to be flaky?

FUSAKLA avatar Jan 09 '23 22:01 FUSAKLA

Fuzzing issue #11810

bboreham avatar Jan 27 '23 16:01 bboreham

Would you consider including tsdb create-blocks-from rules, which also performs queries ? (no pressure, just asking)

bboreham avatar Jan 27 '23 16:01 bboreham

I have a basic version of tsdb create-blocks-from rules working here: https://github.com/Pokom/prometheus/commit/94094bf176f612276f1cc62dfb51d785df8ba7f4. For the first pass I opted to get the code working where the flag isn't shared between the two subcommands.

If FUSAKLA isn't keen to implement the feature in this PR, I'd be more then happy to follow up with a PR to implement it.

Pokom avatar Jan 27 '23 19:01 Pokom

Hi, sorry for delay. Sure, I'll add the support event for the tsdb create-blocks-from rules.

FUSAKLA avatar Feb 06 '23 19:02 FUSAKLA

@bboreham PTAL

@roidelapluie friendly bump once again :pray:

FUSAKLA avatar Feb 06 '23 21:02 FUSAKLA

The failing CI seems weird once again :thinking: The issues with go mod seems to be unrelated or at least unintentional.. whole make and tests passes locally

FUSAKLA avatar Feb 06 '23 21:02 FUSAKLA

can you run go mod tidy?

roidelapluie avatar Feb 06 '23 23:02 roidelapluie

I ran it multiple times locally (go 1.19) and in container (official 1.18) with no changes :thinking: Running whole make passes

FUSAKLA avatar Feb 07 '23 08:02 FUSAKLA

I'm not able to reproduce anyhow locally the issues CI bumps into. My changed does not change any dependencies, so I do not see reason for it to change to cause changes in go.mod or go.sum :/

FUSAKLA avatar Feb 07 '23 09:02 FUSAKLA

I think there is some general issue with CI - I've seen these error messages on other PRs. Didn't yet figure out what the issue is.

bboreham avatar Feb 07 '23 15:02 bboreham

I suspected bump in the golang-builder on Go 1.20, but that seems also not to be an issue… :thinking: Might be worth trying to run on main branch to see if it fails only on branches, seeing other PRs with the same issues as Bryan sated

FUSAKLA avatar Feb 07 '23 16:02 FUSAKLA

:tada: rebased on master and CI passes..

@roidelapluie Would you take a look :pray:

FUSAKLA avatar Feb 10 '23 14:02 FUSAKLA

Hi, sorry for delay. Sure, I'll add the support event for the tsdb create-blocks-from rules.

Does not seem to be done

roidelapluie avatar Feb 10 '23 21:02 roidelapluie

Should be fixed now :crossed_fingers:

FUSAKLA avatar Feb 14 '23 08:02 FUSAKLA

Thanks!

roidelapluie avatar Feb 14 '23 10:02 roidelapluie

Thank you! :tada:

FUSAKLA avatar Feb 14 '23 11:02 FUSAKLA