Skip to content

Conversation

royeo
Copy link
Contributor

@royeo royeo commented Aug 12, 2021

filter log calls by log level

Fixes #384

@royeo royeo force-pushed the master branch 2 times, most recently from 566876b to 55cdba4 Compare August 12, 2021 16:03
Copy link
Contributor

@matthiasr matthiasr left a comment

Choose a reason for hiding this comment

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

This is more thorough than I expected! I like it, the only thing I would like to clarify are the various messages we show users:

When providing an invalid log level, state what the valid levels are.

Every test error should have a unique text so it is clear which assertion failed. For the table tests, also include which input failed. When checking for errors, say so ("expected no error setting log level to %s, got: %s") instead of "expected: nil".

@royeo royeo force-pushed the master branch 3 times, most recently from 77b5df0 to 06aa952 Compare August 17, 2021 15:07
Signed-off-by: royeo <[email protected]>
@royeo
Copy link
Contributor Author

royeo commented Aug 17, 2021

If an invalid log level is provided, the program will report an error.

I have modified the test code, please continue to review @matthiasr

@royeo
Copy link
Contributor Author

royeo commented Aug 20, 2021

Please review this PR @matthiasr

@royeo royeo requested a review from matthiasr August 22, 2021 19:12
@matthiasr
Copy link
Contributor

matthiasr commented Aug 23, 2021 via email

@royeo
Copy link
Contributor Author

royeo commented Aug 28, 2021

How's it going?

Copy link
Member

@SuperQ SuperQ left a comment

Choose a reason for hiding this comment

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

LGTM. I would love if this optimization was pushed upstream.

@royeo
Copy link
Contributor Author

royeo commented Aug 30, 2021

Is MR ready to merge? @matthiasr

Copy link
Contributor

@matthiasr matthiasr left a comment

Choose a reason for hiding this comment

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

Yep, looks good, thank you! I am not super happy about try --help as a call to action when specifying an invalid level, but I don't see an elegant way to change that either.

@matthiasr matthiasr merged commit 4c8028e into prometheus:master Aug 31, 2021
matthiasr added a commit that referenced this pull request Aug 31, 2021
with changelog for #385 #386

Signed-off-by: Matthias Rampke <[email protected]>
@matthiasr
Copy link
Contributor

Ooops, sorry, I need to back this out. The tests didn't run on this at all for some reason, except for the DCO check, which made everything look green.

matthiasr added a commit that referenced this pull request Aug 31, 2021
the main change (#385) is missing license headers

Signed-off-by: Matthias Rampke <[email protected]>
@matthiasr
Copy link
Contributor

@royeo unfortunately the new files are missing the mandatory license header. Also, the tests didn't run on this PR at all, possibly because you opened it from your main branch. Could you please open a new PR, with headers like

// Copyright 2021 The Prometheus Authors
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

on both of the new files?

@matthiasr
Copy link
Contributor

Please create a branch just for this change and create the PR from that.

@royeo
Copy link
Contributor Author

royeo commented Sep 1, 2021

@matthiasr I create a new PR #390, please review it

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.

level.Debug(logger).Log(...) is too expensive
3 participants