component.MetricaModels not clearing
gregmcpugh opened this issue · comments
Hi mate,
I have been looking into the GoRelic code, really great and saved me a load of work, thank you very much.
I do have one question, when i was running this in my tests the component.MetricaModels is not clearing as i feel it should do. I can see in the Component interface you are clearing the Metrics however not MetricsModels. We have added a line in to nil this as well at the same time, this seams to work great now. Can you let me know if I am missing something else where that is doing this, or as to why you would want to keep hold of this and aggregate it.
Regards,
Greg
Hello Greg,
actually component.MetricaModels is not supposed to be cleared.
The idea behind this is what metrica models created once, on the start of agent. Every harvest component model will ask each metrics model to measure current metrica value and put it in the component.Metrics.
If we successfully sent metrics to New Relic - we will just clear it. If we were not able to sent it - we will just keep them. On the next harvest we will aggregate new metrics with old ones and try to send data to New Relic again.
so component.MetricaModels is not supposed to be re-created on every harvest. For example you can have a look at my newrelic sphinx plugin