-
Notifications
You must be signed in to change notification settings - Fork 3
Add product-drop-timeout parameter #165
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?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -56,7 +56,7 @@ type HTTPServerError struct { | |
| } | ||
|
|
||
| // NewService creates a service struct, containing all that is needed for a mmsd server to run. | ||
| func NewService(templates *template.Template, eventsDB *sql.DB, stateDB *sql.DB, natsURL string) *Service { | ||
| func NewService(templates *template.Template, eventsDB *sql.DB, stateDB *sql.DB, natsURL string, productDropTimeout int) *Service { | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think its time to consider a config struct or something for
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Agree, I felt I was trying to push it a bit too far yesterday, now I have it confirmed :) |
||
| m := NewServiceMetrics(MetricsOpts{}) | ||
|
|
||
| service := Service{ | ||
|
|
@@ -67,7 +67,7 @@ func NewService(templates *template.Template, eventsDB *sql.DB, stateDB *sql.DB, | |
| Router: mux.NewRouter(), | ||
| NatsURL: natsURL, | ||
| Metrics: m, | ||
| Productstatus: NewProductstatus(m), | ||
| Productstatus: NewProductstatus(m, productDropTimeout), | ||
| } | ||
| service.setRoutes() | ||
|
|
||
|
|
||
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.
Maybe purging events and unused products can be merged into one? So the api from the user of the service do not have to call both?
Like
webService.CleanUpEvents, which again deletes old events and removes unused products?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.
The idea was to have separate configuration of how long to keep events and how long to keep products in the monitoring. It might not be necessary when I am thinking about it. Probably it is easier for the user to deal with only 1 parameter.
Purpose of this PR is to address an issue when products keep hanging in the metrics part forever.
We have discussed whether the product status and monitoring should even be part of MMS, there were practical reasons for this as it was easier to maintain on a multi-user machine. We should re-visit this when going over to k8s. It might make sense to split it up and have the functionality as a different component or even a system. The same plan we have with NATS.
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.
Keeping two separate config values for product and old events might make sense, but my comment was more about having just one method call for doing cleanup and this method would handle both product and event cleanup. But if you think its better to keep both config values and cleanup method call separate I won't push it :)