-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
[component] component.go - when can component.Shutdown
return errors?
#9325
Comments
I made a suggestion that we remove the error return status from |
I agree that an error returned from shutdown doesn't really help. It should ultimately just be logged somewhere and the collector should continue shutting down. It implies the component shutdown didn't happen correctly, but there isn't anything the collector can do about it at this point in the lifecycle. |
It is pretty common in stdlib and others (e.g. grpc) to return error from Close/Shutdown. The caller can log the error. |
Agreed, and that's what we do today. I was saying that it doesn't have to be the caller that logs the error, as long as something does it. |
Looking at the code, I see that errors returned during opentelemetry-collector/cmd/otelcorecol/main.go Lines 53 to 55 in fb9d80d
Any error on shutdown will make the collector exit with an error code 1. Is that expected? |
Exiting with a non-zero code feels appropriate since it wasn't a clean shutdown. |
I agree that the non-zero exit code makes sense, so I think we need to keep the error return value. My suggestion to remove the error return values from |
I agree that it makes sense to keep the returned error with Shutdown. Unless others feel strongly about this, I suggest we close this issue |
Agreed. Closing as complete. |
When does it make sense for
component.Shutdown
to return errors?We don't set any expectations as to when
Shutdown
may return errors or what to expect.When
Shutdown
returns an error, we associate this to a permanent error on the component status instead of stopped status:opentelemetry-collector/service/internal/graph/graph.go
Lines 435 to 442 in c5a2c78
Is this status report useful? Could it be the implementer's responsibility to emit error events?
The text was updated successfully, but these errors were encountered: