Skip to content
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

Replace runtime reference by subdir #19778

Merged
merged 1 commit into from
Feb 2, 2016

Conversation

resouer
Copy link
Contributor

@resouer resouer commented Jan 18, 2016

ref #15634

Details: move handleErrors stuff into a runtime subdir

@k8s-github-robot k8s-github-robot added needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. labels Jan 18, 2016
@k8s-github-robot
Copy link

Labelling this PR as size/XL

@k8s-github-robot k8s-github-robot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Jan 18, 2016
@k8s-bot
Copy link

k8s-bot commented Jan 18, 2016

GCE e2e test build/test passed for commit 452156f1c420a38065e6349383edbf0f20a8055a.

@k8s-bot
Copy link

k8s-bot commented Jan 18, 2016

GCE e2e test build/test passed for commit 5abac44b9a2f1f9b8d458e9029ee0468660f43b4.

@k8s-bot
Copy link

k8s-bot commented Jan 18, 2016

GCE e2e test build/test passed for commit ef783fcd39d4821292a555eea1bfb9c7e4eb1bb5.

@resouer
Copy link
Contributor Author

resouer commented Jan 18, 2016

cc @thockin Just another util fix

@deads2k
Copy link
Contributor

deads2k commented Jan 18, 2016

@resouer I read the original issue. It's not obvious to me why I would do this. For some reason this liveness check couldn't be fixed without moving this function? I'm just not seeing a clear benefit to making a new package to hold this function instead of leaving it where it is.

@resouer
Copy link
Contributor Author

resouer commented Jan 18, 2016

@deads2k OMG, I referenced a wrong issue number, please see my update of description. This PR is definitely to fix #15634

LOL

@deads2k
Copy link
Contributor

deads2k commented Jan 18, 2016

@deads2k OMG, I referenced a wrong issue number, please see my update of description. This PR is definitely to fix #15634

Ok, that makes more sense. I'd prefer to see this moved into the existing util/errors package though. It seems like a pretty natural fit there. When you import it, please alias to something like utilerrors, so we don't collide with the official errors package.

@resouer
Copy link
Contributor Author

resouer commented Jan 20, 2016

Yep, I will update it later

@thockin thockin added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Jan 20, 2016
// return an error and needs to indicate it has been ignored. Invoking this method
// is preferable to logging the error - the default behavior is to log but the
// errors may be sent to a remote server for analysis.
func HandleError(err error) {
Copy link
Member

Choose a reason for hiding this comment

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

Do we really need this? Is it really more valuable than simply logging at the callsite? It's very custom and very convoluted and it just ends up with a log line in the end.

@lavalamp @brendandburns @smarterclayton

Copy link
Contributor

Choose a reason for hiding this comment

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

Do we really need this? Is it really more valuable than simply logging at the callsite? It's very custom and very convoluted and it just ends up with a log line in the end.

@lavalamp @brendandburns @smarterclayton

This provides an injection point for enabling things like sentry monitoring.

Copy link
Contributor

Choose a reason for hiding this comment

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

Copy link
Contributor

Choose a reason for hiding this comment

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

We actively use this hook on several production and preproduction clusters to provide failure analysis of controllers and "non obvious fault" conditions.

Copy link
Contributor

Choose a reason for hiding this comment

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

I have a long running todo to move the sentry hook upstream and also tee events to sentry as plugins.

Copy link
Member

Choose a reason for hiding this comment

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

@thockin either way, it's a big code smell (something is probably wrong if one's code "can't return an error"). But this is strictly better than a log message everywhere, because it's easy to find all the places that use it.

Copy link
Contributor

Choose a reason for hiding this comment

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

Controllers are are a classic "can't return an error" place, I think we
have very few other scenarios. They can emit an event - in which case this
method should be stubbed to emit an event. But the controller error could
be because the apiserver is down - in which case we probably want to hold
the event locally. Technically, the sentry implementation backing this is
an event recorded, it just happens to be one that is sent somewhere other
than the master, which in the past we discussed as a Tee at the event
recorder (it also handles and reports panics). I'm not sure we want to
fire events when we panic, but at the same time, there's no reason we can't.

On Wed, Jan 20, 2016 at 5:48 PM, Daniel Smith notifications@github.com
wrote:

