Skip to content

Extract request info to a class#2615

Closed
bianpengyuan wants to merge 1 commit intoistio:masterfrom
bianpengyuan:logging-label
Closed

Extract request info to a class#2615
bianpengyuan wants to merge 1 commit intoistio:masterfrom
bianpengyuan:logging-label

Conversation

@bianpengyuan
Copy link
Copy Markdown
Contributor

Extract out request info to a separate class, which lazily load request attributes. It uses a request info proto to cache the attributes that are already fetched from host. This is to avoid unnecessary copy if some filters want to use a subset of attributes. This change also added some attributes that are useful for access logging. The request info protocol does not schematize any thing. It is just an internal proto to keep track of fetched attributes.

To minimize the diff, this code change has some duplicated code from context.cc. �They will be cleaned up when real usage is added. Usage of this class is like master...bianpengyuan:n

@bianpengyuan bianpengyuan requested review from a team, kyessenov and mandarjog December 30, 2019 19:34
@googlebot googlebot added the cla: yes Set by the Google CLA bot to indicate the author of a PR has signed the Google CLA. label Dec 30, 2019
@istio-testing istio-testing added the size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. label Dec 30, 2019
@bianpengyuan
Copy link
Copy Markdown
Contributor Author

@mandarjog @kyessenov May I get some feedback on this? This is more like an intermediate state before CEL is added. Without this, log will be useless since not enough information is fetched from host.

@bianpengyuan
Copy link
Copy Markdown
Contributor Author

istio/istio#19705

@mandarjog mandarjog requested a review from gargnupur January 10, 2020 19:47
namespace {

// Extract service name from service host.
void extractServiceName(const std::string& host,
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.

Is this new code or only moved around?

}

const std::string& RequestInfoImpl::urlPath() {
if (!request_info_.has_url_path()) {
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.

What is this call fails?

return;
}

auto namespace_pos = host.find_first_of(".:", name_pos + 1);
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.

Can you add low level unit tests for request_info.cc?

Which part specifically fix the SD log correlation issues?

@bianpengyuan
Copy link
Copy Markdown
Contributor Author

Superseded by #2625

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cla: yes Set by the Google CLA bot to indicate the author of a PR has signed the Google CLA. size/XL Denotes a PR that changes 500-999 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants