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: add consul agent service discovery #3834

Merged
merged 16 commits into from
Jun 14, 2021
Merged

Conversation

trevorwhitney
Copy link
Collaborator

@trevorwhitney trevorwhitney commented Jun 9, 2021

What this PR does / why we need it:
This PR adds a new service discovery option to promtail, which is an adaptation of the existing prometheus consul service discovery to use the consul agent APIs instead. This is beneficial for very large consul clusters, where the catalog api endpoints can get very big and slow. Since promtail is often deployed on every node in a cluster, it makes sense for it be able to leverage the local consul agent which is also often deployed on every node in a cluster.

Which issue(s) this PR fixes:
Fixes #3744

Special notes for your reviewer:
This is running in a test environment on GCP if you'd like to poke at it

Checklist

  • Documentation added
  • Tests updated

Signed-off-by: Trevor Whitney <trevorjwhitney@gmail.com>
Signed-off-by: Trevor Whitney <trevorjwhitney@gmail.com>
Signed-off-by: Trevor Whitney <trevorjwhitney@gmail.com>
@dannykopping dannykopping changed the title 3744 consul agent sd Promtail: add consul agent service discovery Jun 9, 2021
Signed-off-by: Trevor Whitney <trevorjwhitney@gmail.com>
Signed-off-by: Trevor Whitney <trevorjwhitney@gmail.com>
Signed-off-by: Trevor Whitney <trevorjwhitney@gmail.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.

I have only reviewed the wording of the documentation. I have not reviewed the code. With corrections, I approve the documentation of this feature.

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
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
@09jvilla 09jvilla requested a review from replay June 11, 2021 14:51
slim-bean and others added 10 commits June 11, 2021 14:51
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>
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
Collaborator

@slim-bean slim-bean left a comment

Choose a reason for hiding this comment

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

Looks Good!

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.

I skimmed it; looks pretty good to me. I'd probably prefer we use consul_agent instead of consulagent in our yaml configs & exposed meta labels, but that's largely a nitpick.

return
}

nodeName := self["Config"]["NodeName"].(string)
Copy link
Member

Choose a reason for hiding this comment

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

Part of me would like to see this access protected against panics, but I see the method signature doesn't support an error return argument. We could use logging + failure metrics here, but the panic on such an unexpected code path may be fine for now -- it's a quicker, cruder way to surface problems.

@slim-bean slim-bean merged commit de93a1b into main Jun 14, 2021
@slim-bean slim-bean deleted the 3744-consul-agent-sd branch June 14, 2021 20:51
@slim-bean
Copy link
Collaborator

I skimmed it; looks pretty good to me. I'd probably prefer we use consul_agent instead of consulagent in our yaml configs & exposed meta labels, but that's largely a nitpick.

I think this is a change now or change never kind of thing @owen-d, I merged as is because there is an existing precedent with digitalocean. Not a great argument per say but I guess one of the boards on the bike shed was already this color :)

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.

consul agent based service discovery for promtail
4 participants