// Append implements storage.SampleAppender. Always returns nil. func (s *ReloadableStorage) Append(smpl *model.Sample) error { s.mtx.RLock() defer s.mtx.RUnlock() if s.queue == nil { return nil } var snew model.Sample snew = *smpl snew.Metric = smpl.Metric.Clone() for ln, lv := range s.externalLabels { if _, ok := smpl.Metric[ln]; !ok { snew.Metric[ln] = lv } } snew.Metric = model.Metric( relabel.Process(model.LabelSet(snew.Metric), s.conf.WriteRelabelConfigs...)) if snew.Metric == nil { return nil } s.queue.Append(&snew) return nil }
// Append implements storage.SampleAppender. Always returns nil. func (s *Storage) Append(smpl *model.Sample) error { s.mtx.RLock() var snew model.Sample snew = *smpl snew.Metric = smpl.Metric.Clone() for ln, lv := range s.externalLabels { if _, ok := smpl.Metric[ln]; !ok { snew.Metric[ln] = lv } } snew.Metric = model.Metric( relabel.Process(model.LabelSet(snew.Metric), s.relabelConfigs...)) s.mtx.RUnlock() if snew.Metric == nil { return nil } for _, q := range s.queues { q.Append(&snew) } return nil }
func (app relabelAppender) Append(s *model.Sample) error { labels := relabel.Process(model.LabelSet(s.Metric), app.relabelings...) // Check if the timeseries was dropped. if labels == nil { return nil } s.Metric = model.Metric(labels) return app.SampleAppender.Append(s) }
func (app relabelAppender) Append(s *model.Sample) error { labels, err := Relabel(model.LabelSet(s.Metric), app.relabelings...) if err != nil { return fmt.Errorf("metric relabeling error %s: %s", s.Metric, err) } // Check if the timeseries was dropped. if labels == nil { return nil } s.Metric = model.Metric(labels) return app.SampleAppender.Append(s) }
func (app relabelAppender) Append(s *model.Sample) { labels, err := Relabel(model.LabelSet(s.Metric), app.relabelings...) if err != nil { log.Errorf("Error while relabeling metric %s: %s", s.Metric, err) return } // Check if the timeseries was dropped. if labels == nil { return } s.Metric = model.Metric(labels) app.app.Append(s) }
// Append implements storage.SampleAppender. func (s *Storage) Append(smpl *model.Sample) { s.mtx.RLock() var snew model.Sample snew = *smpl snew.Metric = smpl.Metric.Clone() for ln, lv := range s.externalLabels { if _, ok := smpl.Metric[ln]; !ok { snew.Metric[ln] = lv } } s.mtx.RUnlock() for _, q := range s.queues { q.Append(&snew) } }