-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
Added support for hot reload of UI config #1688
Added support for hot reload of UI config #1688
Conversation
Codecov Report
@@ Coverage Diff @@
## master #1688 +/- ##
==========================================
- Coverage 98.51% 98.36% -0.16%
==========================================
Files 193 193
Lines 9314 9358 +44
==========================================
+ Hits 9176 9205 +29
- Misses 110 119 +9
- Partials 28 34 +6
Continue to review full report at Codecov.
|
The code coverage is lower than the usual because of the logging of errors related to file system problems, which are hard to reproduce in unit tests. |
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 another ticket to support watching of the sampling strategies file. I am not sure if there's code that we can reuse though.
cmd/query/app/static_handler.go
Outdated
} | ||
defer watcher.Close() | ||
|
||
done := make(chan bool) |
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 am not sure why this is needed, there's no external signaling into this chan
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.
That was mainly to keep the function from returning, as it would then call watcher.Close()
, but I figured I could just not close the watcher and it would have the same effect.
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.
PR updated
cmd/query/app/static_handler.go
Outdated
} | ||
defer watcher.Close() | ||
|
||
done := make(chan bool) |
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.
That was mainly to keep the function from returning, as it would then call watcher.Close()
, but I figured I could just not close the watcher and it would have the same effect.
Marking this as WIP, as this PR alone would not solve the original problem from jaegertracing/jaeger-operator#533. |
@@ -72,7 +73,6 @@ func TestRegisterStaticHandler(t *testing.T) { | |||
BasePath: testCase.basePath, | |||
UIConfig: "fixture/ui-config.json", | |||
}) | |||
assert.Empty(t, buf.String(), "no logs during construction") |
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 removed this assertion, as I believe there's value in adding a log message stating that the config file specified via CLI is being watched.
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.
What is the use case for reloading UI config? I.e. what kind of things would people want to change there dynamically?
The file watching behavior would be quite useful for the sampling strategies config, I believe we even have a ticket for that.
@mwieczorek faced this on jaegertracing/jaeger-operator#533 . I don't expect this file to be changed that often, and most instances would probably never change, but for the cases where it does change, we'd have to kill the Jaeger Query component to have the config file re-read. We could watch for a
+1, I can work on that next, but I think that one involves more work than just reloading the config file and updating a single atomic field. |
Right, so that was my point, is it worth adding all this code (and future maintenance) for such a marginal use case? The UI config is not really that dynamic, I can't think of any items there that must be changed in place. Feels like a redeploy / restart is a perfectly valid solution. |
I'll add my comment as I created the issue jaegertracing/jaeger-operator#533 Anyway: if the change introduces too much burden - I can just live with additional pipeline steps which will handle the restarts. |
@yurishkuro If a similar approach is of interest for sampling strategies, then wouldn't it be better for Jaeger to have a consistent approach to reloading configs? |
@objectiser it would be much better if there was a shared component, yet all of the new code here is embedded directly into the handler. But I don't mind merging it. |
The watcher part can be refactored when we add a similar support for the sampling strategy config file. |
Signed-off-by: Juraci Paixão Kröhling <juraci@kroehling.de>
I'm merging this, with the promise that I'll refactor this code to suite multiple consumers of the logic, once I send a PR allowing a similar feature for the sampling strategies configuration. |
Signed-off-by: Juraci Paixão Kröhling juraci@kroehling.de
Which problem is this PR solving?
indexHTML
property.