From 92cee3440fed794a84394c42046b6b61c07af705 Mon Sep 17 00:00:00 2001 From: Zach Reyes <39203661+zasweq@users.noreply.github.com> Date: Fri, 12 Aug 2022 14:13:55 -0400 Subject: [PATCH] gcp/observability: Add logging filters for logging, tracing, and metrics API calls (#5582) * gcp/observability: Add logging filters for logging, tracing, and metrics API calls --- gcp/observability/logging.go | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/gcp/observability/logging.go b/gcp/observability/logging.go index f48af56997f4..8f93564353cd 100644 --- a/gcp/observability/logging.go +++ b/gcp/observability/logging.go @@ -197,12 +197,9 @@ func (l *binaryLogger) GetMethodLogger(methodName string) iblog.MethodLogger { ol = l.originalLogger.GetMethodLogger(methodName) } - // If user specify a "*" pattern, binarylog will log every single call and - // content. This means the exporting RPC's events will be captured. Even if - // we batch up the uploads in the exporting RPC, the message content of that - // RPC will be logged. Without this exclusion, we may end up with an ever - // expanding message field in log entries, and crash the process with OOM. - if methodName == "/google.logging.v2.LoggingServiceV2/WriteLogEntries" { + // Prevent logging from logging, traces, and metrics API calls. + if strings.HasPrefix(methodName, "/google.logging.v2.LoggingServiceV2/") || strings.HasPrefix(methodName, "/google.monitoring.v3.MetricService/") || + strings.HasPrefix(methodName, "/google.devtools.cloudtrace.v2.TraceService/") { return ol }