envoyproxy/envoy

Missing timing information for TCP accesslog

Open

#38.722 aperta il 12 mar 2025

Vedi su GitHub
 (3 commenti) (0 reazioni) (0 assegnatari)C++ (5373 fork)batch import
enhancementhelp wanted

Metriche repository

Star
 (27.997 star)
Metriche merge PR
 (Merge medio 8g) (378 PR mergiate in 30 g)

Descrizione

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

Guida contributor