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

support env var expansion in envoy statsd urls #8564

Merged

Conversation

woz5999
Copy link
Contributor

@woz5999 woz5999 commented Aug 25, 2020

Fixes #8561


if !allowedStatsSinkEnvVars[s] {
// if the specified env var isn't explicitly allowed, unexpand it
return fmt.Sprintf("${%s}", s)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Could also just return an empty string. no strong preference here; either way, if someone enters a disallowed env var, it's going to fail url.Parse, so the result here is just cosmetic.

@@ -305,6 +307,18 @@ func (c *BootstrapConfig) generateStatsSinkJSON(name string, addr string) (strin
}`, nil
}

func (c *BootstrapConfig) statsSinkEnvMapping(s string) string {
allowedStatsSinkEnvVars := map[string]bool{
Copy link
Contributor Author

@woz5999 woz5999 Aug 25, 2020

Choose a reason for hiding this comment

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

this seemed like the simplest place to put this allowlist. happy to move elsewhere if desired.

the original implementation explicitly didn't support expanding arbitrary env vars, so the purpose here to minimize the potential side effects while still providing the ability to dynamically set this. happy to allow additional env vars or remove this functionality entirely in favor of os.ExpandEnv if that's preferable.

@woz5999
Copy link
Contributor Author

woz5999 commented Sep 2, 2020

@rboyer @mkeeler what's the best way to get this change reviewed?

@woz5999
Copy link
Contributor Author

woz5999 commented Sep 9, 2020

@mkeeler @i0rek what's the best way to get this change reviewed?

@woz5999
Copy link
Contributor Author

woz5999 commented Sep 25, 2020

@dnephin @s-christoff what's the best way to get this change reviewed?

@woz5999
Copy link
Contributor Author

woz5999 commented Oct 21, 2020

@mkcp what's the best way to get this change reviewed?

@dnephin dnephin added theme/connect Anything related to Consul Connect, Service Mesh, Side Car Proxies theme/telemetry Anything related to telemetry or observability type/enhancement Proposed improvement or new feature and removed theme/telemetry Anything related to telemetry or observability labels Feb 11, 2021
Copy link
Contributor

@dnephin dnephin left a comment

Choose a reason for hiding this comment

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

Thank you for the PR! Sorry it took us a while to review it.

I think this looks good! I rebased the PR to resolve some conflicts, updated the test expected value because it had changed due to other changes, and also added a changelog entry.

If the tests still pass I think we are good to merge.

@dnephin dnephin merged commit 510df57 into hashicorp:master Mar 19, 2021
@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/340396.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
theme/connect Anything related to Consul Connect, Service Mesh, Side Car Proxies theme/telemetry Anything related to telemetry or observability type/enhancement Proposed improvement or new feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support dynamic addresses for envoy proxy statsd_url configurations
3 participants