-
Notifications
You must be signed in to change notification settings - Fork 4.9k
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
accesslog: implement TCP gRPC access logger #7941
Changes from 8 commits
3973210
9859e92
3b19dee
b10b4f4
0b9937e
24a4f03
f64a630
6920deb
0be589b
41f6fd9
b620d54
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -28,10 +28,12 @@ option (gogoproto.stable_marshaler_all) = true; | |
// Fields describing *upstream* interaction will explicitly include ``upstream`` | ||
// in their name. | ||
|
||
// [#not-implemented-hide:] | ||
message TCPAccessLogEntry { | ||
// Common properties shared by all Envoy access logs. | ||
AccessLogCommon common_properties = 1; | ||
|
||
// Properties of the TCP connection. | ||
ConnectionProperties connection_properties = 2; | ||
} | ||
|
||
message HTTPAccessLogEntry { | ||
|
@@ -54,6 +56,15 @@ message HTTPAccessLogEntry { | |
HTTPResponseProperties response = 4; | ||
} | ||
|
||
// Defines fields for a connection | ||
message ConnectionProperties { | ||
// Number of bytes received from downstream. | ||
uint64 bytes_received = 1; | ||
|
||
// Number of bytes sent to downstream. | ||
uint64 bytes_sent = 2; | ||
} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Have we thought at all about incremental logging for long-lived TCP streams? I realize this is also an issue for long-lived HTTP sessions, just curious what the long-term direction is going to be here. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Istio would find this quite useful. Currently, we run a timer and report on connection open/close/timer-firing. I think this might need a change in the filter API though (something like There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes I thought about the incremental logging when I added implementation of this, though that is orthogonal to this PR. And it requires invasive change to There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can you file some tracking issue for this? Thanks. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
|
||
// Defines fields that are shared by all Envoy access logs. | ||
message AccessLogCommon { | ||
// [#not-implemented-hide:] | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
#include "extensions/access_loggers/grpc/config_utils.h" | ||
|
||
#include "envoy/singleton/manager.h" | ||
|
||
namespace Envoy { | ||
namespace Extensions { | ||
namespace AccessLoggers { | ||
namespace GrpcCommon { | ||
|
||
// Singleton registration via macro defined in envoy/singleton/manager.h | ||
SINGLETON_MANAGER_REGISTRATION(grpc_access_logger_cache); | ||
|
||
std::shared_ptr<GrpcCommon::GrpcAccessLoggerCache> | ||
getGrpcAccessLoggerCacheSingleton(Server::Configuration::FactoryContext& context) { | ||
return context.singletonManager().getTyped<GrpcCommon::GrpcAccessLoggerCache>( | ||
SINGLETON_MANAGER_REGISTERED_NAME(grpc_access_logger_cache), [&context] { | ||
return std::make_shared<GrpcCommon::GrpcAccessLoggerCacheImpl>( | ||
context.clusterManager().grpcAsyncClientManager(), context.scope(), | ||
context.threadLocal(), context.localInfo()); | ||
}); | ||
} | ||
} // namespace GrpcCommon | ||
} // namespace AccessLoggers | ||
} // namespace Extensions | ||
} // namespace Envoy |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
#pragma once | ||
|
||
#include "envoy/server/filter_config.h" | ||
|
||
#include "extensions/access_loggers/grpc/grpc_access_log_impl.h" | ||
|
||
namespace Envoy { | ||
namespace Extensions { | ||
namespace AccessLoggers { | ||
namespace GrpcCommon { | ||
|
||
GrpcAccessLoggerCacheSharedPtr | ||
getGrpcAccessLoggerCacheSingleton(Server::Configuration::FactoryContext& context); | ||
|
||
} // namespace GrpcCommon | ||
} // namespace AccessLoggers | ||
} // namespace Extensions | ||
} // namespace Envoy |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we switch the naming of these fields to
<foo>_bytes
? This would make it consistent with other bytes quantity fields in this file.