Skip to content

Commit

Permalink
making flumonitor log in logger service
Browse files Browse the repository at this point in the history
  • Loading branch information
himanshu144141 committed Oct 6, 2016
1 parent 044667a commit 0c133e0
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 2 deletions.
9 changes: 9 additions & 0 deletions app/services/flu_logger_svc/logger.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,15 @@ func LogStepError(flu models.FeedLineUnit, stepType step_type.StepType, errMsg s
log(flu, 3, stepType, errMsg, retried)
}

func LogRaw(fluLogs []models.FeedLineLog) {

loggerChan := feed_line.GetFeedlineLoggerChannel()

for _, fluLog := range fluLogs {
loggerChan.Push(fluLog)
}
}

func log(flu models.FeedLineUnit, event int, stepType step_type.StepType, message string, retried bool) {

metaData := models.JsonF{"build": flu.Build}
Expand Down
4 changes: 2 additions & 2 deletions app/services/flu_svc/flu_output/flu_utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import (
"github.com/crowdflux/angel/app/models"
"github.com/crowdflux/angel/app/models/status_codes"
"github.com/crowdflux/angel/app/plog"
"github.com/crowdflux/angel/app/services/flu_logger_svc"
)

func ParseFluResponse(resp *http.Response) *FluResponse {
Expand Down Expand Up @@ -98,6 +99,5 @@ func putDbLog(completedFLUs []models.FeedLineUnit, message string, resp FluRespo
}
dbLogArr[i] = dbLog
}
err := dbLogger.Log(dbLogArr)
plog.Error("Flumonitor", err)
flu_logger_svc.LogRaw(dbLogArr)
}
5 changes: 5 additions & 0 deletions app/services/work_flow_svc/work_flow_svc.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ import (

"github.com/crowdflux/angel/app/DAL/feed_line"
"github.com/crowdflux/angel/app/models"
"github.com/crowdflux/angel/app/models/step_type"
"github.com/crowdflux/angel/app/services/flu_logger_svc"
"github.com/crowdflux/angel/app/services/work_flow_svc/counter"
"github.com/crowdflux/angel/app/services/work_flow_svc/work_flow"
)
Expand Down Expand Up @@ -47,6 +49,9 @@ func startWorkflowSvc(w *workFlowSvc) {
for flu := range w.OutQ.Receiver() {
w.complete(flu.FeedLineUnit)
flu.ConfirmReceive()

//TODO put at correct place according to the architecture
flu_logger_svc.LogStepEntry(flu.FeedLineUnit, step_type.Gateway, flu.Redelivered())
}
}()
}
Expand Down

0 comments on commit 0c133e0

Please sign in to comment.