-
Notifications
You must be signed in to change notification settings - Fork 8.1k
Switch to Istio logging #2240
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Switch to Istio logging #2240
Conversation
pilot/proxy/envoy/watcher.go
Outdated
args = append(args, "-l", "trace") | ||
} else if glog.V(3) { | ||
} /* TODO(nmittler): When should the "debug" flab be used? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@kyessenov any thoughts on how to handle this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This will require a new flag.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@kyessenov I've created #2257 to address this.
Codecov Report
@@ Coverage Diff @@
## master #2240 +/- ##
==========================================
- Coverage 76.42% 76.24% -0.18%
==========================================
Files 221 69 -152
Lines 19810 5886 -13924
==========================================
- Hits 15139 4488 -10651
+ Misses 3846 1155 -2691
+ Partials 825 243 -582
Continue to review full report at Codecov.
|
That seems wrong, any Vlog should be Info or lower (verbose means verbose not warning) Maybe this shows another level (Verbose) should be added ? |
|
@ldemailly @kyessenov I've corrected the V(1) mapping in the description ... it was already Info in the code. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please re-direct client-go log output to istio log. Without a single log output, we have a strict degradation in debuggability of Pilot. I want to be able to get a sequential trace across the stack, not two separate log streams.
@kyessenov is that what glog was doing previously? If not, it would seem to be beyond the scope of this PR. |
If you try to debug k8s, there's a major difference between different log levels. Level 10 is per-request, typically. Can we preserve that in istio log? We have way too much logging already, and we're losing all the tuning we've done before. |
@kyessenov so what do you propose as the mapping? |
Not sure, maybe @geeknoid has some ideas?.. |
@kyessenov @geeknoid IIRC, Martin's changes to Mixer mapped all V(x) logs to Debug. Would that address your concerns? |
@geeknoid any thoughts on #2240 (comment)? |
@kyessenov can you provide me more detail on what would need to be done here? |
@geeknoid I'm seeing that the pilot-integration-x tests are failing with |
/retest |
@geeknoid what do you think about adding a level in between Debug and Info : Verbose ? |
18bb461
to
256ade5
Compare
@ldemailly We have limited flexibility in introducing new levels since our logging package is a layer on top of the Zap logger, which is where the levels are defined. What we have: Error, Warning, Info: on all the time If there's some Info-level things that we want to be conditionally enabled, you need to have a separate command-line option to control that specifically. |
pilot/cmd/cmd.go
Outdated
// AddFlags carries over glog flags with new defaults | ||
func AddFlags(rootCmd *cobra.Command) { | ||
// InitRootCommand Initializes the root command with logging configuration | ||
func InitRootCommand(rootCmd *cobra.Command, loggingOptions *log.Options) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@kyessenov please review the changes here for configuring istio logging and glogs
// Should be called right after flag.Parse(). | ||
func InitGlog() error { | ||
func InitLogging() error { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@kyessenov Also please review here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure this should be done. @geeknoid?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So a couple things:
-
At the moment, Mixer does none of that. Output go to stdout unless the user redirects it to a specific file.
-
Uses of glog in Mixer need to be configured independently using glog options.
-
I'm playing right now with providing a replacement for glog which calls into the zap library directly. This would eliminate all classic glog command-line options and features from our builds.
-
I'm expecting to extend our logging package to support log rotation explicitly. It's fairly easy to do on top of zap. Adding this functionality will involve introducing new cmd-line flags to allow the user to select a target directory, max file size, num files to keep, etc.
So given all the above, I would probably just go with a simple story for the time being, like Mixer has. The smarts will then be introduced by silent upgrades to the log package.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@geeknoid sgtm. I've updated the PR to remove some of the glog-specific gunk.
Looks mostly OK from what I scanned over in pilot. Seems like you made V<=2 Info and V > 2 Debug. That means we get too much Info levels and too much for Debug levels, but that should not be blocking this PR. I'd prefer if we had a discussion before undertaking the entire log swapping business. I don't see it as valuable since it makes it hard to separate code out of istio repository. |
This completes the transition from the entire Istio code base over to the new Istio logging library (replacing glog). The mapping is roughly as follows: glog.Debug -> log.Debug glog.Info -> log.Info glog.Warning -> log.Warn glog.Error -> log.Error glog.Fatal -> log.Error + os.Exit(-1) glog.V(1) -> log.Info glog.V(2) -> log.Info glog.V(3+) -> log.Debug glog.Flush -> log.Sync Partially addresses istio#2174
@costinm I found and fixed the problem |
@kyessenov mind re-lgtm/approving? |
/lgtm |
/test all [submit-queue is verifying that this PR is safe to merge] |
/lgtm |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: kyessenov, ZackButcher The full list of commands accepted by this bot can be found here.
Needs approval from an approver in each of these OWNERS Files:
You can indicate your approval by writing |
Automatic merge from submit-queue. |
that seems like way too many logs by default |
So are we going to run prod with warnings only ? as I mentioned earlier there are rare info messages one wants to always see in the logs without artificially labelling them as warning |
IIRC, by default we log Error, Warning, and Info. I believe Pilot was originally running with istio/install/kubernetes/templates/istio-pilot.yaml.tmpl Lines 115 to 116 in 55d591f
|
for perf test I remove -v 2 so I get Info... what should I do now ? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Parts of the build (at least bazel_to_go) seem unhappy with the comments added to some of the BUILD files. E.g.
Step #1: ERROR: /workspace/go/src/istio.io/istio/broker/pkg/model/osb/BUILD:17:9: syntax error at '//': expected expression.
@@ -12,6 +12,9 @@ go_library( | |||
"servicePlan.go", | |||
], | |||
deps = [ | |||
"//pkg/log:go_default_library", | |||
|
|||
// TODO(nmittler): Remove this |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should be # not //
deps = [ | ||
"//pkg/log:go_default_library", | ||
|
||
// TODO(nmittler): Remove this |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should be # not //
@mattdelco Just filed #2373 to fix |
@ZackButcher for perf test I remove -v 2 so I get Info logging (pre 'new logger')... what should I do now ? |
Use the flags in the new log package: Lines 188 to 189 in 337c240
Off topic of this PR: we really need to standardize our flag format; this mix of |
so you are suggesting people run prod with warning, that seems wrong as some low volume info level are useful, we don’t have the right levels |
No, our intent is that you can run at info in prod (and this is the default behavior). We likely need to rework some of our logging to make that a reality. |
Just to be clear it's a regression from 0.4.0 where running -v 0 would give you some amount of Info separated from verbose per request logging and we lost this now by merging v1,v2 and info into a single bucket |
let's move the levels discussion to #2400 |
This completes the transition from the entire Istio code base over
to the new Istio logging library (replacing glog).
The mapping is roughly as follows:
glog.Debug -> log.Debug
glog.Info -> log.Info
glog.Warning -> log.Warn
glog.Error -> log.Error
glog.Fatal -> log.Error + os.Exit(-1)
glog.V(1) -> log.Info
glog.V(2) -> log.Info
glog.V(3+) -> log.Debug
glog.Flush -> log.Sync
Partially addresses #2174