In pkg/util/runtime/runtime.go
#19778 (comment)
:

  •       break
    
  •   }
    
  •   callers = callers + fmt.Sprintf("%v:%v\n", file, line)
    
  • }
  • glog.Errorf("Recovered from panic: %#v (%v)\n%v", r, r, callers)
    +}

+// ErrorHandlers is a list of functions which will be invoked when an unreturnable
+// error occurs.
+var ErrorHandlers = []func(error){logError}
+
+// HandlerError is a method to invoke when a non-user facing piece of code cannot
+// return an error and needs to indicate it has been ignored. Invoking this method
+// is preferable to logging the error - the default behavior is to log but the
+// errors may be sent to a remote server for analysis.
+func HandleError(err error) {

@thockin https://github.com/thockin either way, it's a big code smell
(something is probably wrong if one's code "can't return an error"). But
this is strictly better than a log message everywhere, because it's easy to
find all the places that use it.


Reply to this email directly or view it on GitHub
https://github.com/kubernetes/kubernetes/pull/19778/files#r50333611.

Copy link
Member

Choose a reason for hiding this comment

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

On Wed, Jan 20, 2016 at 5:18 AM, David Eads notifications@github.com wrote:

+// HandlerError is a method to invoke when a non-user facing piece of code cannot
+// return an error and needs to indicate it has been ignored. Invoking this method
+// is preferable to logging the error - the default behavior is to log but the
+// errors may be sent to a remote server for analysis.
+func HandleError(err error) {

Do we really need this? Is it really more valuable than simply logging at the callsite? It's very custom and very convoluted and it just ends up with a log line in the end.

@lavalamp @brendandburns @smarterclayton

This provides an injection point for enabling things like sentry monitoring.

I get that, but is it REALLY useful? It is certainly not consistently
applied. Heck, I didn't even know about it...

Copy link
Member

Choose a reason for hiding this comment

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

Sure, but we should maybe spread the word on when and how to use this. I
didn't know it existed, and I still don't think I know how to apply it.

On Wed, Jan 20, 2016 at 2:48 PM, Daniel Smith notifications@github.com
wrote:

In pkg/util/runtime/runtime.go
#19778 (comment)
:

  •       break
    
  •   }
    
  •   callers = callers + fmt.Sprintf("%v:%v\n", file, line)
    
  • }
  • glog.Errorf("Recovered from panic: %#v (%v)\n%v", r, r, callers)
    +}

