Skip to content

Commit 12ca162

Browse files
committed
SCFF-30 changed eventBatchSize and if condition appender
1 parent d9310ca commit 12ca162

2 files changed

Lines changed: 6 additions & 6 deletions

File tree

main.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ var (
2828
wantedEvents = kingpin.Flag("events", fmt.Sprintf("Comma separated list of events you would like. Valid options are %s", eventRouting.GetListAuthorizedEventEvents())).Default("LogMessage").OverrideDefaultFromEnvar("EVENTS").String()
2929
boltDatabasePath = "my.db" //default
3030
tickerTime, errT = time.ParseDuration("60s") //Default
31-
eventsBatch = kingpin.Flag("event-amount", "Events amount").Int()
31+
eventsBatchSize = kingpin.Flag("event-amount", "Events amount").Int()
3232
)
3333

3434
var (
@@ -66,7 +66,7 @@ func main() {
6666

6767
//Creating queue
6868
queue := eventQueue.NewQueue(make([]*eventQueue.Node, 100))
69-
loggingClientSumo := sumoCFFirehose.NewSumoLogicAppender(*sumoEndpoint, 1000, *queue, *eventsBatch)
69+
loggingClientSumo := sumoCFFirehose.NewSumoLogicAppender(*sumoEndpoint, 1000, *queue, *eventsBatchSize)
7070

7171
//Creating Events
7272
events := eventRouting.NewEventRouting(cachingClient, *loggingClientSumo, *queue)

sumoCFFirehose/sumoLogicAppender.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,16 +15,16 @@ type SumoLogicAppender struct {
1515
connectionTimeout int //10000
1616
httpClient http.Client
1717
nozzleQueue eventQueue.Queue
18-
eventsBatch int
18+
eventsBatchSize int
1919
}
2020

21-
func NewSumoLogicAppender(urlValue string, connectionTimeoutValue int, nozzleQueue eventQueue.Queue, eventsBatch int) *SumoLogicAppender {
21+
func NewSumoLogicAppender(urlValue string, connectionTimeoutValue int, nozzleQueue eventQueue.Queue, eventsBatchSize int) *SumoLogicAppender {
2222
return &SumoLogicAppender{
2323
url: urlValue,
2424
connectionTimeout: connectionTimeoutValue,
2525
httpClient: http.Client{Timeout: time.Duration(connectionTimeoutValue * int(time.Millisecond))},
2626
nozzleQueue: nozzleQueue,
27-
eventsBatch: eventsBatch,
27+
eventsBatchSize: eventsBatchSize,
2828
}
2929
}
3030

@@ -64,7 +64,7 @@ func StringBuilder(queue eventQueue.Queue) string {
6464

6565
func (s *SumoLogicAppender) AppendLogs(queue eventQueue.Queue) {
6666
// the appender calls for the next message in the queue and parse it to a string
67-
if queue.GetCount() == s.eventsBatch { //whent the batch limit is met, call stringBuilder
67+
if queue.GetCount() > s.eventsBatchSize { //whent the batch limit is met, call stringBuilder
6868
logMessage := StringBuilder(queue)
6969
s.SendToSumo(logMessage)
7070
}

0 commit comments

Comments
 (0)