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

Provide Docker target and discovery in Promtail. #4911

Merged
merged 53 commits into from
Jan 25, 2022

Conversation

jeschkies
Copy link
Contributor

@jeschkies jeschkies commented Dec 10, 2021

What this PR does / why we need it:
This patch adds support to fetch Docker container logs through the Docker daemon API. This should be more robust than the Loki Docker driver or scraping the logs files.

The new Docker target will also collect meta information of the scraped containers. This patch includes a specific Docker target and service discovery based on the Prometheus services discovery.

Which issue(s) this PR fixes:
Addresses #2361
Closes #4703

Special notes for your reviewer:

Checklist

  • Documentation added
  • Tests updated
  • Add an entry in the CHANGELOG.md about the changes.

}

func (tm *TargetManager) sync(groups []*targetgroup.Group) {
// TODO: implement syncer that adds and removes Docker targets.
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I wonder whether a syncer struct is really required.

Copy link
Member

@pstibrany pstibrany left a comment

Choose a reason for hiding this comment

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

I took a quick look at channels usage based on Slack discussion and added some comments.

clients/pkg/promtail/targets/docker/target.go Outdated Show resolved Hide resolved
clients/pkg/promtail/targets/docker/target.go Outdated Show resolved Hide resolved
clients/pkg/promtail/targets/docker/target.go Outdated Show resolved Hide resolved
@jeschkies jeschkies marked this pull request as ready for review January 7, 2022 16:43
@jeschkies jeschkies requested review from KMiller-Grafana and a team as code owners January 7, 2022 16:43
@jeschkies jeschkies requested a review from cyriltovena January 14, 2022 13:53
Copy link
Contributor

@cyriltovena cyriltovena left a comment

Choose a reason for hiding this comment

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

LGTM

docs/sources/clients/docker-driver/_index.md Outdated Show resolved Hide resolved
docs/sources/clients/promtail/configuration.md Outdated Show resolved Hide resolved
docs/sources/clients/promtail/configuration.md Outdated Show resolved Hide resolved
docs/sources/clients/promtail/configuration.md Outdated Show resolved Hide resolved
docs/sources/clients/promtail/configuration.md Outdated Show resolved Hide resolved
docs/sources/clients/promtail/configuration.md Outdated Show resolved Hide resolved
docs/sources/clients/promtail/configuration.md Outdated Show resolved Hide resolved
jeschkies and others added 8 commits January 19, 2022 10:32
Co-authored-by: Karen Miller <84039272+KMiller-Grafana@users.noreply.github.com>
Co-authored-by: Karen Miller <84039272+KMiller-Grafana@users.noreply.github.com>
Co-authored-by: Karen Miller <84039272+KMiller-Grafana@users.noreply.github.com>
Co-authored-by: Karen Miller <84039272+KMiller-Grafana@users.noreply.github.com>
Co-authored-by: Karen Miller <84039272+KMiller-Grafana@users.noreply.github.com>
Co-authored-by: Karen Miller <84039272+KMiller-Grafana@users.noreply.github.com>
Copy link
Contributor

@KMiller-Grafana KMiller-Grafana left a comment

Choose a reason for hiding this comment

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

Thanks for making all the changes. LGTM.

@jeschkies jeschkies merged commit 4716eea into grafana:main Jan 25, 2022
@jeschkies jeschkies deleted the karsten/docker-sd branch January 25, 2022 10:05
@tennox
Copy link

tennox commented Mar 4, 2022

For people looking to try this pre-release:
Docs: https://grafana.com/docs/loki/next/clients/promtail/configuration/#docker_sd_config
Docker image: grafana/promtail:main

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

A Docker service discovery to Promtail
8 participants