Skip to content

promtool: Show more human readable got/exp output#8064

Merged
dgl merged 2 commits intoprometheus:mainfrom
dgl:promtool-test-output
Oct 28, 2021
Merged

promtool: Show more human readable got/exp output#8064
dgl merged 2 commits intoprometheus:mainfrom
dgl:promtool-test-output

Conversation

@dgl
Copy link
Copy Markdown
Member

@dgl dgl commented Oct 15, 2020

This makes it much easier to see how many alerts are firing, rather than having to scan through a line of text looking for a ,. It probably makes #7883 obsolete too.

The output now looks something like this:

Unit Testing:  testdata/failing.yml
  FAILED:
    alertname:InstanceDown, time:1d,
        exp:[
            0:
              Labels:{alertname="InstanceDown", instance="localhost:9090", job="prometheus", severity="page"}
              Annotations:{description="localhost:9090 of job prometheus has been down for more than 5 minutes.", summary="Instance localhost:9090 down"}
            ],
        got:[
            0:
              Labels:{alertname="InstanceDown", instance="localhost:9090", job="alertmanager", severity="page"}
              Annotations:{description="localhost:9090 of job alertmanager has been down for more than 5 minutes.", summary="Instance localhost:9090 down"},
            1:
              Labels:{alertname="InstanceDown", instance="localhost:9090", job="prometheus", severity="page"}
              Annotations:{description="localhost:9090 of job prometheus has been down for more than 5 minutes.", summary="Instance localhost:9090 down"}
            ]
    expr: "count(ALERTS) by (alertname, alertstate)", time: 4m,
        exp: {alertname="InstanceDown", alertstate="firing"} 1E+00
        got: {alertname="InstanceDown", alertstate="pending"} 3E+00

@dgl
Copy link
Copy Markdown
Member Author

dgl commented Oct 15, 2020

cc: @simonpasquier

@dgl
Copy link
Copy Markdown
Member Author

dgl commented Jan 8, 2021

@simonpasquier would you be able to have a look at this?

@stale stale bot removed the stale label Jan 8, 2021
Base automatically changed from master to main February 23, 2021 19:36
@dgl dgl force-pushed the promtool-test-output branch from a4ad4bb to 3d55f70 Compare March 19, 2021 14:51
@dgl dgl closed this Mar 21, 2021
@dgl dgl reopened this Mar 21, 2021
@dgl dgl force-pushed the promtool-test-output branch from 3d55f70 to 5a8e5b0 Compare March 23, 2021 16:08
@dgl dgl requested a review from roidelapluie March 23, 2021 16:11
@dgl dgl force-pushed the promtool-test-output branch from 5a8e5b0 to a2bcfd4 Compare March 23, 2021 16:37
@dgl dgl requested a review from roidelapluie March 23, 2021 16:59
Avoid using %#v, nothing needs to parse this, so escaping " and so on
leads to hard to read output.

Add new lines, number and indentation to each alert series output.

Signed-off-by: David Leadbeater <dgl@dgl.cx>
@dgl dgl force-pushed the promtool-test-output branch from 616c1e9 to 0104955 Compare May 13, 2021 14:43
@stale stale bot added the stale label Jul 12, 2021
@stale stale bot removed the stale label Jul 15, 2021
@dgl
Copy link
Copy Markdown
Member Author

dgl commented Jul 15, 2021

@roidelapluie PTAL, I think I fixed your last comment.

@roidelapluie
Copy link
Copy Markdown
Member

I'll add this to my TODO

@stale stale bot added the stale label Oct 23, 2021
@dgl
Copy link
Copy Markdown
Member Author

dgl commented Oct 27, 2021

@roidelapluie ping?

@stale stale bot removed the stale label Oct 27, 2021
Copy link
Copy Markdown
Member

@roidelapluie roidelapluie left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@dgl dgl merged commit c91c2bb into prometheus:main Oct 28, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants