-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Support trigger config reloading via HTTP request #13178
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
base: main
Are you sure you want to change the base?
Conversation
Signed-off-by: chenlujjj <[email protected]>
Hi @atoulme , Could you please have a look at this issue? Thank you. |
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 feel like this needs more discussion.
It would also need tests, and to be configurable.
I wonder if starting this as an extension wouldn't be better.
If we do move forward, this needs a changelog entry.
@@ -247,6 +256,31 @@ func (col *Collector) setupConfigurationComponents(ctx context.Context) error { | |||
return nil | |||
} | |||
|
|||
func (col *Collector) newReloadServer() (*http.Server, error) { | |||
server := &http.Server{ | |||
Addr: ":8888", |
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 needs to be configurable.
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 would also need to be authenticated. We can't expose an endpoint on all interfaces like this without some kind of security.
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.
Not sure if authentication is a must-to-have thing here. Usually only maintainers of the otel-collector deployment can have access to this API.
Or in the 1st version, we can make this feature disabled by default, and users should enable it explicitly.
@@ -140,7 +143,13 @@ func NewCollector(set CollectorSettings) (*Collector, error) { | |||
configProvider: configProvider, | |||
bc: bc, | |||
updateConfigProviderLogger: cc.SetCore, | |||
}, nil | |||
} | |||
reloadServer, err := col.newReloadServer() |
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.
Assigning a variable generated by the struct into the struct is a bit weird.
Why isn't the struct directly setting the value on itself?
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 can move the implementation of newReloadServer
into the NewCollector
function
Addr: ":8888", | ||
} | ||
|
||
http.HandleFunc("/-/reload", col.reloadHandler) |
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.
Was there a consensus somewhere on the endpoint's path? I'm only seeing one issue where you're the only commenter.
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 follow the reload path of prometheus and alertmanager as mentioned in the issue.
I think we can make it configurable if needed.
@dmathieu Thanks for the review. The implementation of the PR is a bit incomplete, I planned to add tests and change log after the direction is aligned. |
Description
Add a
/-/reload
HTTP API to reload configLink to tracking issue
Fixes #10264
Testing
Manaul test:
Documentation
This is just an initial implementation to demonstrate the purpose. I'm not sure if it should be implemented as a separate extension like zpages, healthcheck. Please correct me if it's not the right way.