Skip to content

Commit

Permalink
v1.2.0 the size of a pack change from 1k to 10k
Browse files Browse the repository at this point in the history
  • Loading branch information
nixargh committed Feb 28, 2021
1 parent 68614bb commit 2f5704f
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).

## [1.2.0]
### Changed
- The size of a pack from **1000** to **10000**. Default packs limit adjusted as well.

## [1.1.2] - 2021-02-25
### Fixed
- Bump version.
Expand Down
10 changes: 5 additions & 5 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import (
// "github.com/pkg/profile"
)

var version string = "1.1.2"
var version string = "1.2.0"

var clog, slog, rlog, tlog, stlog *log.Entry
var hostname string
Expand Down Expand Up @@ -195,15 +195,15 @@ func runSender(host string, port int, outputChan chan *Metric, TLS bool, ignoreC
}

// collect a pack of metrics
var metrics [1000]*Metric
var metrics [10000]*Metric

for i := 0; i < len(metrics); i++ {
select {
case metric := <-outputChan:
metrics[i] = metric
default:
metrics[i] = emptyMetric
time.Sleep(100 * time.Millisecond)
time.Sleep(10 * time.Millisecond)
}
}

Expand All @@ -220,7 +220,7 @@ func runSender(host string, port int, outputChan chan *Metric, TLS bool, ignoreC
}
}

func sendMetric(metrics *[1000]*Metric, connection net.Conn, outputChan chan *Metric) {
func sendMetric(metrics *[10000]*Metric, connection net.Conn, outputChan chan *Metric) {
sent := 0
returned := 0
connectionAlive := true
Expand Down Expand Up @@ -481,7 +481,7 @@ func main() {
flag.BoolVar(&jsonLog, "jsonLog", false, "Log in JSON format")
flag.BoolVar(&debug, "debug", false, "Log debug messages")
flag.BoolVar(&logCaller, "logCaller", false, "Log message caller (file and line number)")
flag.IntVar(&limitPerSec, "limitPerSec", 10, "Maximum number of metric packs (<=1000 metrics per pack) sent per second")
flag.IntVar(&limitPerSec, "limitPerSec", 2, "Maximum number of metric packs (<=10000 metrics per pack) sent per second")
flag.StringVar(&systemTenant, "systemTenant", "", "Graphite project name to store SELF metrics in. By default is equal to 'tennant'")
flag.StringVar(&systemPrefix, "systemPrefix", "", "Prefix to add to any SELF metric. By default is equal to 'prefix'")

Expand Down

0 comments on commit 2f5704f

Please sign in to comment.