Skip to content

Commit

Permalink
RPCModule :
Browse files Browse the repository at this point in the history
1. fix : add lock and flag when RPCFilterPolicy report();
2. feat : refactor the usage of RPCMetricsFilter::Collector;
3. feat : add filter_name and differentiate the var reported by each filter;
4. fix : add lock for SummaryVar::observe();
  • Loading branch information
holmes1412 committed Jan 30, 2024
1 parent 709d3ce commit 8e38763
Show file tree
Hide file tree
Showing 7 changed files with 245 additions and 91 deletions.
21 changes: 21 additions & 0 deletions src/module/rpc_filter.h
Original file line number Diff line number Diff line change
Expand Up @@ -70,9 +70,20 @@ class RPCFilter
this->module_type = module_type;
}

RPCFilter(const std::string name, enum RPCModuleType module_type)
{
size_t pos = name.find("::");
if (pos != std::string::npos)
this->filter_name = name.substr(0, pos) + "::";
else
this->filter_name = name + "::";
this->module_type = module_type;
}

virtual ~RPCFilter() { }

enum RPCModuleType get_module_type() const { return this->module_type; }
const std::string& get_name() const { return this->filter_name; }

virtual bool client_begin(SubTask *task, RPCModuleData& data)
{
Expand All @@ -91,8 +102,18 @@ class RPCFilter
return true;
}

const std::string raw_var_name(const std::string& name) const
{
size_t pos = name.find("::");
if (pos != std::string::npos)
return name.substr(pos + 2);
else
return name;
}

private:
enum RPCModuleType module_type;
std::string filter_name;
};

} // end namespace srpc
Expand Down
Loading

0 comments on commit 8e38763

Please sign in to comment.