+// ErrorHandlers is a list of functions which will be invoked when an unreturnable
+// error occurs.
+var ErrorHandlers = []func(error){logError}
+
+// HandlerError is a method to invoke when a non-user facing piece of code cannot
+// return an error and needs to indicate it has been ignored. Invoking this method
+// is preferable to logging the error - the default behavior is to log but the
+// errors may be sent to a remote server for analysis.
+func HandleError(err error) {

@thockin https://github.com/thockin either way, it's a big code smell
(something is probably wrong if one's code "can't return an error"). But
this is strictly better than a log message everywhere, because it's easy to
find all the places that use it.


Reply to this email directly or view it on GitHub
https://github.com/kubernetes/kubernetes/pull/19778/files#r50333611.

@k8s-github-robot
Copy link

@k8s-bot test this

Tests are more than 48 hours old. Re-running tests.

@k8s-bot
Copy link

k8s-bot commented Jan 20, 2016

GCE e2e test build/test passed for commit ef783fcd39d4821292a555eea1bfb9c7e4eb1bb5.

@k8s-github-robot k8s-github-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Jan 21, 2016
@thockin
Copy link
Member

thockin commented Jan 22, 2016

I think runtime is better than errors for this, though I am not sure it is a util. Do we need a top-level pkg for storing this and any similar "framework" sorts of things?

@smarterclayton
Copy link
Contributor

Hrm - this kind of fits in with Untils and Panics and handling the cases -
for instance, the panic handler and this should do something similar. I
don't care what the package is called.

On Fri, Jan 22, 2016 at 2:47 AM, Tim Hockin notifications@github.com
wrote:

I think runtime is better than errors for this, though I am not sure it is
a util. Do we need a top-level pkg for storing this and any similar
"framework" sorts of things?


Reply to this email directly or view it on GitHub
#19778 (comment)
.

@smarterclayton
Copy link
Contributor

I probably should close
#10521 by adding something
to dev conventions and doing a sweep. Haven't done it yet.

On Fri, Jan 22, 2016 at 1:15 PM, Clayton Coleman ccoleman@redhat.com
wrote:

Hrm - this kind of fits in with Untils and Panics and handling the cases -
for instance, the panic handler and this should do something similar. I
don't care what the package is called.

On Fri, Jan 22, 2016 at 2:47 AM, Tim Hockin notifications@github.com
wrote:

I think runtime is better than errors for this, though I am not sure it
is a util. Do we need a top-level pkg for storing this and any similar
"framework" sorts of things?


Reply to this email directly or view it on GitHub
#19778 (comment)
.

@thockin
Copy link
Member

thockin commented Jan 22, 2016

I can live with util/runtime until something more obvious arises.

Needs rebase, sorry

@k8s-github-robot
Copy link

PR changed after LGTM, removing LGTM.

@k8s-github-robot k8s-github-robot removed lgtm "Looks good to me", indicates that a PR is ready to be merged. needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. labels Jan 24, 2016
@k8s-bot
Copy link

k8s-bot commented Jan 24, 2016

GCE e2e test build/test passed for commit b4f74dea11d9de4d1ff02591cdbb561ed4c8e221.

@thockin thockin added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Jan 27, 2016
@thockin
Copy link
Member

thockin commented Jan 27, 2016

Unfortunately, the merge queue is the boss right now. We're working on making it flake less, but we're only fast-tracking test PRs right now.

@k8s-bot
Copy link

k8s-bot commented Jan 27, 2016

GCE e2e test build/test passed for commit dbbedbd0bac842af90dbe7ed7a993c86c4fd38e2.

@k8s-github-robot k8s-github-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Jan 28, 2016
@k8s-github-robot
Copy link

PR needs rebase

@k8s-github-robot
Copy link

PR changed after LGTM, removing LGTM.

@k8s-github-robot k8s-github-robot removed lgtm "Looks good to me", indicates that a PR is ready to be merged. needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. labels Jan 29, 2016
@resouer
Copy link
Contributor Author

resouer commented Jan 29, 2016

@thockin rebased again

@k8s-bot
Copy link

k8s-bot commented Jan 29, 2016

GCE e2e test build/test passed for commit 1297d3b65388fbd97df6eb96dad8e7c77bd02ad5.

@k8s-github-robot
Copy link

PR needs rebase

@k8s-github-robot k8s-github-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Jan 30, 2016
@k8s-github-robot k8s-github-robot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Feb 1, 2016
@resouer
Copy link
Contributor Author

resouer commented Feb 1, 2016

@thockin Fixed rebase again ...

@k8s-bot
Copy link

k8s-bot commented Feb 1, 2016

GCE e2e test build/test passed for commit dd7362e51511faa0af945b3344ba7ce3883c2618.

@k8s-bot
Copy link

k8s-bot commented Feb 1, 2016

GCE e2e test build/test passed for commit 1032067.

@thockin thockin added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Feb 2, 2016
@k8s-github-robot
Copy link

@k8s-bot test this [submit-queue is verifying that this PR is safe to merge]

@k8s-bot
Copy link

k8s-bot commented Feb 2, 2016

GCE e2e test build/test passed for commit 1032067.

@k8s-github-robot
Copy link

@k8s-bot test this [submit-queue is verifying that this PR is safe to merge]

@k8s-bot
Copy link

k8s-bot commented Feb 2, 2016

GCE e2e test build/test passed for commit 1032067.

@k8s-github-robot
Copy link

Automatic merge from submit-queue

k8s-github-robot pushed a commit that referenced this pull request Feb 2, 2016
Auto commit by PR queue bot
@k8s-github-robot k8s-github-robot merged commit 32ab64c into kubernetes:master Feb 2, 2016
@resouer resouer deleted the runtime branch February 3, 2016 08:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
lgtm "Looks good to me", indicates that a PR is ready to be merged. size/XL Denotes a PR that changes 500-999 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

10 participants