@@ -47,8 +47,6 @@ type emitter interface {
4747 Handle (labels model.LabelSet , timestamp time.Time , record string ) error
4848}
4949
50- const channelSize = 1000
51-
5250// Loki record writer
5351type Loki struct {
5452 lokiConfig loki.Config
@@ -57,7 +55,6 @@ type Loki struct {
5755 saneLabels map [string ]model.LabelName
5856 client emitter
5957 timeNow func () time.Time
60- in chan config.GenericMap
6158 exitChan <- chan struct {}
6259 metrics * metrics
6360}
@@ -208,21 +205,9 @@ func getFloat64(timestamp interface{}) (ft float64, ok bool) {
208205// Write writes a flow before being stored
209206func (l * Loki ) Write (entry config.GenericMap ) {
210207 log .Debugf ("entering Loki Write" )
211- l .in <- entry
212- }
213-
214- func (l * Loki ) processRecords () {
215- for {
216- select {
217- case <- l .exitChan :
218- log .Debugf ("exiting writeLoki because of signal" )
219- return
220- case record := <- l .in :
221- err := l .ProcessRecord (record )
222- if err != nil {
223- log .Errorf ("Write (Loki) error %v" , err )
224- }
225- }
208+ err := l .ProcessRecord (entry )
209+ if err != nil {
210+ log .Errorf ("Write (Loki) error %v" , err )
226211 }
227212}
228213
@@ -266,10 +251,6 @@ func NewWriteLoki(opMetrics *operational.Metrics, params config.StageParam) (*Lo
266251 }
267252 }
268253
269- // TODO / FIXME / FIGUREOUT: seems like we have 2 input channels for Loki? (this one, and see also pipeline_builder.go / getStageNode / StageWrite)
270- in := make (chan config.GenericMap , channelSize )
271- opMetrics .CreateInQueueSizeGauge (params .Name + "-2" , func () int { return len (in ) })
272-
273254 l := & Loki {
274255 lokiConfig : lokiConfig ,
275256 apiConfig : lokiConfigIn ,
@@ -278,11 +259,8 @@ func NewWriteLoki(opMetrics *operational.Metrics, params config.StageParam) (*Lo
278259 client : client ,
279260 timeNow : time .Now ,
280261 exitChan : pUtils .ExitChannel (),
281- in : in ,
282262 metrics : newMetrics (opMetrics , params .Name ),
283263 }
284264
285- go l .processRecords ()
286-
287265 return l , nil
288266}
0 commit comments