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

config: added gRPC-based filter to access_log #5682

Merged
merged 43 commits into from
Feb 12, 2019
Merged

config: added gRPC-based filter to access_log #5682

merged 43 commits into from
Feb 12, 2019

Conversation

crockeo
Copy link
Contributor

@crockeo crockeo commented Jan 22, 2019

Description: Creates an access log filter named GrpcStatusFilter that allows a set of configured gRPC statuses to be passed though from logging.

Risk Level: Medium, adds a new filter.

Testing: Added unit tests to //test/common/access_log:access_log_impl_test.

Docs Changes: Autogenerated docs changes from comments in //api/envoy/config/filter/accesslog/v2/accesslog.proto

Release Notes:
Fixes #5567

Signed-off-by: Cerek Hillen <cerekh@gmail.com>
Signed-off-by: Cerek Hillen <cerekh@gmail.com>
Signed-off-by: Cerek Hillen <cerekh@gmail.com>
Signed-off-by: Cerek Hillen <cerekh@gmail.com>
Signed-off-by: Cerek Hillen <cerekh@gmail.com>
Signed-off-by: Cerek Hillen <cerekh@gmail.com>
Signed-off-by: Cerek Hillen <cerekh@gmail.com>
… to work on response trailers

Signed-off-by: Cerek Hillen <cerekh@gmail.com>
@junr03 junr03 self-assigned this Jan 22, 2019
Copy link
Member

@venilnoronha venilnoronha left a comment

Choose a reason for hiding this comment

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

Thanks for contributing!

api/envoy/config/filter/accesslog/v2/accesslog.proto Outdated Show resolved Hide resolved
source/common/access_log/access_log_impl.h Outdated Show resolved Hide resolved
source/common/access_log/access_log_impl.h Outdated Show resolved Hide resolved
source/common/grpc/status.cc Outdated Show resolved Hide resolved
source/common/grpc/status.cc Outdated Show resolved Hide resolved
source/common/grpc/status.h Outdated Show resolved Hide resolved
Signed-off-by: Cerek Hillen <cerekh@gmail.com>
Signed-off-by: Cerek Hillen <cerekh@gmail.com>
Signed-off-by: Cerek Hillen <cerekh@gmail.com>
… the HTTP status

Signed-off-by: Cerek Hillen <cerekh@gmail.com>
@crockeo
Copy link
Contributor Author

crockeo commented Jan 23, 2019

@venilnoronha I added a test to check on valid HTTP to gRPC status code mappings for those specified in the gRPC specification. There is also an entry to check that HTTP status code 200 is not errantly mapped to gRPC status code ok. Should I also add tests for all of the other HTTP status codes?

Copy link
Member

@junr03 junr03 left a comment

Choose a reason for hiding this comment

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

Thanks for working on this! A few changes, a test addition, and an idea.

api/envoy/config/filter/accesslog/v2/accesslog.proto Outdated Show resolved Hide resolved
include/envoy/grpc/status.h Show resolved Hide resolved
source/common/access_log/access_log_impl.h Outdated Show resolved Hide resolved
source/common/grpc/status.cc Outdated Show resolved Hide resolved
@crockeo
Copy link
Contributor Author

crockeo commented Jan 23, 2019

