Skip to content

Commit

Permalink
debug
Browse files Browse the repository at this point in the history
  • Loading branch information
billowqiu committed Nov 3, 2024
1 parent 5e902f9 commit c058a54
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 5 deletions.
2 changes: 1 addition & 1 deletion source/common/config/grpc_mux_impl.cc
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ void GrpcMuxImpl::onDiscoveryResponse(
std::unique_ptr<envoy::service::discovery::v3::DiscoveryResponse>&& message,
ControlPlaneStats& control_plane_stats) {
const std::string type_url = message->type_url();
ENVOY_LOG(debug, "Received gRPC message for {} at version {}", type_url, message->version_info());
ENVOY_LOG(debug, "Received gRPC message for {} at version {}, resp {}", type_url, message->version_info(), message->DebugString());
if (api_state_.count(type_url) == 0) {
// TODO(yuval-k): This should never happen. consider dropping the stream as this is a
// protocol violation
Expand Down
10 changes: 8 additions & 2 deletions source/common/http/conn_manager_impl.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1293,9 +1293,15 @@ void ConnectionManagerImpl::ActiveStream::refreshCachedRoute(const Router::Route
// 查找路由,根据配置的 route 规则查找当前请求匹配的规则,会调用到 RouteMatcher::route
route = snapped_route_config_->route(cb, *request_headers_, filter_manager_.streamInfo(),
stream_id_);
ENVOY_STREAM_LOG(debug, "refreshCachedRoute route cluster name {}", *this,
route==nullptr? "empty":route->routeEntry()->clusterName());
if (!route) {
ENVOY_STREAM_LOG(debug, "refreshCachedRoute empty route", *this);
} else if (route->routeEntry()) {
ENVOY_STREAM_LOG(debug, "refreshCachedRoute route cluster name: {}, route name: {}", *this, route->routeEntry()->clusterName(), route->routeEntry()->routeName());
} else {
ENVOY_STREAM_LOG(debug, "refreshCachedRoute has route, but entry empty", *this);
}
}

}

setRoute(route);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ bool FilterConfig::enforced() const {
}

Http::FilterHeadersStatus Filter::decodeHeaders(Http::RequestHeaderMap& headers, bool) {
ENVOY_LOG(debug, "local_ratelimit decodeHeaders");
const auto* config = getConfig();

if (!config->enabled()) {
Expand Down Expand Up @@ -116,6 +117,7 @@ Http::FilterHeadersStatus Filter::decodeHeaders(Http::RequestHeaderMap& headers,
}

bool Filter::requestAllowed(absl::Span<const RateLimit::LocalDescriptor> request_descriptors) {
ENVOY_LOG(debug, "local_ratelimit requestAllowed with request_descriptors");
const auto* config = getConfig();
return config->rateLimitPerConnection()
? getPerConnectionRateLimiter().requestAllowed(request_descriptors)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -127,9 +127,11 @@ using FilterConfigSharedPtr = std::shared_ptr<FilterConfig>;
* HTTP local rate limit filter. Depending on the route configuration, this filter calls consults
* with local token bucket before allowing further filter iteration.
*/
class Filter : public Http::PassThroughFilter {
class Filter : public Logger::Loggable<Logger::Id::filter>, public Http::PassThroughFilter {
public:
Filter(FilterConfigSharedPtr config) : config_(config) {}
Filter(FilterConfigSharedPtr config) : config_(config) {
ENVOY_LOG(debug, "construct local_ratelimit filter {}", static_cast<void*>(this));
}

// Http::StreamDecoderFilter
Http::FilterHeadersStatus decodeHeaders(Http::RequestHeaderMap& headers,
Expand Down

0 comments on commit c058a54

Please sign in to comment.