Join GitHub today
GitHub is home to over 20 million developers working together to host and review code, manage projects, and build software together.
Status history pruning age and size is configurable #7239
Conversation
| @@ -345,6 +354,10 @@ var defaultConfigValues = map[string]interface{}{ | ||
| AptFTPProxyKey: "", | ||
| AptNoProxyKey: "127.0.0.1,localhost,::1", | ||
| "apt-mirror": "", | ||
| + | ||
| + // Status history settings | ||
| + MaxStatusHistoryAge: "336h", // 2 weeks |
| + | ||
| +// MaxStatusHisotrySizeMB is the maximum size in MiB which the status history | ||
| +// collection can grow to before being pruned. | ||
| +func (c *Config) MaxStatusHisotrySizeMB() uint { |
| + | ||
| + settingsChanged := false | ||
| + | ||
| + iter := coll.Find(bson.M{"_id": bson.M{"$regex": "^.*:e$"}}).Iter() |
axw
Apr 18, 2017
Member
This feels like it'd be a bit too easy to stomp on unrelated settings docs. i.e., we might introduce some settings key with a prefix like model-uuid:foo:e, where e is some key that has nothing to do with environments.
Can we please use AllModels to iterate models, and then look up the settings docs for those? I think you could then refactor and share some code between AddControllerLogPruneSettings and AddStatusHistoryPruneSettings: call some common function with a collection, doc ID, and a function with the signature:
func(*settingsDoc) (changed bool)
| + if err := context.Get(config.EnvironName, &environ); err != nil { | ||
| + return nil, errors.Trace(err) | ||
| + } | ||
| + cfg := environ.Config() |
wallyworld
Apr 18, 2017
Owner
I have a PR immediately ready to land after this one which addresses the issue. The code here will disappear.
|
$$merge$$ |
|
Status: merge request accepted. Url: http://juju-ci.vapour.ws:8080/job/github-merge-juju |
|
Build failed: Tests failed |
|
$$merge$$ |
|
Status: merge request accepted. Url: http://juju-ci.vapour.ws:8080/job/github-merge-juju |
|
Build failed: Generating tarball failed |
|
$$merge$$ |
|
Status: merge request accepted. Url: http://juju-ci.vapour.ws:8080/job/github-merge-juju |
wallyworld commentedApr 13, 2017
Description of change
We add 2 new model config parameters
These control how status history records are removed during pruning; the age and the max size of the collection holding the records.
The status history pruning worker manifold is also improved, plus tests are added.
There are also fixes to tests for the previously landed code to control log pruning.
Still todo - the pruning worker does not react to changes in the pruning config.
QA steps
bootstrap
juju model-config, verify that default status history pruning params are shown
bootstrap with values set via --config
juju model-config, verify that the specified status history pruning params are shown
bootstrap beta2
upgrade
juju model-config, verify that default status history pruning params are shown
Documentation changes
There are 2 new model config attributes:
max-status-history-age
"The maximum age for status history entries before they are pruned, in human-readable time format"
max-status-history-size
"The maximum size for the status history collection, in human-readable memory format"
Bug reference
http://pad.lv/1681352