Missing timing information for TCP accesslog
- Dominant language
- C++
- Stars
- 28.9k
- Forks
- 5.6k
- Avg merge
- 1d 22h
- Merged PRs (30d)
- 430
Description
*Title*: *As titled*
*Description*:
We have these fields defined in the accesslog common properties.
- `time_to_last_rx_byte`
- `time_to_first_upstream_tx_byte`
- `time_to_last_upstream_tx_byte`
- `time_to_first_upstream_rx_byte`
- `time_to_last_upstream_rx_byte`
- `time_to_first_downstream_tx_byte`
However using a configuration with listener level grpc accesslog, along with tcp proxy, and then setup the gRPC accesslog server in go, I see `nil` for all these attributes.
This will be useful for envoyproxy used a TCP proxy and debugging lots of connection termination details.
```
fmt.Printf("the connection: common.GetTimeToLastRxByte() %v, common.GetTimeToFirstDownstreamTxByte() %v,\n"+
"common.GetTimeToLastDownstreamTxByte() %v, common.GetTimeToFirstUpstreamRxByte() %v\n,"+
"common.GetTimeToLastUpstreamRxByte() %v, common.GetTimeToFirstUpstreamTxByte() %v, common.GetTimeToLastUpstreamTxByte() %v\n",
common.GetTimeToLastRxByte(), common.GetTimeToFirstDownstreamTxByte(),
common.GetTimeToLastDownstreamTxByte(), common.GetTimeToFirstUpstreamRxByte(), common.GetTimeToLastUpstreamRxByte(),
common.GetTimeToFirstUpstreamTxByte(), common.GetTimeToLastUpstreamTxByte(),
)
```
Checking code, looks like function `onUpstreamTxByteSent` is only invoked on router/generic proxy router filter, rather than tcp proxy filter. probably adding such invocation in the tcp_proxy filter's `onUpstreamData/onData` can be added to fill in these information.
## Appendix
envoy config.
```
listeners:
- address:
socket_address:
address: 0.0.0.0
port_value: 8090
access_log:
- name: envoy.tcp_grpc_access_log
typed_config:
"@type": type.googleapis.com/envoy.extensions.access_loggers.grpc.v3.TcpGrpcAccessLogConfig
common_config:
log_name: accesslog
grpc_service:
envoy_grpc:
cluster_name: ch-accesslog
transport_api_version: V3
filter_chains:
- filters:
- name: envoy.filters.network.tcp_proxy
typed_config:
"@type": type.googleapis.com/envoy.extensions.filters.network.tcp_proxy.v3.TcpProxy
stat_prefix: tcp
cluster: clickhouse_tcp
```
Contributor guide
Assessment
This issue has not been assessed yet.