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

fault filter: use correct stat prefix #251

Merged
merged 2 commits into from
Nov 30, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions source/common/http/filter/fault_filter.cc
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ namespace Http {

FaultFilterConfig::FaultFilterConfig(const Json::Object& json_config, Runtime::Loader& runtime,
const std::string& stat_prefix, Stats::Store& stats)
: runtime_(runtime), stats_{ALL_FAULT_FILTER_STATS(POOL_COUNTER_PREFIX(stats, stat_prefix))} {
: runtime_(runtime), stats_(generateStats(stat_prefix, stats)) {

if (json_config.hasObject("abort")) {
const Json::Object& abort = json_config.getObject("abort");
Expand Down Expand Up @@ -111,7 +111,7 @@ FilterTrailersStatus FaultFilter::decodeTrailers(HeaderMap&) {
return FilterTrailersStatus::Continue;
}

FaultFilterStats FaultFilter::generateStats(const std::string& prefix, Stats::Store& store) {
FaultFilterStats FaultFilterConfig::generateStats(const std::string& prefix, Stats::Store& store) {
std::string final_prefix = prefix + "fault.";
return {ALL_FAULT_FILTER_STATS(POOL_COUNTER_PREFIX(store, final_prefix))};
}
Expand Down
4 changes: 2 additions & 2 deletions source/common/http/filter/fault_filter.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@ class FaultFilterConfig {
FaultFilterStats& stats() { return stats_; }

private:
static FaultFilterStats generateStats(const std::string& prefix, Stats::Store& store);

uint64_t abort_percent_{}; // 0-100
uint64_t http_status_{}; // HTTP or gRPC return codes
uint64_t fixed_delay_percent_{}; // 0-100
Expand All @@ -63,8 +65,6 @@ class FaultFilter : public StreamDecoderFilter {
FaultFilter(FaultFilterConfigPtr config);
~FaultFilter();

static FaultFilterStats generateStats(const std::string& prefix, Stats::Store& store);

FilterHeadersStatus decodeHeaders(HeaderMap& headers, bool end_stream) override;
FilterDataStatus decodeData(Buffer::Instance& data, bool end_stream) override;
FilterTrailersStatus decodeTrailers(HeaderMap& trailers) override;
Expand Down