-
Notifications
You must be signed in to change notification settings - Fork 40.1k
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
Conversation
Labelling this PR as size/XL |
GCE e2e test build/test passed for commit 452156f1c420a38065e6349383edbf0f20a8055a. |
GCE e2e test build/test passed for commit 5abac44b9a2f1f9b8d458e9029ee0468660f43b4. |
GCE e2e test build/test passed for commit ef783fcd39d4821292a555eea1bfb9c7e4eb1bb5. |
cc @thockin Just another util fix |
@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. |
Ok, that makes more sense. I'd prefer to see this moved into the existing |
Yep, I will update it later |
// 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) { |
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.
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.
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.
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.
This provides an injection point for enabling things like sentry monitoring.
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.
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.
We actively use this hook on several production and preproduction clusters to provide failure analysis of controllers and "non obvious fault" conditions.
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 have a long running todo to move the sentry hook upstream and also tee events to sentry as plugins.
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.
@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.
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.
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.
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.
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...
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.
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-bot test this Tests are more than 48 hours old. Re-running tests. |
GCE e2e test build/test passed for commit ef783fcd39d4821292a555eea1bfb9c7e4eb1bb5. |
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? |
Hrm - this kind of fits in with Untils and Panics and handling the cases - On Fri, Jan 22, 2016 at 2:47 AM, Tim Hockin notifications@github.com
|
I probably should close On Fri, Jan 22, 2016 at 1:15 PM, Clayton Coleman ccoleman@redhat.com
|
I can live with util/runtime until something more obvious arises. Needs rebase, sorry |
PR changed after LGTM, removing LGTM. |
GCE e2e test build/test passed for commit b4f74dea11d9de4d1ff02591cdbb561ed4c8e221. |
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. |
GCE e2e test build/test passed for commit dbbedbd0bac842af90dbe7ed7a993c86c4fd38e2. |
PR needs rebase |
PR changed after LGTM, removing LGTM. |
@thockin rebased again |
GCE e2e test build/test passed for commit 1297d3b65388fbd97df6eb96dad8e7c77bd02ad5. |
PR needs rebase |
@thockin Fixed rebase again ... |
GCE e2e test build/test passed for commit dd7362e51511faa0af945b3344ba7ce3883c2618. |
GCE e2e test build/test passed for commit 1032067. |
@k8s-bot test this [submit-queue is verifying that this PR is safe to merge] |
GCE e2e test build/test passed for commit 1032067. |
@k8s-bot test this [submit-queue is verifying that this PR is safe to merge] |
GCE e2e test build/test passed for commit 1032067. |
Automatic merge from submit-queue |
Auto commit by PR queue bot
ref #15634
Details: move
handleErrors
stuff into a runtime subdir