Tags: siepkes/servo
Tags
avoid mem leak for improper use of registerObject (Netflix#451) Calling `Monitors.registerObject` with a monitor such as a `BasicCounter` instance will register an empty composite monitor with an id like `default:class=BasicCounter`. When using the spectator integration this would result is a memory leak because it needs to track the instances to be able to aggregate the results. This change updates the registration to remove any previous copies and overwrite which is the default for servo. It also double checks if it is an empty basic composite and just ignores those since they will never have any monitors to collect. It is a bit difficult to test without a bunch of reflection to dig into the guts of the meter state. I did reproduce in a debugger using the following test case and confirm the state is no longer growing: ```java @test public void testBasicCounterLoop() { for (int i = 0; i < 1000; ++i) { BasicCounter c = new BasicCounter(CONFIG); Monitors.registerObject(c); c.increment(); } assertEquals(1000, registry.counter(ID).count()); } ```
base StatsMonitor expiration on writes (Netflix#450) Before it was using calls to `getMonitors` to update the last used time. That method will not get called when delegating to Spectator and thus it will always expire 15 minutes after registration and never come back. This changes the last used time to get updated when values are recorded rather than when they are read using `getMonitors`.
getting indiv props instead of reading all props (Netflix#444) Secured applications may not have access to all system properties on a server. Making this change to prevent reading all the system properties and just read the properties that are required for creating the DefaultMonitorRegistry instance. Fixes Netflix#443.
fix name of publish env variable (Netflix#440) It was `BINTRAY_PUBLISH` in the travis config but the script is checking `GRADLE_PUBLISH`.
variance is imprecise when size is small (Netflix#418) In my opinion the current variance (and by consequence the standard deviation) computation are imprecise, when curSize is not high (when curSize < 10 for example): ```java variance = (sumSquares / curSize) - (mean * mean); ``` The computation I suggest in this pull request does not hurt and is precise: ```java if (curSize == 1) { variance = 0d; } else { variance = (sumSquares - ((double) total * total / curSize)) / (curSize - 1); } ``` For reference: http://web.archive.org/web/20050512031826/http://helios.bto.ed.ac.uk/bto/statistics/tress3.html
PreviousNext