-
Notifications
You must be signed in to change notification settings - Fork 491
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
cmd/scollector: Covert gauges to counters for os.cpu #1494
Conversation
type tsIntegrator func(int64, float64) float64 | ||
|
||
func getTsIntegrator() tsIntegrator { | ||
var i float64 |
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.
these variable names are not descriptive enough to indicate what is going on here.
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.
Suggestions?
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,ts,t,v
-> total,lastTimestamp, time, value
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.
oldTs and ts? i to total?
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.
Sounds good, thanks
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.
How about
type tsIntegrator struct{
data map[string]struct{
total floats64
lastTime
}
sync.Mutex
}
?
then you can do cpuIntegrator.Add(key, now, val)
and cpuIntegrator.Total(key)
. Hide all of the mutexing and map stuff inside the integrator.
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 was thinking there might be use cases where you don't want to use it in
the map, so this would make it more reusable
On Thu, Dec 3, 2015 at 10:23 AM, Craig Peterson notifications@github.com
wrote:
In cmd/scollector/collectors/collectors.go
#1494 (comment):@@ -325,3 +325,17 @@ func skipMetric(index string) bool {
}
return true
}
+
+type tsIntegrator func(int64, float64) float64
+
+func getTsIntegrator() tsIntegrator {
- var i float64
How about
type tsIntegrator struct{
data map[string]struct{
total floats64
lastTime
}
sync.Mutex
}?
then you can do cpuIntegrator.Add(key, now, val) and
cpuIntegrator.Total(key). Hide all of the mutexing and map stuff inside
the integrator.—
Reply to this email directly or view it on GitHub
https://github.com/bosun-monitor/bosun/pull/1494/files#r46564464.
Interval: time.Second * 30, | ||
name: fmt.Sprintf("snmp-cisco-%s", cfg.Host), | ||
}) | ||
&IntervalCollector{ |
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.
if you make the integrator here and pass it into c_cisco_cpu, you may not need the map or mutex at all.
f98348d
to
5da18a0
Compare
No description provided.