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

Route-local fault filter config #3084

Merged
merged 45 commits into from
Apr 20, 2018

Conversation

rshriram
Copy link
Member

@rshriram rshriram commented Apr 16, 2018

Follow up from @rodaine's route-local config framework. Enabling per-route/per-vhost config for fault filters. (#3045).

Signed-off-by: Shriram Rajagopalan shriramr@vmware.com

Chris Roche and others added 20 commits April 11, 2018 15:11
Signed-off-by: Chris Roche <croche@lyft.com>
Signed-off-by: Chris Roche <croche@lyft.com>
Signed-off-by: Chris Roche <croche@lyft.com>
Signed-off-by: Chris Roche <croche@lyft.com>
Signed-off-by: Chris Roche <croche@lyft.com>
Signed-off-by: Chris Roche <croche@lyft.com>
Signed-off-by: Chris Roche <croche@lyft.com>
Signed-off-by: Chris Roche <croche@lyft.com>
Signed-off-by: Chris Roche <croche@lyft.com>
Signed-off-by: Chris Roche <croche@lyft.com>
Signed-off-by: Chris Roche <croche@lyft.com>
…into perfilterconfig

Signed-off-by: Shriram Rajagopalan <shriramr@vmware.com>
Signed-off-by: Shriram Rajagopalan <shriramr@vmware.com>
Signed-off-by: Shriram Rajagopalan <shriramr@vmware.com>
…filterconfig

Signed-off-by: Shriram Rajagopalan <shriramr@vmware.com>
…into perfilterconfig

Signed-off-by: Shriram Rajagopalan <shriramr@vmware.com>
Signed-off-by: Chris Roche <croche@lyft.com>
…into perfilterconfig

Signed-off-by: Shriram Rajagopalan <shriramr@vmware.com>
@mattklein123
Copy link
Member

@rodaine can you own first review on this.

…filterconfig

Signed-off-by: Shriram Rajagopalan <shriramr@vmware.com>
@rshriram rshriram changed the title [WIP] Route-local fault filter config Route-local fault filter config Apr 16, 2018
Shriram Rajagopalan added 6 commits April 16, 2018 17:15
Signed-off-by: Shriram Rajagopalan <shriramr@vmware.com>
Signed-off-by: Shriram Rajagopalan <shriramr@vmware.com>
Signed-off-by: Shriram Rajagopalan <shriramr@vmware.com>
Signed-off-by: Shriram Rajagopalan <shriramr@vmware.com>
…filterconfig

Signed-off-by: Shriram Rajagopalan <shriramr@vmware.com>
Signed-off-by: Shriram Rajagopalan <shriramr@vmware.com>
@rshriram
Copy link
Member Author

done..

mattklein123
mattklein123 previously approved these changes Apr 18, 2018
@mattklein123
Copy link
Member

Holding on merging until we resolve #3128 (review). cc @ggreenway @rodaine

Signed-off-by: Shriram Rajagopalan <shriramr@vmware.com>
@mattklein123
Copy link
Member

@rshriram can you merge master and fix this up? Then we can get this in.

Signed-off-by: Shriram Rajagopalan <shriramr@vmware.com>
Shriram Rajagopalan added 3 commits April 19, 2018 21:22
Signed-off-by: Shriram Rajagopalan <shriramr@vmware.com>
Signed-off-by: Shriram Rajagopalan <shriramr@vmware.com>
Signed-off-by: Shriram Rajagopalan <shriramr@vmware.com>
@rshriram
Copy link
Member Author

@mattklein123 updated

envoy::config::filter::http::fault::v2::HTTPFault proto_config;
MessageUtil::jsonConvert(struct_config, proto_config);
Router::RouteSpecificFilterConfigConstSharedPtr rconfig;
rconfig.reset(new Fault::FaultSettings(proto_config));
Copy link
Member

Choose a reason for hiding this comment

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

nit: return std::make_shared<...>(...)

// faults. In other words, runtime is supported only when faults are
// configured at the filter level.
if (callbacks_->route() && callbacks_->route()->routeEntry()) {
const std::string name = Extensions::HttpFilters::HttpFilterNames::get().FAULT;
Copy link
Member

Choose a reason for hiding this comment

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

nit: const std::string&

const FaultSettings* per_route_settings =
route_entry->perFilterConfigTyped<FaultSettings>(name)
?: route_entry->virtualHost().perFilterConfigTyped<FaultSettings>(name);
config_->updateFaultSettings(per_route_settings);
Copy link
Member

Choose a reason for hiding this comment

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

Aren't you effectively updating a global shared pointer here? I don't think this is right? Can you make sure FaultFilterConfigSharedPtr is actually FaultFilterConfigConstSharedPtr to catch this?

Copy link
Member Author

Choose a reason for hiding this comment

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

ack.. good catch..

Copy link
Member Author

Choose a reason for hiding this comment

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

now that I think about it, the reason I did this was because I wanted to avoid allocation in the request path. I couldn't create an identical config object for RouteSpecific.. because I don't have access to runtime/stats/scope etc in that API Call.

Copy link
Member

Choose a reason for hiding this comment

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

Hmm. Then this is the same problem as Lua. We need to fix this now I guess and be able to pass the full FactoryContext into the factory function. Can you take a look at that?

Copy link
Member Author

Choose a reason for hiding this comment

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

ignore please. fixed it

Shriram Rajagopalan added 3 commits April 20, 2018 12:02
…filterconfig

Signed-off-by: Shriram Rajagopalan <shriramr@vmware.com>
Signed-off-by: Shriram Rajagopalan <shriramr@vmware.com>
Signed-off-by: Shriram Rajagopalan <shriramr@vmware.com>
Runtime::Loader& runtime_;
FaultFilterStats stats_;
const std::string stats_prefix_;
Stats::Scope& scope_;
const FaultSettings settings_;
};

typedef std::shared_ptr<FaultFilterConfig> FaultFilterConfigSharedPtr;
Copy link
Member

@mattklein123 mattklein123 Apr 20, 2018

Choose a reason for hiding this comment

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

Can you change this typedef to std::shared_ptr<const FaultFilterConfig> FaultFilterConfigConstSharedPtr

Copy link
Member

@mattklein123 mattklein123 left a comment

Choose a reason for hiding this comment

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

LGTM other than small comment.

Signed-off-by: Shriram Rajagopalan <shriramr@vmware.com>
@mattklein123
Copy link
Member

@rshriram check OSX failure, it's real compiler error.

Shriram Rajagopalan added 2 commits April 20, 2018 14:26
Signed-off-by: Shriram Rajagopalan <shriramr@vmware.com>
Signed-off-by: Shriram Rajagopalan <shriramr@vmware.com>
@rshriram
Copy link
Member Author

so, I cant really do const filterconfig.. because the filter config has stats as well, which get incremented whenever faults are injected..

Signed-off-by: Shriram Rajagopalan <shriramr@vmware.com>
@mattklein123
Copy link
Member

@rshriram you should be able to fix with a mutable on the stats.

Signed-off-by: Shriram Rajagopalan <shriramr@vmware.com>
@rshriram
Copy link
Member Author

Tests passing finally.

Copy link
Member

@mattklein123 mattklein123 left a comment

Choose a reason for hiding this comment

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

nice

@mattklein123 mattklein123 merged commit cf1e2df into envoyproxy:master Apr 20, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants