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

Adding a sync() function to filetarget #293

Merged
merged 5 commits into from
Feb 13, 2019
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
fixing a bunch of imports I munged
moved tailer to its own file
refactoring filetarget to make synclogic easier to follow and reused as much as possible
  • Loading branch information
slim-bean committed Feb 13, 2019
commit afb903617da5d2e89c59482e3c3794b671e5b9e6
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,4 @@ cmd/loki/loki
cmd/promtail/promtail
/loki
/promtail
.idea/
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Whats this? Probably belongs in ~/.gitignore and then do git config --global core.excludesfile $HOME/.gitignore

7 changes: 3 additions & 4 deletions cmd/promtail/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,15 @@ import (
"flag"
"os"

"github.com/cortexproject/cortex/pkg/util"
"github.com/cortexproject/cortex/pkg/util/flagext"
"github.com/go-kit/kit/log/level"
"github.com/grafana/loki/pkg/promtail/config"
"github.com/prometheus/client_golang/prometheus"
"github.com/prometheus/common/version"

"github.com/cortexproject/cortex/pkg/util"
"github.com/cortexproject/cortex/pkg/util/flagext"

"github.com/grafana/loki/pkg/helpers"
"github.com/grafana/loki/pkg/promtail"
"github.com/grafana/loki/pkg/promtail/config"
)

func init() {
Expand Down
7 changes: 3 additions & 4 deletions pkg/promtail/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,13 @@ import (
"io/ioutil"
"path/filepath"

"github.com/grafana/loki/pkg/promtail/scrape"
"github.com/grafana/loki/pkg/promtail/targets"
"gopkg.in/yaml.v2"

"github.com/weaveworks/common/server"
"gopkg.in/yaml.v2"

"github.com/grafana/loki/pkg/promtail/client"
"github.com/grafana/loki/pkg/promtail/positions"
"github.com/grafana/loki/pkg/promtail/scrape"
"github.com/grafana/loki/pkg/promtail/targets"
)

// Config for promtail, describing what files to watch.
Expand Down
2 changes: 1 addition & 1 deletion pkg/promtail/promtail.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@ package promtail

import (
"github.com/cortexproject/cortex/pkg/util"
"github.com/grafana/loki/pkg/promtail/config"
"github.com/weaveworks/common/server"

"github.com/grafana/loki/pkg/promtail/client"
"github.com/grafana/loki/pkg/promtail/config"
"github.com/grafana/loki/pkg/promtail/positions"
"github.com/grafana/loki/pkg/promtail/targets"
)
Expand Down
11 changes: 6 additions & 5 deletions pkg/promtail/promtail_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,17 +11,18 @@ import (
"github.com/cortexproject/cortex/pkg/util"
"github.com/cortexproject/cortex/pkg/util/flagext"
"github.com/go-kit/kit/log"
"github.com/prometheus/common/model"
sd_config "github.com/prometheus/prometheus/discovery/config"
"github.com/prometheus/prometheus/discovery/targetgroup"
"github.com/weaveworks/common/server"

"github.com/grafana/loki/pkg/logproto"
"github.com/grafana/loki/pkg/promtail/api"
"github.com/grafana/loki/pkg/promtail/client"
"github.com/grafana/loki/pkg/promtail/config"
"github.com/grafana/loki/pkg/promtail/positions"
"github.com/grafana/loki/pkg/promtail/scrape"
"github.com/grafana/loki/pkg/promtail/targets"
"github.com/prometheus/common/model"
sd_config "github.com/prometheus/prometheus/discovery/config"
"github.com/prometheus/prometheus/discovery/targetgroup"
"github.com/weaveworks/common/server"
)

func TestPromtailRun(t *testing.T) {
Expand Down Expand Up @@ -54,7 +55,7 @@ func TestPromtailRun(t *testing.T) {
}
http.Handle("/api/prom/push", handler)
go func() {
if err := http.ListenAndServe(":3100", nil); err != nil {
if err := http.ListenAndServe("127.0.0.1:3100", nil); err != nil {
t.Fatal("Failed to start web server to receive logs", err)
}
}()
Expand Down
3 changes: 2 additions & 1 deletion pkg/promtail/scrape/scrape.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,10 @@ package scrape
import (
"fmt"

"github.com/grafana/loki/pkg/promtail/api"
sd_config "github.com/prometheus/prometheus/discovery/config"
"github.com/prometheus/prometheus/pkg/relabel"

"github.com/grafana/loki/pkg/promtail/api"
)

// Config describes a job to scrape.
Expand Down
Loading