Skip to content

Structured logging & related refactoring#998

Merged
mdemirhan merged 8 commits into
knative:masterfrom
mdemirhan:slogger
Jun 1, 2018
Merged

Structured logging & related refactoring#998
mdemirhan merged 8 commits into
knative:masterfrom
mdemirhan:slogger

Conversation

@mdemirhan
Copy link
Copy Markdown
Contributor

  • Refactor the remaining code under /pkg to use structured logging
  • Split elaconfig.yaml into multiple files, grouped by subject area - domain, autoscale, observability and elafros' own logging settings each get their own config files.
  • Every component now shares a common logging configuration and an override-able level
  • Change the verbose messages to Debug level in autoscaler

… domain, autoscale, observability and elafros' own logging settings each get their own config files.

* Refactor the remaining code under /pkg to use structured logging
* Every component now shares a common logging configuration and an override-able level
* Change the verbose messages to Debug level in autoscaler
@google-prow-robot google-prow-robot added the size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. label May 30, 2018
@mdemirhan
Copy link
Copy Markdown
Contributor Author

/test pull-elafros-elafros-build-tests

_, err = dc.Update(deployment)
if err != nil {
glog.Errorf("Error updating Deployment %q: %s", elaDeployment, err)
logger.Errorf("Error updating Deployment %q: %s", elaDeployment, err)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Nit: You changed all other err to be zap.Error(err). missed this one?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

This one is slightly different: it is using string formatting (Errorf instead of Error).

Comment thread cmd/ela-queue/main.go Outdated
if elaNamespace == "" {
logger.Fatal("No ELA_NAMESPACE provided.")
}
logger.Infof("ELA_REVISION=%v", elaNamespace)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

logger.Infof("ELA_NAMESPACE=%v", elaNamespace)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Fixed.

Comment thread cmd/ela-queue/main.go Outdated
func main() {
// Even though we have no flags, glog has some hence requiring
// flag.Parse().
flag.Parse()
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Is this line still needed?
flag.Parse()

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Nope. Removed. Thanks for the catch!

// LoggingURLTemplate is a string containing the logging url template where
// the variable REVISION_UID will be replaced with the created revision's UID.
LoggingURLTemplate string

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

It seems line 115 in this file still has
// see (elaconfig.yaml)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Fixed!

@akyyy
Copy link
Copy Markdown
Contributor

akyyy commented May 31, 2018

/lgtm

@google-prow-robot google-prow-robot added the lgtm Indicates that a PR is ready to be merged. label May 31, 2018
@google-prow-robot google-prow-robot removed the lgtm Indicates that a PR is ready to be merged. label Jun 1, 2018
@mdemirhan
Copy link
Copy Markdown
Contributor Author

/assign @josephburnett

Joe, can you please take a look as well? This changes quite a bit in autoscaler and I want to make sure everyone working in autoscaler gets their say before I check this in :)

Comment thread cmd/queue/main.go
// flag.Parse().
flag.Parse()
glog.Info("Queue container is running")
logger = logging.NewLogger(os.Getenv("ELA_LOGGING_CONFIG"), os.Getenv("ELA_LOGGING_LEVEL")).Named("ela-queueproxy")
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

You might want to rebase this and get rid of all "ela" strings since we renamed to "knative". I prefer not using prefixes at all (e.g. "ela-" or "knative-"), since it's fairly redundant.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I would rather check this PR in and do the renaming in a separate PR as there are a lot more "ela" prefixed items than just some environment variables. Let me know if that sounds good.

Comment thread config/BUILD.bazel
":config-domain",
":config-autoscaler",
":config-logging",
":config-observability",
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

What is the difference between "logging" and "observability"? It seems observability has a bunch of logging configuration in it? I'm probably just missing a subtle distinction here.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

logging is the logging configuration of our own code and typically only useful for contributors. Observability is the logging + metrics + tracing configuration we expose to cluster operators (i.e. the public facing configuration of observability work group).

@mdemirhan
Copy link
Copy Markdown
Contributor Author

/assign @mattmoor
Matt, can you please give the final approval? There are changes in config folder and Gopkg.lock file that requires root OWNER approval.

@mattmoor
Copy link
Copy Markdown
Member

mattmoor commented Jun 1, 2018

/approve

For Gopkg.lock

@google-prow-robot
Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: mattmoor, mdemirhan

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@google-prow-robot google-prow-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Jun 1, 2018
@mattmoor
Copy link
Copy Markdown
Member

mattmoor commented Jun 1, 2018

/lgtm

@google-prow-robot google-prow-robot added the lgtm Indicates that a PR is ready to be merged. label Jun 1, 2018
@mdemirhan mdemirhan merged commit 04f9a97 into knative:master Jun 1, 2018
@mdemirhan mdemirhan deleted the slogger branch June 1, 2018 22:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved Indicates a PR has been approved by an approver from all required OWNERS files. lgtm Indicates that a PR is ready to be merged. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants