-
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
otel collector telemetry metrics server won't spawn again after restarting #5084
Comments
More importantly, why are you doing this? If you want to reload the Service with new config you need to use the ConfigProvider.Watch capability. |
Even if we use the watch method, the internal implementation for watch is similar. See: opentelemetry-collector/service/collector.go Lines 162 to 165 in cb868e2
It would invoke the shutdown function and then Run with the new settings. |
OK, this looks like a legitimate bug in that case. In any case I do not think we support calling Run after Shutdown right now. If you do that it may break in the future. I would advise to either use the watch approach or if you need Run to work after Shutdown we need a justification for that and we need to prescribe it in the contract of Service API and have tests that verify it. Either way we need to fix this bug. We need to make sure telemetry works after a legitimate restart of the Service. |
@tigrannajaryan do you know why Telemetry is only initialized once? I found this TODO where the initialize is called opentelemetry-collector/service/collector.go Lines 222 to 227 in f6b1cd9
But it doesn't say why |
No, I don't know, I don't remember this part of the codebase. @bogdandrutu may know. |
I see that the metrics server is started in a goroutine in Telemetry's initOnce, could be related to that |
It may have related to the use of global telemetry providers as well, which is being (has been?) refactored. Unfortunately it was this way before I started working in that area of the code and have felt a bit like it's been dragged around blindly mimicking the previous state through a few changes. I'm wary of Chesterton's Fence-type issues, but we should be able to reason through this. |
I'll dive deep into it and see if I can find things that would break if it was called multiple times. With my initial testing today I didn't see any indication that the http server goroutine is shutting down gracefully when the collector shuts down, but I need to keep testing. |
Perhaps I'm way off here, but OpenCensus required views to be registered only once. Is that maybe the background for this? |
There are some miss understandings here:
There are some discussions (see #4947) and issues to actually make it more clear that the Collector will follow the language patter for Shutdown, see http.Server.Shutdown: I think we are going to the direction to follow the language pattern which is after Shutdown you cannot call Run on the same instance, you have to create a new instance. |
Looking into this issue I agree with @bogdandrutu. Assuming calling One interesting thing is that any new Telemetry config settings will not be honored. If we want to be able to load new telemetry settings without a new instance of a collector I think we would need changes. I would say thats a different issue/feature request though. |
This should be fixed now. |
Describe the bug
When the collector is shutdown and run again(or another collector is run again), the telemetry metrics server won't spawn again.
Steps to reproduce
What did you expect to see?
When a new collector is run again. metrics server should still be spawned
What did you see instead?
metrics server no longer spawns due to initOnce call.
What version did you use?
Version: v0.46.0
What config did you use?
Any valid config
Environment
OS: macOS catalina
Compiler(if manually compiled): go 1.17.3
Additional context
Add any other context about the problem here.
The text was updated successfully, but these errors were encountered: