Skip to content
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
Original file line number Diff line number Diff line change
Expand Up @@ -469,18 +469,8 @@ HttpConnectionManagerConfig::HttpConnectionManagerConfig(
// Listener level traffic direction overrides the operation name
switch (context.direction()) {
case envoy::config::core::v3::UNSPECIFIED: {
switch (tracing_config.hidden_envoy_deprecated_operation_name()) {
case envoy::extensions::filters::network::http_connection_manager::v3::HttpConnectionManager::
Tracing::INGRESS:
tracing_operation_name = Tracing::OperationName::Ingress;
break;
case envoy::extensions::filters::network::http_connection_manager::v3::HttpConnectionManager::
Tracing::EGRESS:
tracing_operation_name = Tracing::OperationName::Egress;
break;
default:
NOT_REACHED_GCOVR_EXCL_LINE;
}
// Continuing legacy behavior; if unspecified, we treat this as ingress.
tracing_operation_name = Tracing::OperationName::Ingress;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Arguably we could throw on unspecified? Before we'd require now deprecated config or crash.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

I think before this was an enum, so it would have defaulted to ingress (default enum value).

break;
}
case envoy::config::core::v3::INBOUND:
Expand All @@ -494,13 +484,6 @@ HttpConnectionManagerConfig::HttpConnectionManagerConfig(
}

Tracing::CustomTagMap custom_tags;
for (const std::string& header :
tracing_config.hidden_envoy_deprecated_request_headers_for_tags()) {
envoy::type::tracing::v3::CustomTag::Header headerTag;
headerTag.set_name(header);
custom_tags.emplace(
header, std::make_shared<const Tracing::RequestHeaderCustomTag>(header, headerTag));
}
for (const auto& tag : tracing_config.custom_tags()) {
custom_tags.emplace(tag.tag(), Tracing::HttpTracerUtility::createCustomTag(tag));
}
Expand Down Expand Up @@ -661,11 +644,7 @@ void HttpConnectionManagerConfig::processFilter(
ENVOY_LOG(debug, " name: {}", filter_config_provider->name());
ENVOY_LOG(debug, " config: {}",
MessageUtil::getJsonStringFromMessageOrError(
proto_config.has_typed_config()
? static_cast<const Protobuf::Message&>(proto_config.typed_config())
: static_cast<const Protobuf::Message&>(
proto_config.hidden_envoy_deprecated_config()),
true));
static_cast<const Protobuf::Message&>(proto_config.typed_config()), true));
filter_factories.push_back(std::move(filter_config_provider));
}

Expand Down
15 changes: 3 additions & 12 deletions source/server/listener_manager_impl.cc
Original file line number Diff line number Diff line change
Expand Up @@ -87,10 +87,7 @@ std::vector<Network::FilterFactoryCb> ProdListenerComponentFactory::createNetwor
ENVOY_LOG(debug, " name: {}", proto_config.name());
ENVOY_LOG(debug, " config: {}",
MessageUtil::getJsonStringFromMessageOrError(
proto_config.has_typed_config()
? static_cast<const Protobuf::Message&>(proto_config.typed_config())
: static_cast<const Protobuf::Message&>(
proto_config.hidden_envoy_deprecated_config())));
static_cast<const Protobuf::Message&>(proto_config.typed_config())));

// Now see if there is a factory that will accept the config.
auto& factory =
Expand Down Expand Up @@ -121,10 +118,7 @@ ProdListenerComponentFactory::createListenerFilterFactoryList_(
ENVOY_LOG(debug, " name: {}", proto_config.name());
ENVOY_LOG(debug, " config: {}",
MessageUtil::getJsonStringFromMessageOrError(
proto_config.has_typed_config()
? static_cast<const Protobuf::Message&>(proto_config.typed_config())
: static_cast<const Protobuf::Message&>(
proto_config.hidden_envoy_deprecated_config())));
static_cast<const Protobuf::Message&>(proto_config.typed_config())));

