Skip to content

Commit

Permalink
Merge pull request #505 from toni-moreno/feature/fix_style_gofumpt
Browse files Browse the repository at this point in the history
Fix code styles with gofumpt
  • Loading branch information
sbengo committed Oct 13, 2021
2 parents 890bd7f + 1872389 commit 15f2252
Show file tree
Hide file tree
Showing 58 changed files with 741 additions and 880 deletions.
10 changes: 4 additions & 6 deletions pkg/agent/agent.go
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,7 @@ func initSelfMonitoring(idb map[string]*output.InfluxDB) {

if MainConfig.Selfmon.Enabled {
if val, ok := idb["default"]; ok {
//only executed if a "default" influxdb exist
// only executed if a "default" influxdb exist
val.Init()
val.StartSender(&senderWg)

Expand All @@ -236,7 +236,7 @@ func initSelfMonitoring(idb map[string]*output.InfluxDB) {
selfmonProc.SetOutput(val)

log.Printf("SELFMON enabled %+v", MainConfig.Selfmon)
//Begin the statistic reporting
// Begin the statistic reporting
selfmonProc.StartGather(&gatherWg)
} else {
MainConfig.Selfmon.Enabled = false
Expand All @@ -255,7 +255,6 @@ func IsDeviceInRuntime(id string) bool {
return true
}
return false

}

// DeleteDeviceInRuntime removes the device `id` from the runtime array.
Expand Down Expand Up @@ -311,7 +310,6 @@ func Start() {

// End stops all devices polling.
func End() (time.Duration, error) {

start := time.Now()
log.Infof("END: begin device Gather processes stop... at %s", start.String())
// stop all device processes
Expand All @@ -327,8 +325,8 @@ func End() (time.Duration, error) {
log.Info("END: releasing Selfmonitoring Resources")
selfmonProc.End()
log.Info("END: begin sender processes stop...")
//log.Info("DEBUG Gather WAIT %+v", GatherWg)
//log.Info("DEBUG SENDER WAIT %+v", senderWg)
// log.Info("DEBUG Gather WAIT %+v", GatherWg)
// log.Info("DEBUG SENDER WAIT %+v", senderWg)
// stop all Output Emitter
StopInfluxOut(influxdb)
log.Info("END: waiting for all Sender goroutines stop..")
Expand Down
9 changes: 3 additions & 6 deletions pkg/agent/bus/bus.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,9 @@ import (
"github.com/sirupsen/logrus"
)

var (
log *logrus.Logger
)
var log *logrus.Logger

//mutex for devices m
// mutex for devices m

// SetLogger set log output
func SetLogger(l *logrus.Logger) {
Expand Down Expand Up @@ -88,7 +86,7 @@ func (b *Bus) Leave(leaving *Node) error {
return errors.New("Could not find provided member for removal")
}
b.nodes = append(b.nodes[:nodeIndex], b.nodes[nodeIndex+1:]...)
//leaving.close <- true
// leaving.close <- true

return nil
}
Expand All @@ -100,7 +98,6 @@ func (b *Bus) Stop() {

// Start checks for some message in the broadcast queue pending to send
func (b *Bus) Start() {

for {
select {
case received := <-b.in:
Expand Down
8 changes: 3 additions & 5 deletions pkg/agent/device/measgather.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,20 +23,19 @@ func (d *SnmpDevice) measConcurrentGatherAndSend() {
m.ComputeOidConditionalMetrics()
m.ComputeEvaluatedMetrics(d.VarMap)

//prepare batchpoint
// prepare batchpoint
metSent, metError, measSent, measError, points := m.GetInfluxPoint(d.TagMap)
d.stats.AddMeasStats(metSent, metError, measSent, measError)
startInfluxStats := time.Now()
if bpts != nil {
(*bpts).AddPoints(points)
//send data
// send data
d.Influx.Send(bpts)
} else {
d.Warnf("Can not send data to the output DB becaouse of batchpoint creation error")
}
elapsedInfluxStats := time.Since(startInfluxStats)
d.stats.AddSentDuration(startInfluxStats, elapsedInfluxStats)

}(m)
}
wg.Wait()
Expand All @@ -62,7 +61,7 @@ func (d *SnmpDevice) measSeqGatherAndSend() {
m.ComputeOidConditionalMetrics()
m.ComputeEvaluatedMetrics(d.VarMap)

//prepare batchpoint
// prepare batchpoint
metSent, metError, measSent, measError, points := m.GetInfluxPoint(d.TagMap)
d.stats.AddMeasStats(metSent, metError, measSent, measError)
if bpts != nil {
Expand All @@ -87,5 +86,4 @@ func (d *SnmpDevice) measSeqGatherAndSend() {
}
elapsedInfluxStats := time.Since(startInfluxStats)
d.stats.AddSentDuration(startInfluxStats, elapsedInfluxStats)

}
Loading

0 comments on commit 15f2252

Please sign in to comment.