-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Get attributes from envoy config. #87
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
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -37,7 +37,8 @@ typedef std::shared_ptr<HttpRequestData> HttpRequestDataPtr; | |
| class HttpControl final : public Logger::Loggable<Logger::Id::http> { | ||
| public: | ||
| // The constructor. | ||
| HttpControl(const std::string& mixer_server); | ||
| HttpControl(const std::string& mixer_server, | ||
| const std::map<std::string, std::string>& attributes); | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. use std::map<std::string, std::string>&& attributes call it by std::move() to reduce a copy |
||
|
|
||
| // Make mixer check call. | ||
| void Check(HttpRequestDataPtr request_data, HeaderMap& headers, | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -96,7 +96,16 @@ class Config : public Logger::Loggable<Logger::Id::http> { | |
| __func__); | ||
| } | ||
|
|
||
| http_control_ = std::make_shared<HttpControl>(mixer_server); | ||
| std::map<std::string, std::string> attributes; | ||
| if (config.hasObject("attributes")) { | ||
| for (const std::string& attr : config.getStringArray("attributes")) { | ||
| attributes[attr] = config.getString(attr); | ||
| } | ||
| } else { | ||
| log().warn("No attributes is specified in the config: {}", __func__); | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Not need to log a warn, just remove the whole else {}.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This needs to be extended to include You do not have to do this in the same PR, but send a follow-up PR that allows this customization.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm also OK with restricting mixer attributes to be same for all service versions. The drawback is that we cannot do gradual config change for the mixer attributes. The whole idea of service versions is that we can customize what set of attributes to send for a subset of the service destination pods.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Open https://github.com/istio/proxy/issues/88 for first issue. Did not quite understand the second issue yet. Will open a separate issue once I understand it. |
||
| } | ||
|
|
||
| http_control_ = std::make_shared<HttpControl>(mixer_server, attributes); | ||
| log().debug("Called Mixer::Config contructor with mixer_server: ", | ||
| mixer_server); | ||
| } | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
keep the map in the class member.
// the attributes read from the config file.
std::map<std::string, std::string>& config_attributes_;
In the Check() call, set all of them to the attributes data structure.