I mentioned this in a comment on the original issue, but is there a canonical way to target an individual build (e.g. //test/common/access_log/access_log_impl_test.h) through the CI tools? A full build takes prohibitively long, but I keep running into issues where clang compiles, and g++ doesn't.

@venilnoronha
Copy link
Member

… to pair, both to prevent g++ compiler errors.

Signed-off-by: Cerek Hillen <cerekh@gmail.com>
@crockeo
Copy link
Contributor Author

crockeo commented Jan 24, 2019

Thanks @venilnoronha! That's how I've been running my tests, but I don't see anything on specifically instructing Bazel to use a certain compiler.

I checked in //bazel/cc_configure.bzl and it looks like it should use the CXX compiler variable, but I installed g++, ran CXX=<path to G++> bazel test ... and still wasn't able to get it working. I'll give it another shot at some point.

For now I'm just checking specific features (e.g. constructing std::tuple through uniform initialization) across different compilers before I add them to the codebase.

Signed-off-by: Cerek Hillen <cerekh@gmail.com>
…the filter will infer UNKNOWN

Signed-off-by: Cerek Hillen <cerekh@gmail.com>
Signed-off-by: Cerek Hillen <cerekh@gmail.com>
Signed-off-by: Cerek Hillen <cerekh@gmail.com>
api/envoy/config/filter/accesslog/v2/accesslog.proto Outdated Show resolved Hide resolved
source/common/access_log/access_log_impl.cc Outdated Show resolved Hide resolved
Signed-off-by: Cerek Hillen <cerekh@gmail.com>
Signed-off-by: Cerek Hillen <cerekh@gmail.com>
Copy link
Member

@venilnoronha venilnoronha left a comment

Choose a reason for hiding this comment

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

Looks much better. I was wondering if you could add a test for exclude: false?

source/common/access_log/access_log_impl.cc Show resolved Hide resolved
Signed-off-by: Cerek Hillen <cerekh@gmail.com>
@crockeo
Copy link
Contributor Author

crockeo commented Feb 5, 2019

Forgot that the updated CI scripts needed to be merged 😄

@mattklein123 mattklein123 self-assigned this Feb 5, 2019
lizan
lizan previously approved these changes Feb 6, 2019
Copy link
Member

@lizan lizan left a comment

Choose a reason for hiding this comment

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

LGTM modulo one nit

test/common/access_log/access_log_impl_test.cc Outdated Show resolved Hide resolved
@lizan lizan added the waiting label Feb 6, 2019
Signed-off-by: Cerek Hillen <cerekh@gmail.com>
@crockeo
Copy link
Contributor Author

crockeo commented Feb 7, 2019

@junr03 I think this PR is ready for a final check.

lizan
lizan previously approved these changes Feb 12, 2019
Copy link
Member

@mattklein123 mattklein123 left a comment

Choose a reason for hiding this comment

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

Very nice. 2 small requests than LGTM. Thank you!

/wait

source/common/access_log/access_log_impl.cc Outdated Show resolved Hide resolved
Signed-off-by: Cerek Hillen <cerekh@gmail.com>
Signed-off-by: Cerek Hillen <cerekh@gmail.com>
junr03
junr03 previously approved these changes Feb 12, 2019
@junr03 junr03 dismissed their stale review February 12, 2019 18:08

clicked button by accident

@junr03
Copy link
Member

junr03 commented Feb 12, 2019

@crockeo looks like the mac failure is valid, and there is now a conflict with the release doc.

@crockeo
Copy link
Contributor Author

crockeo commented Feb 12, 2019

I'll fix the conflict and also look into the mac failure.

Signed-off-by: Cerek Hillen <cerekh@gmail.com>
Copy link
Member

@mattklein123 mattklein123 left a comment

Choose a reason for hiding this comment

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

LGTM pending fixes.

Signed-off-by: Cerek Hillen <cerekh@gmail.com>
Grpc::Utility::httpToGrpcStatus(info.responseCode().value()))
: absl::nullopt,
};
const std::array<absl::optional<Grpc::Status::GrpcStatus>, 3> optional_statuses = {{
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I couldn't repro compile errors locally, but it looked like it was expecting braces around each individual object in the array. To do so I needed to add the double brace around the entire initializer list.

Let me know if there's a better way to do it.

Copy link
Member

@mattklein123 mattklein123 left a comment

Choose a reason for hiding this comment

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

Nice!

@mattklein123 mattklein123 merged commit a5e6ed7 into envoyproxy:master Feb 12, 2019
@crockeo crockeo deleted the dev branch February 12, 2019 23:21
fredlas pushed a commit to fredlas/envoy that referenced this pull request Mar 5, 2019
Signed-off-by: Cerek Hillen <cerekh@gmail.com>
Signed-off-by: Fred Douglas <fredlas@google.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

grpc: add status access log filter
7 participants