Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(promtail): initContainers #655

Merged
merged 4 commits into from
Jun 7, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
89 changes: 50 additions & 39 deletions Gopkg.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions Gopkg.toml
Original file line number Diff line number Diff line change
Expand Up @@ -71,3 +71,7 @@
name = "github.com/hpcloud/tail"
source = "github.com/grafana/tail"
branch = "master"

[[override]]
name = "k8s.io/client-go"
revision = "1a26190bd76a9017e289958b9fba936430aa3704"
20 changes: 15 additions & 5 deletions pkg/promtail/targets/filetargetmanager.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ import (
"github.com/prometheus/prometheus/discovery"
sd_config "github.com/prometheus/prometheus/discovery/config"
"github.com/prometheus/prometheus/discovery/targetgroup"
pkgrelabel "github.com/prometheus/prometheus/pkg/relabel"
"github.com/prometheus/prometheus/relabel"
"github.com/prometheus/prometheus/pkg/labels"
"github.com/prometheus/prometheus/pkg/relabel"

"github.com/grafana/loki/pkg/helpers"
"github.com/grafana/loki/pkg/logentry/stages"
Expand Down Expand Up @@ -184,7 +184,7 @@ type targetSyncer struct {
targets map[string]*FileTarget
mtx sync.Mutex

relabelConfig []*pkgrelabel.Config
relabelConfig []*relabel.Config
targetConfig *Config
}

Expand All @@ -201,10 +201,20 @@ func (s *targetSyncer) sync(groups []*targetgroup.Group) {
level.Debug(s.log).Log("msg", "new target", "labels", t)

discoveredLabels := group.Labels.Merge(t)
labels := relabel.Process(discoveredLabels.Clone(), s.relabelConfig...)
var labelMap = make(map[string]string)
for k, v := range discoveredLabels.Clone() {
labelMap[string(k)] = string(v)
}

processedLabels := relabel.Process(labels.FromMap(labelMap), s.relabelConfig...)

var labels = make(model.LabelSet)
for k, v := range processedLabels.Map() {
labels[model.LabelName(k)] = model.LabelValue(v)
}

// Drop empty targets (drop in relabeling).
if labels == nil {
if processedLabels == nil {
dropped = append(dropped, newDroppedTarget("dropping target, no labels", discoveredLabels))
level.Debug(s.log).Log("msg", "dropping target, no labels")
failedTargets.WithLabelValues("empty_labels").Inc()
Expand Down
14 changes: 9 additions & 5 deletions vendor/github.com/gophercloud/gophercloud/.travis.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading