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

Add flags to consul connect envoy for metrics merging. #9768

Merged
merged 1 commit into from
Mar 4, 2021

Conversation

ndhanushkodi
Copy link
Contributor

@ndhanushkodi ndhanushkodi commented Feb 15, 2021

Changes Proposed:
Allows setting -prometheus-backend-port to configure the cluster
envoy_prometheus_bind_addr points to.

Allows setting -prometheus-scrape-path to configure which path
envoy_prometheus_bind_addr exposes metrics on.

-prometheus-backend-port is used by the consul-k8s metrics merging feature, to
configure envoy_prometheus_bind_addr to point to the merged metrics
endpoint that combines Envoy and service metrics so that one set of
annotations on a Pod can scrape metrics from the service and it's Envoy
sidecar.

-prometheus-scrape-path is used to allow configurability of the path
where prometheus metrics are exposed on envoy_prometheus_bind_addr. This value is also configurable via consul-k8s/consul-helm so for that it needs to be configurable here.

@github-actions github-actions bot added the theme/cli Flags and documentation for the CLI interface label Feb 15, 2021
@ndhanushkodi ndhanushkodi requested review from a team, lkysow, ishustava and thisisnotashwin and removed request for a team and lkysow February 15, 2021 05:45
Copy link
Contributor

@thisisnotashwin thisisnotashwin left a comment

Choose a reason for hiding this comment

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

This looks great. You will need to go fmt -s based on what i saw on the failing CI task.
Excellent work @ndhanushkodi !!

@vercel vercel bot temporarily deployed to Preview – consul-ui-staging February 16, 2021 18:10 Inactive
@vercel vercel bot temporarily deployed to Preview – consul February 16, 2021 18:10 Inactive
@blake blake requested a review from a team February 16, 2021 19:05
@ndhanushkodi ndhanushkodi changed the base branch from feature-metrics to master February 18, 2021 17:44
@vercel vercel bot temporarily deployed to Preview – consul March 4, 2021 19:42 Inactive
@vercel vercel bot temporarily deployed to Preview – consul-ui-staging March 4, 2021 19:42 Inactive
@@ -168,6 +199,7 @@ func TestGenerateConfig(t *testing.T) {
AdminBindPort: "19000",
LocalAgentClusterName: xds.LocalAgentClusterName,
Token: "c9a52720-bf6c-4aa6-b8bc-66881a5ade95",
PrometheusScrapePath: "/metrics",
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is being added to "WantArgs" everywhere since it is a default value, so even when we don't pass the flag to consul connect envoy, we want it to be set to "/metrics"

@vercel vercel bot temporarily deployed to Preview – consul-ui-staging March 4, 2021 19:53 Inactive
@vercel vercel bot temporarily deployed to Preview – consul March 4, 2021 19:53 Inactive
CHANGELOG.md Outdated Show resolved Hide resolved
@@ -213,19 +213,23 @@ func (c *BootstrapConfig) ConfigureArgs(args *BootstrapTplArgs, omitDeprecatedTa
}
// Setup prometheus if needed. This MUST happen after the Static*JSON is set above
if c.PrometheusBindAddr != "" {
if err := c.generateListenerConfig(args, c.PrometheusBindAddr, "envoy_prometheus_metrics", "path", "/metrics", "/stats/prometheus"); err != nil {
// if args.PrometheusBackendPort is not an empty string, this will tell
Copy link
Member

Choose a reason for hiding this comment

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

I feel like this comment belongs somewhere in generateListenerConfig instead

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sounds good, I removed this and modified the comment in generateListenerConfig

@@ -165,6 +167,19 @@ func (c *cmd) init() {
"consul.destination.[service|dc|...]. The old tags were preserved for backward compatibility,"+
"but can be disabled with this flag.")

c.flags.StringVar(&c.prometheusBackendPort, "prometheus-backend-port", "",
Copy link
Member

Choose a reason for hiding this comment

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

I believe there should also be website updates to the CLI section and possibly something else (?).

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 added it to that CLI section and looked around for any other areas these flags are mentioned and didn't see any. There will be a future docs PR for the overall metrics feature in Consul-k8s that should hopefully cover anything else.

Allows setting -prometheus-backend-port to configure the cluster
envoy_prometheus_bind_addr points to.

Allows setting -prometheus-scrape-path to configure which path
envoy_prometheus_bind_addr exposes metrics on.

-prometheus-backend-port is used by the consul-k8s metrics merging feature, to
configure envoy_prometheus_bind_addr to point to the merged metrics
endpoint that combines Envoy and service metrics so that one set of
annotations on a Pod can scrape metrics from the service and it's Envoy
sidecar.

-prometheus-scrape-path is used to allow configurability of the path
where prometheus metrics are exposed on envoy_prometheus_bind_addr.
Copy link
Member

@rboyer rboyer left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Contributor

@ishustava ishustava 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 to me!

@rboyer rboyer merged commit 15e8b13 into master Mar 4, 2021
@rboyer rboyer deleted the metrics-merging branch March 4, 2021 22:15
@hashicorp-ci
Copy link
Contributor

🍒 If backport labels were added before merging, cherry-picking will start automatically.

To retroactively trigger a backport after merging, add backport labels and re-run https://circleci.com/gh/hashicorp/consul/333665.

@TomasKohout
Copy link

Could this be backported to 1.9.x, please? :-)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
theme/cli Flags and documentation for the CLI interface
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants