[access log] Refactor gRPC access logger to support log sinks with different proto messages#14175
Merged
yanavlasov merged 2 commits intoenvoyproxy:masterfrom Dec 2, 2020
Merged
Conversation
… messages Signed-off-by: Yan Avlasov <yavlasov@google.com>
itamarkam
reviewed
Nov 25, 2020
| * Interface for an access logger. The logger provides abstraction on top of gRPC stream, deals with | ||
| * reconnects and performs batching. | ||
| */ | ||
| template <typename HttpLogProto, typename TcpLogProto> class GrpcAccessLogger { |
Contributor
There was a problem hiding this comment.
I don't mean to hijack this review, I was just curious to see how you templated all of this -
Does it make sense to also split the TCP and HTTP logging?
There's nothing specific to HTTP/TCP in this interface and it would allow creating a logger that does only one of the two.
Contributor
Author
There was a problem hiding this comment.
We can not split it as such but we can provide partial specialization for the GrpcAccessLogger that has only one log method, instead of two. There is currently no use case for it now, but it can be added as part of adding OLTP logger if it only supports logging one type of log entry.
template <typename LogProto> class GrpcAccessLogger<LogProto, void> {
public:
using SharedPtr = std::shared_ptr<GrpcAccessLogger>;
virtual ~GrpcAccessLogger() = default;
/**
* Log access entry.
* @param entry supplies the access log to send.
*/
virtual void log(LogProto&& entry) PURE;
};Signed-off-by: Yan Avlasov <yavlasov@google.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Commit Message:
Refactor gRPC access logger to support log sinks with different proto messages
Additional Description:
This is pre-requisite change for adding OTLP access logger. This change refactors functionality common to all gRPC loggers into a set of template classes parameterized with protos of log entries and gRPC request and response messages.
Refactored functionality:
As the OTLP access logger is being added these classes may be modified and more of the shared code may be moved.
Risk Level: Low (refactor)
Testing: Unit and Integration Test
Docs Changes: N/A
Release Notes: N/A
Platform Specific Features: None
Part of #13801
Signed-off-by: Yan Avlasov yavlasov@google.com