// Now see if there is a factory that will accept the config.
auto& factory =
Expand All @@ -149,10 +143,7 @@ ProdListenerComponentFactory::createUdpListenerFilterFactoryList_(
ENVOY_LOG(debug, " name: {}", proto_config.name());
ENVOY_LOG(debug, " config: {}",
MessageUtil::getJsonStringFromMessageOrError(
proto_config.has_typed_config()
? static_cast<const Protobuf::Message&>(proto_config.typed_config())
: static_cast<const Protobuf::Message&>(
proto_config.hidden_envoy_deprecated_config())));
static_cast<const Protobuf::Message&>(proto_config.typed_config())));

// Now see if there is a factory that will accept the config.
auto& factory =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -499,85 +499,6 @@ stat_prefix: router
}
}

TEST_F(HttpConnectionManagerConfigTest, DEPRECATED_FEATURE_TEST(RequestHeaderForTagsConfig)) {
TestDeprecatedV2Api _deprecated_v2_api;
const std::string yaml_string = R"EOF(
stat_prefix: router
route_config:
name: local_route
tracing:
request_headers_for_tags:
- foo
)EOF";
HttpConnectionManagerConfig config(parseHttpConnectionManagerFromYaml(yaml_string, false),
context_, date_provider_, route_config_provider_manager_,
scoped_routes_config_provider_manager_, http_tracer_manager_,
filter_config_provider_manager_);

const Tracing::CustomTagMap& custom_tag_map = config.tracingConfig()->custom_tags_;
const Tracing::RequestHeaderCustomTag* foo = dynamic_cast<const Tracing::RequestHeaderCustomTag*>(
custom_tag_map.find("foo")->second.get());
EXPECT_NE(foo, nullptr);
EXPECT_EQ(foo->tag(), "foo");
}

TEST_F(HttpConnectionManagerConfigTest,
DEPRECATED_FEATURE_TEST(ListenerDirectionOutboundOverride)) {
TestDeprecatedV2Api _deprecated_v2_api;
const std::string yaml_string = R"EOF(
stat_prefix: router
route_config:
virtual_hosts:
- name: service
domains:
- "*"
routes:
- match:
prefix: "/"
route:
cluster: cluster
tracing:
operation_name: ingress
http_filters:
- name: envoy.filters.http.router
)EOF";

ON_CALL(context_, direction()).WillByDefault(Return(envoy::config::core::v3::OUTBOUND));
HttpConnectionManagerConfig config(parseHttpConnectionManagerFromYaml(yaml_string, false),
context_, date_provider_, route_config_provider_manager_,
scoped_routes_config_provider_manager_, http_tracer_manager_,
filter_config_provider_manager_);
EXPECT_EQ(Tracing::OperationName::Egress, config.tracingConfig()->operation_name_);
}

TEST_F(HttpConnectionManagerConfigTest, DEPRECATED_FEATURE_TEST(ListenerDirectionInboundOverride)) {
TestDeprecatedV2Api _deprecated_v2_api;
const std::string yaml_string = R"EOF(
stat_prefix: router
route_config:
virtual_hosts:
- name: service
domains:
- "*"
routes:
- match:
prefix: "/"
route:
cluster: cluster
tracing:
operation_name: egress
http_filters:
- name: envoy.filters.http.router
)EOF";

ON_CALL(context_, direction()).WillByDefault(Return(envoy::config::core::v3::INBOUND));
HttpConnectionManagerConfig config(parseHttpConnectionManagerFromYaml(yaml_string, false),
context_, date_provider_, route_config_provider_manager_,
scoped_routes_config_provider_manager_, http_tracer_manager_,
filter_config_provider_manager_);
EXPECT_EQ(Tracing::OperationName::Ingress, config.tracingConfig()->operation_name_);
}

TEST_F(HttpConnectionManagerConfigTest, SamplingDefault) {
const std::string yaml_string = R"EOF(
stat_prefix: ingress_http
Expand Down