Skip to content

Commit

Permalink
gcp/observability: Add logging filters for logging, tracing, and metr…
Browse files Browse the repository at this point in the history
…ics API calls (#5582)

* gcp/observability: Add logging filters for logging, tracing, and metrics API calls
  • Loading branch information
zasweq authored Aug 12, 2022
1 parent c7fe135 commit 92cee34
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions gcp/observability/logging.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand Down

0 comments on commit 92cee34

Please sign in to comment.