envoy icon indicating copy to clipboard operation
envoy copied to clipboard

OTel AccessLogger: support log_written/dropped for OTel partial rejected log records

Open TAOXUY opened this issue 1 year ago • 3 comments

This PR makes the OTel access logger to support log_written/log_dropped tracking

  • failed gRPC requests
  • partial rejected log entries, which is supported by OTel protocol

Context:

  • After https://github.com/envoyproxy/envoy/pull/24268, OTel AccessLogger uses unary async client.
  • The current log_written/log_dropped tracked in GrpcAccessLogger doesn't make sense for unary gRPC client, which always increment log_written for each incoming log entry. It couldn't record the 2 cases mentioned above.

What this PR contains:

  • move grpc access loggers clients to a new file and make them DI for GrpcAccessLogger
  • for unary async case, move log_written/log_dropped from GrpcAccessLogger to OpenTelemetry::GrpcAccessLoggerImpl while no changes for streaming case.
  • add an AsyncUnaryRequestCallbacks so that it can record the number of log entries on the fly and record correctly in the callback

TAOXUY avatar May 10 '24 06:05 TAOXUY

could you take a look at the format error please @TAOXUY

ERROR: ./source/extensions/access_loggers/common/grpc_access_logger.h:108: Don't use std::optional; use absl::optional instead

https://dev.azure.com/cncf/envoy/_build/results?buildId=170151&view=logs&j=c7de00aa-b0fb-52ba-707b-da6afd918eda&t=449299ab-9da3-5c6b-afe3-e0c5dbf1dfd1&l=58

phlax avatar May 10 '24 09:05 phlax

could you take a look at the format error please @TAOXUY

ERROR: ./source/extensions/access_loggers/common/grpc_access_logger.h:108: Don't use std::optional; use absl::optional instead

https://dev.azure.com/cncf/envoy/_build/results?buildId=170151&view=logs&j=c7de00aa-b0fb-52ba-707b-da6afd918eda&t=449299ab-9da3-5c6b-afe3-e0c5dbf1dfd1&l=58

Done. Thank!

TAOXUY avatar May 10 '24 15:05 TAOXUY

/wait-any

wbpcode avatar May 14 '24 02:05 wbpcode

The change does not build: https://source.cloud.google.com/results/invocations/53d8338b-909c-4f57-b0d7-e4bfd267524c

yanavlasov avatar May 16 '24 17:05 yanavlasov

/wait

yanavlasov avatar May 16 '24 17:05 yanavlasov

Details

Fixed.

TAOXUY avatar May 16 '24 17:05 TAOXUY