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

Promtail: Loki Push API #2296

Merged
merged 10 commits into from
Jul 8, 2020
Merged

Promtail: Loki Push API #2296

merged 10 commits into from
Jul 8, 2020

Conversation

slim-bean
Copy link
Collaborator

@slim-bean slim-bean commented Jul 3, 2020

What this PR does / why we need it:

This PR implements the Loki push API in promtail, allowing clients (including promtail) to send to another promtail instance which can then send to Loki (or even more promtails, infinite promtails!)

The original design for this was approved with #1627, this is the implementation of that design.

Which issue(s) this PR fixes:

Fixes #1576

Checklist

  • Documentation added
  • Tests updated

@codecov-commenter
Copy link

codecov-commenter commented Jul 3, 2020

Codecov Report

Merging #2296 into master will increase coverage by 0.26%.
The diff coverage is 35.97%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #2296      +/-   ##
==========================================
+ Coverage   60.99%   61.26%   +0.26%     
==========================================
  Files         158      158              
  Lines       12751    12799      +48     
==========================================
+ Hits         7778     7841      +63     
+ Misses       4390     4364      -26     
- Partials      583      594      +11     
Impacted Files Coverage Δ
cmd/docker-driver/config.go 9.94% <0.00%> (ø)
pkg/distributor/http.go 0.00% <0.00%> (ø)
pkg/promtail/scrapeconfig/scrapeconfig.go 40.00% <ø> (ø)
pkg/promtail/targets/file/filetarget.go 70.48% <0.00%> (ø)
pkg/promtail/targets/file/filetargetmanager.go 0.00% <0.00%> (ø)
pkg/promtail/targets/file/tailer.go 78.40% <ø> (ø)
pkg/promtail/targets/journal/journaltarget.go 49.36% <0.00%> (ø)
...tail/targets/journal/journaltargetmanager_linux.go 0.00% <0.00%> (ø)
...omtail/targets/syslog/syslogparser/syslogparser.go 100.00% <ø> (ø)
pkg/promtail/targets/syslog/syslogtarget.go 74.83% <0.00%> (ø)
... and 7 more

// Stop shuts down the PushTarget.
func (t *PushTarget) Stop() error {
level.Info(t.logger).Log("msg", "stopping push server", "job", t.jobName)
t.server.Shutdown()
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Wanted to add a note, not sure here if it's worth having a waitgroup on the server thread and wait for it before returning here?

@adityacs
Copy link
Contributor

adityacs commented Jul 4, 2020

Now that Promtail acts as server for incoming logs, I think we should have a plan to handle Promtail crash.

Copy link
Member

@owen-d owen-d left a comment

Choose a reason for hiding this comment

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

A few comments then LGTM.

docs/clients/promtail/configuration.md Outdated Show resolved Hide resolved
docs/clients/promtail/configuration.md Show resolved Hide resolved
docs/clients/promtail/configuration.md Outdated Show resolved Hide resolved
pkg/promtail/targets/lokipush/pushtarget.go Show resolved Hide resolved
pkg/promtail/targets/lokipush/pushtarget.go Outdated Show resolved Hide resolved
pkg/promtail/targets/lokipush/pushtargetmanager.go Outdated Show resolved Hide resolved
@slim-bean slim-bean merged commit b24a143 into master Jul 8, 2020
@slim-bean slim-bean deleted the promtail-push branch July 8, 2020 18:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Allow docker driver to send logs to Promtail
4 participants