From af191b05d00f826f841ae784c54c6046d53cec08 Mon Sep 17 00:00:00 2001 From: Lidi Zheng Date: Wed, 16 Mar 2022 16:31:38 -0700 Subject: [PATCH 01/23] feat: implement grpc-observability logging via binarylog * Includes generalized MethodConfig * Includes updated config definition * Includes custom tags and location tags --- observability/config.go | 80 ++ observability/exporting.go | 146 +++ observability/go.mod | 15 + observability/go.sum | 462 ++++++++++ observability/internal/config/config.pb.go | 315 +++++++ observability/internal/config/config.proto | 69 ++ observability/internal/logging/logging.pb.go | 914 +++++++++++++++++++ observability/internal/logging/logging.proto | 153 ++++ observability/logging.go | 271 ++++++ observability/observability.go | 83 ++ observability/observability_test.go | 505 ++++++++++ observability/tags.go | 41 + observability/tags_test.go | 64 ++ 13 files changed, 3118 insertions(+) create mode 100644 observability/config.go create mode 100644 observability/exporting.go create mode 100644 observability/go.mod create mode 100644 observability/go.sum create mode 100644 observability/internal/config/config.pb.go create mode 100644 observability/internal/config/config.proto create mode 100644 observability/internal/logging/logging.pb.go create mode 100644 observability/internal/logging/logging.proto create mode 100644 observability/logging.go create mode 100644 observability/observability.go create mode 100644 observability/observability_test.go create mode 100644 observability/tags.go create mode 100644 observability/tags_test.go diff --git a/observability/config.go b/observability/config.go new file mode 100644 index 00000000000..bb861713fbb --- /dev/null +++ b/observability/config.go @@ -0,0 +1,80 @@ +/* + * + * Copyright 2022 gRPC authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +package observability + +import ( + "context" + "os" + + gcplogging "cloud.google.com/go/logging" + "golang.org/x/oauth2/google" + configpb "google.golang.org/grpc/observability/internal/config" + "google.golang.org/protobuf/encoding/protojson" +) + +const ( + envObservabilityConfig = "GRPC_CONFIG_OBSERVABILITY" + envProjectID = "GOOGLE_CLOUD_PROJECT" +) + +// fetchDefaultProjectID fetches the default GCP project id from environment. +func fetchDefaultProjectID(ctx context.Context) string { + // Step 1: Check ENV var + if s := os.Getenv(envProjectID); s != "" { + logger.Infof("Found project ID from env %v: %v", envProjectID, s) + return s + } + // Step 2: Check default credential + credentials, err := google.FindDefaultCredentials(ctx, gcplogging.WriteScope) + if err != nil { + logger.Infof("Failed to locate Google Default Credential: %v", err) + return "" + } + if credentials.ProjectID == "" { + logger.Infof("Failed to find project ID in default credential: %v", err) + return "" + } + logger.Infof("Found project ID from Google Default Credential: %v", credentials.ProjectID) + return credentials.ProjectID +} + +func parseObservabilityConfig() *configpb.ObservabilityConfig { + // Parse the config from ENV var + if content := os.Getenv(envObservabilityConfig); content != "" { + var config configpb.ObservabilityConfig + if err := protojson.Unmarshal([]byte(content), &config); err != nil { + logger.Warningf("Error parsing observability config from env %v: %v", envObservabilityConfig, err) + return nil + } + logger.Infof("Parsed ObservabilityConfig: %+v", &config) + return &config + } + // If the ENV var doesn't exist, do nothing + return nil +} + +func maybeUpdateProjectIDInObservabilityConfig(ctx context.Context, config *configpb.ObservabilityConfig) { + if config == nil { + return + } + if config.GetDestinationProjectId() == "" { + // Try to fetch the GCP project id + config.DestinationProjectId = fetchDefaultProjectID(ctx) + } +} diff --git a/observability/exporting.go b/observability/exporting.go new file mode 100644 index 00000000000..26e83f05187 --- /dev/null +++ b/observability/exporting.go @@ -0,0 +1,146 @@ +/* + * + * Copyright 2022 gRPC authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +package observability + +import ( + "context" + "encoding/json" + "fmt" + "os" + + gcplogging "cloud.google.com/go/logging" + grpclogrecordpb "google.golang.org/grpc/observability/internal/logging" + "google.golang.org/protobuf/encoding/protojson" +) + +// loggingExporter is the interface of logging exporter for gRPC Observability. +// In future, we might expose this to allow users provide custom exporters. But +// now, it exists for testing purposes. +type loggingExporter interface { + // EmitGrpcLogRecord writes a gRPC LogRecord to cache without blocking. + EmitGrpcLogRecord(*grpclogrecordpb.GrpcLogRecord) + // Close flushes all pending data and closes the exporter. + Close() error +} + +// globalLoggingExporter is the global logging exporter, may be nil. +var globalLoggingExporter loggingExporter + +type cloudLoggingExporter struct { + projectID string + client *gcplogging.Client + logger *gcplogging.Logger +} + +func newCloudLoggingExporter(ctx context.Context, projectID string) (*cloudLoggingExporter, error) { + c, err := gcplogging.NewClient(ctx, fmt.Sprintf("projects/%v", projectID)) + if err != nil { + return nil, fmt.Errorf("failed to create cloudLoggingExporter: %v", err) + } + defer logger.Infof("Successfully created cloudLoggingExporter") + customTags := getCustomTags(os.Environ()) + if len(customTags) != 0 { + logger.Infof("Adding custom tags: %+v", customTags) + } + return &cloudLoggingExporter{ + projectID: projectID, + client: c, + logger: c.Logger("grpc", gcplogging.CommonLabels(customTags)), + }, nil +} + +// mapLogLevelToSeverity maps the gRPC defined log level to Cloud Logging's +// Severity. The canonical definition can be found at +// https://cloud.google.com/logging/docs/reference/v2/rest/v2/LogEntry#LogSeverity. +var logLevelToSeverity = map[grpclogrecordpb.GrpcLogRecord_LogLevel]gcplogging.Severity{ + grpclogrecordpb.GrpcLogRecord_LOG_LEVEL_UNKNOWN: 0, + grpclogrecordpb.GrpcLogRecord_LOG_LEVEL_TRACE: 100, // Cloud Logging doesn't have a trace level, treated as DEBUG. + grpclogrecordpb.GrpcLogRecord_LOG_LEVEL_DEBUG: 100, + grpclogrecordpb.GrpcLogRecord_LOG_LEVEL_INFO: 200, + grpclogrecordpb.GrpcLogRecord_LOG_LEVEL_WARN: 400, + grpclogrecordpb.GrpcLogRecord_LOG_LEVEL_ERROR: 500, + grpclogrecordpb.GrpcLogRecord_LOG_LEVEL_CRITICAL: 600, +} + +var protoToJSONOptions = &protojson.MarshalOptions{ + UseProtoNames: true, + UseEnumNumbers: false, +} + +func (cle *cloudLoggingExporter) EmitGrpcLogRecord(l *grpclogrecordpb.GrpcLogRecord) { + // Converts the log record content to a more readable format via protojson. + // This is technically a hack, will be removed once we removed our + // dependencies to Cloud Logging SDK. + jsonBytes, err := protoToJSONOptions.Marshal(l) + if err != nil { + logger.Errorf("Unable to marshal log record: %v", l) + } + var payload map[string]interface{} + err = json.Unmarshal(jsonBytes, &payload) + if err != nil { + logger.Errorf("Unable to unmarshal bytes to JSON: %v", jsonBytes) + } + // Converts severity from log level + var severity, ok = logLevelToSeverity[l.LogLevel] + if !ok { + logger.Errorf("Invalid log level: %v", l.LogLevel) + severity = 0 + } + entry := gcplogging.Entry{ + Timestamp: l.Timestamp.AsTime(), + Severity: severity, + Payload: payload, + } + cle.logger.Log(entry) + if logger.V(2) { + logger.Infof("Uploading event to CloudLogging: %+v", entry) + } +} + +func (cle *cloudLoggingExporter) Close() error { + if cle.logger != nil { + if err := cle.logger.Flush(); err != nil { + return err + } + cle.logger = nil + } + if cle.client != nil { + if err := cle.client.Close(); err != nil { + return err + } + cle.client = nil + } + logger.Infof("Closed CloudLogging exporter") + return nil +} + +func createDefaultLoggingExporter(ctx context.Context, projectID string) error { + var err error + globalLoggingExporter, err = newCloudLoggingExporter(ctx, projectID) + return err +} + +func closeLoggingExporter() { + if globalLoggingExporter != nil { + if err := globalLoggingExporter.Close(); err != nil { + logger.Infof("Failed to close logging exporter: %v", err) + } + globalLoggingExporter = nil + } +} diff --git a/observability/go.mod b/observability/go.mod new file mode 100644 index 00000000000..1e53dc8dd93 --- /dev/null +++ b/observability/go.mod @@ -0,0 +1,15 @@ +module google.golang.org/grpc/observability + +go 1.14 + +require ( + cloud.google.com/go/logging v1.4.2 + github.com/golang/protobuf v1.5.2 + github.com/google/go-cmp v0.5.6 // indirect + github.com/google/uuid v1.3.0 + golang.org/x/oauth2 v0.0.0-20211104180415-d3ed0bb246c8 + google.golang.org/grpc v1.43.0 + google.golang.org/protobuf v1.27.1 +) + +replace google.golang.org/grpc => ../ diff --git a/observability/go.sum b/observability/go.sum new file mode 100644 index 00000000000..2343a4361d5 --- /dev/null +++ b/observability/go.sum @@ -0,0 +1,462 @@ +cloud.google.com/go v0.34.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= +cloud.google.com/go v0.38.0/go.mod h1:990N+gfupTy94rShfmMCWGDn0LpTmnzTp2qbd1dvSRU= +cloud.google.com/go v0.44.1/go.mod h1:iSa0KzasP4Uvy3f1mN/7PiObzGgflwredwwASm/v6AU= +cloud.google.com/go v0.44.2/go.mod h1:60680Gw3Yr4ikxnPRS/oxxkBccT6SA1yMk63TGekxKY= +cloud.google.com/go v0.45.1/go.mod h1:RpBamKRgapWJb87xiFSdk4g1CME7QZg3uwTez+TSTjc= +cloud.google.com/go v0.46.3/go.mod h1:a6bKKbmY7er1mI7TEI4lsAkts/mkhTSZK8w33B4RAg0= +cloud.google.com/go v0.50.0/go.mod h1:r9sluTvynVuxRIOHXQEHMFffphuXHOMZMycpNR5e6To= +cloud.google.com/go v0.52.0/go.mod h1:pXajvRH/6o3+F9jDHZWQ5PbGhn+o8w9qiu/CffaVdO4= +cloud.google.com/go v0.53.0/go.mod h1:fp/UouUEsRkN6ryDKNW/Upv/JBKnv6WDthjR6+vze6M= +cloud.google.com/go v0.54.0/go.mod h1:1rq2OEkV3YMf6n/9ZvGWI3GWw0VoqH/1x2nd8Is/bPc= +cloud.google.com/go v0.56.0/go.mod h1:jr7tqZxxKOVYizybht9+26Z/gUq7tiRzu+ACVAMbKVk= +cloud.google.com/go v0.57.0/go.mod h1:oXiQ6Rzq3RAkkY7N6t3TcE6jE+CIBBbA36lwQ1JyzZs= +cloud.google.com/go v0.62.0/go.mod h1:jmCYTdRCQuc1PHIIJ/maLInMho30T/Y0M4hTdTShOYc= +cloud.google.com/go v0.65.0/go.mod h1:O5N8zS7uWy9vkA9vayVHs65eM1ubvY4h553ofrNHObY= +cloud.google.com/go v0.72.0/go.mod h1:M+5Vjvlc2wnp6tjzE102Dw08nGShTscUx2nZMufOKPI= +cloud.google.com/go v0.74.0/go.mod h1:VV1xSbzvo+9QJOxLDaJfTjx5e+MePCpCWwvftOeQmWk= +cloud.google.com/go v0.78.0/go.mod h1:QjdrLG0uq+YwhjoVOLsS1t7TW8fs36kLs4XO5R5ECHg= +cloud.google.com/go v0.79.0/go.mod h1:3bzgcEeQlzbuEAYu4mrWhKqWjmpprinYgKJLgKHnbb8= +cloud.google.com/go v0.81.0 h1:at8Tk2zUz63cLPR0JPWm5vp77pEZmzxEQBEfRKn1VV8= +cloud.google.com/go v0.81.0/go.mod h1:mk/AM35KwGk/Nm2YSeZbxXdrNK3KZOYHmLkOqC2V6E0= +cloud.google.com/go/bigquery v1.0.1/go.mod h1:i/xbL2UlR5RvWAURpBYZTtm/cXjCha9lbfbpx4poX+o= +cloud.google.com/go/bigquery v1.3.0/go.mod h1:PjpwJnslEMmckchkHFfq+HTD2DmtT67aNFKH1/VBDHE= +cloud.google.com/go/bigquery v1.4.0/go.mod h1:S8dzgnTigyfTmLBfrtrhyYhwRxG72rYxvftPBK2Dvzc= +cloud.google.com/go/bigquery v1.5.0/go.mod h1:snEHRnqQbz117VIFhE8bmtwIDY80NLUZUMb4Nv6dBIg= +cloud.google.com/go/bigquery v1.7.0/go.mod h1://okPTzCYNXSlb24MZs83e2Do+h+VXtc4gLoIoXIAPc= +cloud.google.com/go/bigquery v1.8.0/go.mod h1:J5hqkt3O0uAFnINi6JXValWIb1v0goeZM77hZzJN/fQ= +cloud.google.com/go/datastore v1.0.0/go.mod h1:LXYbyblFSglQ5pkeyhO+Qmw7ukd3C+pD7TKLgZqpHYE= +cloud.google.com/go/datastore v1.1.0/go.mod h1:umbIZjpQpHh4hmRpGhH4tLFup+FVzqBi1b3c64qFpCk= +cloud.google.com/go/logging v1.4.2 h1:Mu2Q75VBDQlW1HlBMjTX4X84UFR73G1TiLlRYc/b7tA= +cloud.google.com/go/logging v1.4.2/go.mod h1:jco9QZSx8HiVVqLJReq7z7bVdj0P1Jb9PDFs63T+axo= +cloud.google.com/go/pubsub v1.0.1/go.mod h1:R0Gpsv3s54REJCy4fxDixWD93lHJMoZTyQ2kNxGRt3I= +cloud.google.com/go/pubsub v1.1.0/go.mod h1:EwwdRX2sKPjnvnqCa270oGRyludottCI76h+R3AArQw= +cloud.google.com/go/pubsub v1.2.0/go.mod h1:jhfEVHT8odbXTkndysNHCcx0awwzvfOlguIAii9o8iA= +cloud.google.com/go/pubsub v1.3.1/go.mod h1:i+ucay31+CNRpDW4Lu78I4xXG+O1r/MAHgjpRVR+TSU= +cloud.google.com/go/storage v1.0.0/go.mod h1:IhtSnM/ZTZV8YYJWCY8RULGVqBDmpoyjwiyrjsg+URw= +cloud.google.com/go/storage v1.5.0/go.mod h1:tpKbwo567HUNpVclU5sGELwQWBDZ8gh0ZeosJ0Rtdos= +cloud.google.com/go/storage v1.6.0/go.mod h1:N7U0C8pVQ/+NIKOBQyamJIeKQKkZ+mxpohlUTyfDhBk= +cloud.google.com/go/storage v1.8.0/go.mod h1:Wv1Oy7z6Yz3DshWRJFhqM/UCfaWIRTdp0RXyy7KQOVs= +cloud.google.com/go/storage v1.10.0 h1:STgFzyU5/8miMl0//zKh2aQeTyeaUH3WN9bSUiJ09bA= +cloud.google.com/go/storage v1.10.0/go.mod h1:FLPqc6j+Ki4BU591ie1oL6qBQGu2Bl/tZ9ullr3+Kg0= +dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU= +github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= +github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo= +github.com/antihax/optional v1.0.0/go.mod h1:uupD/76wgC+ih3iEmQUL+0Ugr19nfwCT1kdvxnR2qWY= +github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= +github.com/cespare/xxhash/v2 v2.1.1/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= +github.com/chzyer/logex v1.1.10/go.mod h1:+Ywpsq7O8HXn0nuIou7OrIPyXbp3wmkHB+jjWRnGsAI= +github.com/chzyer/readline v0.0.0-20180603132655-2972be24d48e/go.mod h1:nSuG5e5PlCu98SY8svDHJxuZscDgtXS6KTTbou5AhLI= +github.com/chzyer/test v0.0.0-20180213035817-a1ea475d72b1/go.mod h1:Q3SI9o4m/ZMnBNeIyt5eFwwo7qiLfzFZmjNmxjkiQlU= +github.com/cncf/udpa/go v0.0.0-20210930031921-04548b0d99d4/go.mod h1:6pvJx4me5XPnfI9Z40ddWsdw2W/uZgQLFXToKeRcDiI= +github.com/cncf/xds/go v0.0.0-20210805033703-aa0b78936158/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= +github.com/cncf/xds/go v0.0.0-20210922020428-25de7278fc84/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= +github.com/cncf/xds/go v0.0.0-20211011173535-cb28da3451f1/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= +github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/envoyproxy/go-control-plane v0.9.10-0.20210907150352-cf90f659a021/go.mod h1:AFq3mo9L8Lqqiid3OhADV3RfLJnjiw63cSpi+fDTRC0= +github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= +github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04= +github.com/go-gl/glfw v0.0.0-20190409004039-e6da0acd62b1/go.mod h1:vR7hzQXu2zJy9AVAgeJqvqgH9Q5CA+iKCZ2gyEVpxRU= +github.com/go-gl/glfw/v3.3/glfw v0.0.0-20191125211704-12ad95a8df72/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8= +github.com/go-gl/glfw/v3.3/glfw v0.0.0-20200222043503-6f7a984d4dc4/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8= +github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= +github.com/golang/groupcache v0.0.0-20190702054246-869f871628b6/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= +github.com/golang/groupcache v0.0.0-20191227052852-215e87163ea7/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= +github.com/golang/groupcache v0.0.0-20200121045136-8c9f03a8e57e h1:1r7pUrabqp18hOBcwBwiTsbnFeTZHV9eER/QT5JVZxY= +github.com/golang/groupcache v0.0.0-20200121045136-8c9f03a8e57e/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= +github.com/golang/mock v1.2.0/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= +github.com/golang/mock v1.3.1/go.mod h1:sBzyDLLjw3U8JLTeZvSv8jJB+tU5PVekmnlKIyFUx0Y= +github.com/golang/mock v1.4.0/go.mod h1:UOMv5ysSaYNkG+OFQykRIcU/QvvxJf3p21QfJ2Bt3cw= +github.com/golang/mock v1.4.1/go.mod h1:UOMv5ysSaYNkG+OFQykRIcU/QvvxJf3p21QfJ2Bt3cw= +github.com/golang/mock v1.4.3/go.mod h1:UOMv5ysSaYNkG+OFQykRIcU/QvvxJf3p21QfJ2Bt3cw= +github.com/golang/mock v1.4.4/go.mod h1:l3mdAwkq5BuhzHwde/uurv3sEJeZMXNpwsxVWU71h+4= +github.com/golang/mock v1.5.0/go.mod h1:CWnOUgYIOo4TcNZ0wHX3YZCqsaM1I1Jvs6v3mP3KVu8= +github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= +github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= +github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= +github.com/golang/protobuf v1.3.3/go.mod h1:vzj43D7+SQXF/4pzW/hwtAqwc6iTitCiVSaWz5lYuqw= +github.com/golang/protobuf v1.3.4/go.mod h1:vzj43D7+SQXF/4pzW/hwtAqwc6iTitCiVSaWz5lYuqw= +github.com/golang/protobuf v1.3.5/go.mod h1:6O5/vntMXwX2lRkT1hjjk0nAC1IDOTvTlVgjlRvqsdk= +github.com/golang/protobuf v1.4.0-rc.1/go.mod h1:ceaxUfeHdC40wWswd/P6IGgMaK3YpKi5j83Wpe3EHw8= +github.com/golang/protobuf v1.4.0-rc.1.0.20200221234624-67d41d38c208/go.mod h1:xKAWHe0F5eneWXFV3EuXVDTCmh+JuBKY0li0aMyXATA= +github.com/golang/protobuf v1.4.0-rc.2/go.mod h1:LlEzMj4AhA7rCAGe4KMBDvJI+AwstrUpVNzEA03Pprs= +github.com/golang/protobuf v1.4.0-rc.4.0.20200313231945-b860323f09d0/go.mod h1:WU3c8KckQ9AFe+yFwt9sWVRKCVIyN9cPHBJSNnbL67w= +github.com/golang/protobuf v1.4.0/go.mod h1:jodUvKwWbYaEsadDk5Fwe5c77LiNKVO9IDvqG2KuDX0= +github.com/golang/protobuf v1.4.1/go.mod h1:U8fpvMrcmy5pZrNK1lt4xCsGvpyWQ/VVv6QDs8UjoX8= +github.com/golang/protobuf v1.4.2/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= +github.com/golang/protobuf v1.4.3/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= +github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk= +github.com/golang/protobuf v1.5.1/go.mod h1:DopwsBzvsk0Fs44TXzsVbJyPhcCPeIwnvohx4u74HPM= +github.com/golang/protobuf v1.5.2 h1:ROPKBNFfQgOUMifHyP+KYbvpjbdoFNs+aK7DXlji0Tw= +github.com/golang/protobuf v1.5.2/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= +github.com/google/btree v0.0.0-20180813153112-4030bb1f1f0c/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= +github.com/google/btree v1.0.0/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= +github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M= +github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= +github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= +github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.4.1/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.5.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.5.1/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.5.2/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.5.3/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.5.4/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.5.6 h1:BKbKCqvP6I+rmFHt06ZmyQtvB8xAkWdhFyr0ZUNZcxQ= +github.com/google/go-cmp v0.5.6/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/martian v2.1.0+incompatible h1:/CP5g8u/VJHijgedC/Legn3BAbAaWPgecwXBIDzw5no= +github.com/google/martian v2.1.0+incompatible/go.mod h1:9I4somxYTbIHy5NJKHRl3wXiIaQGbYVAs8BPL6v8lEs= +github.com/google/martian/v3 v3.0.0/go.mod h1:y5Zk1BBys9G+gd6Jrk0W3cC1+ELVxBWuIGO+w/tUAp0= +github.com/google/martian/v3 v3.1.0 h1:wCKgOCHuUEVfsaQLpPSJb7VdYCdTVZQAuOdYm1yc/60= +github.com/google/martian/v3 v3.1.0/go.mod h1:y5Zk1BBys9G+gd6Jrk0W3cC1+ELVxBWuIGO+w/tUAp0= +github.com/google/pprof v0.0.0-20181206194817-3ea8567a2e57/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc= +github.com/google/pprof v0.0.0-20190515194954-54271f7e092f/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc= +github.com/google/pprof v0.0.0-20191218002539-d4f498aebedc/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= +github.com/google/pprof v0.0.0-20200212024743-f11f1df84d12/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= +github.com/google/pprof v0.0.0-20200229191704-1ebb73c60ed3/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= +github.com/google/pprof v0.0.0-20200430221834-fc25d7d30c6d/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= +github.com/google/pprof v0.0.0-20200708004538-1a94d8640e99/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= +github.com/google/pprof v0.0.0-20201023163331-3e6fc7fc9c4c/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= +github.com/google/pprof v0.0.0-20201203190320-1bf35d6f28c2/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= +github.com/google/pprof v0.0.0-20210122040257-d980be63207e/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= +github.com/google/pprof v0.0.0-20210226084205-cbba55b83ad5/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= +github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm40UhjYkI= +github.com/google/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= +github.com/google/uuid v1.3.0 h1:t6JiXgmwXMjEs8VusXIJk2BXHsn+wx8BZdTaoZ5fu7I= +github.com/google/uuid v1.3.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= +github.com/googleapis/gax-go/v2 v2.0.4/go.mod h1:0Wqv26UfaUD9n4G6kQubkQ+KchISgw+vpHVxEJEs9eg= +github.com/googleapis/gax-go/v2 v2.0.5 h1:sjZBwGj9Jlw33ImPtvFviGYvseOtDM7hkSKB7+Tv3SM= +github.com/googleapis/gax-go/v2 v2.0.5/go.mod h1:DWXyrwAJ9X0FpwwEdw+IPEYBICEFu5mhpdKc/us6bOk= +github.com/grpc-ecosystem/grpc-gateway v1.16.0/go.mod h1:BDjrQk3hbvj6Nolgz8mAMFbcEtjT1g+wF4CSlocrBnw= +github.com/hashicorp/golang-lru v0.5.0/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= +github.com/hashicorp/golang-lru v0.5.1/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= +github.com/ianlancetaylor/demangle v0.0.0-20181102032728-5e5cf60278f6/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc= +github.com/ianlancetaylor/demangle v0.0.0-20200824232613-28f6c0f3b639/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc= +github.com/jstemmer/go-junit-report v0.0.0-20190106144839-af01ea7f8024/go.mod h1:6v2b51hI/fHJwM22ozAgKL4VKDeJcHhJFhtBdhmNjmU= +github.com/jstemmer/go-junit-report v0.9.1 h1:6QPYqodiu3GuPL+7mfx+NwDdp2eTkp9IfEUpgAwUN0o= +github.com/jstemmer/go-junit-report v0.9.1/go.mod h1:Brl9GWCQeLvo8nXZwPNNblvFj/XSXhF0NWZEnDohbsk= +github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= +github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= +github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= +github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= +github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= +github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= +github.com/rogpeppe/fastuuid v1.2.0/go.mod h1:jVj6XXZzXRy/MSR5jhDC/2q6DgLz+nrA6LYCDYWNEvQ= +github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= +github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= +github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= +github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +github.com/yuin/goldmark v1.1.25/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= +github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= +github.com/yuin/goldmark v1.1.32/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= +github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= +go.opencensus.io v0.21.0/go.mod h1:mSImk1erAIZhrmZN+AvHh14ztQfjbGwt4TtuofqLduU= +go.opencensus.io v0.22.0/go.mod h1:+kGneAE2xo2IficOXnaByMWTGM9T73dGwxeWcUqIpI8= +go.opencensus.io v0.22.2/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= +go.opencensus.io v0.22.3/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= +go.opencensus.io v0.22.4/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= +go.opencensus.io v0.22.5/go.mod h1:5pWMHQbX5EPX2/62yrJeAkowc+lfs/XD7Uxpq3pI6kk= +go.opencensus.io v0.23.0 h1:gqCw0LfLxScz8irSi8exQc7fyQ0fKQU/qnC/X8+V/1M= +go.opencensus.io v0.23.0/go.mod h1:XItmlyltB5F7CS4xOC1DcqMoFqwtC6OG2xF7mCv7P7E= +go.opentelemetry.io/proto/otlp v0.7.0/go.mod h1:PqfVotwruBrMGOCsRd/89rSnXhoiJIqeYNgFYFoEGnI= +golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= +golang.org/x/crypto v0.0.0-20190510104115-cbcb75029529/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= +golang.org/x/crypto v0.0.0-20190605123033-f99c8df09eb5/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= +golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= +golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= +golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= +golang.org/x/exp v0.0.0-20190306152737-a1d7652674e8/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= +golang.org/x/exp v0.0.0-20190510132918-efd6b22b2522/go.mod h1:ZjyILWgesfNpC6sMxTJOJm9Kp84zZh5NQWvqDGG3Qr8= +golang.org/x/exp v0.0.0-20190829153037-c13cbed26979/go.mod h1:86+5VVa7VpoJ4kLfm080zCjGlMRFzhUhsZKEZO7MGek= +golang.org/x/exp v0.0.0-20191030013958-a1ab85dbe136/go.mod h1:JXzH8nQsPlswgeRAPE3MuO9GYsAcnJvJ4vnMwN/5qkY= +golang.org/x/exp v0.0.0-20191129062945-2f5052295587/go.mod h1:2RIsYlXP63K8oxa1u096TMicItID8zy7Y6sNkU49FU4= +golang.org/x/exp v0.0.0-20191227195350-da58074b4299/go.mod h1:2RIsYlXP63K8oxa1u096TMicItID8zy7Y6sNkU49FU4= +golang.org/x/exp v0.0.0-20200119233911-0405dc783f0a/go.mod h1:2RIsYlXP63K8oxa1u096TMicItID8zy7Y6sNkU49FU4= +golang.org/x/exp v0.0.0-20200207192155-f17229e696bd/go.mod h1:J/WKrq2StrnmMY6+EHIKF9dgMWnmCNThgcyBT1FY9mM= +golang.org/x/exp v0.0.0-20200224162631-6cc2880d07d6/go.mod h1:3jZMyOhIsHpP37uCMkUooju7aAi5cS1Q23tOzKc+0MU= +golang.org/x/image v0.0.0-20190227222117-0694c2d4d067/go.mod h1:kZ7UVZpmo3dzQBMxlp+ypCbDeSB+sBbTgSJuh5dn5js= +golang.org/x/image v0.0.0-20190802002840-cff245a6509b/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0= +golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvxsM5YxQ5yQlVC4a0KAMCusXpPoU= +golang.org/x/lint v0.0.0-20190301231843-5614ed5bae6f/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= +golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= +golang.org/x/lint v0.0.0-20190409202823-959b441ac422/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= +golang.org/x/lint v0.0.0-20190909230951-414d861bb4ac/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= +golang.org/x/lint v0.0.0-20190930215403-16217165b5de/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= +golang.org/x/lint v0.0.0-20191125180803-fdd1cda4f05f/go.mod h1:5qLYkcX4OjUUV8bRuDixDT3tpyyb+LUpUlRWLxfhWrs= +golang.org/x/lint v0.0.0-20200130185559-910be7a94367/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY= +golang.org/x/lint v0.0.0-20200302205851-738671d3881b/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY= +golang.org/x/lint v0.0.0-20201208152925-83fdc39ff7b5 h1:2M3HP5CCK1Si9FQhwnzYhXdG6DXeebvUHFpre8QvbyI= +golang.org/x/lint v0.0.0-20201208152925-83fdc39ff7b5/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY= +golang.org/x/mobile v0.0.0-20190312151609-d3739f865fa6/go.mod h1:z+o9i4GpDbdi3rU15maQ/Ox0txvL9dWGYEHz965HBQE= +golang.org/x/mobile v0.0.0-20190719004257-d2bd2a29d028/go.mod h1:E/iHnbuqvinMTCcRqshq8CkpyQDoeVncDDYHnLhea+o= +golang.org/x/mod v0.0.0-20190513183733-4bf6d317e70e/go.mod h1:mXi4GBBbnImb6dmsKGUJ2LatrhH/nqhxcFungHvyanc= +golang.org/x/mod v0.1.0/go.mod h1:0QHyrYULN0/3qlju5TqG8bIK38QM8yzMo5ekMj3DlcY= +golang.org/x/mod v0.1.1-0.20191105210325-c90efee705ee/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg= +golang.org/x/mod v0.1.1-0.20191107180719-034126e5016b/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg= +golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= +golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= +golang.org/x/mod v0.4.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= +golang.org/x/mod v0.4.1 h1:Kvvh58BN8Y9/lBi7hTekvtMpm07eUZ0ck5pRHpsMWrY= +golang.org/x/mod v0.4.1/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= +golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20190108225652-1e06a53dbb7e/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20190213061140-3a22650c66bd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20190501004415-9ce7a6920f09/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20190503192946-f4e77d36d62c/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20190603091049-60506f45cf65/go.mod h1:HSz+uSET+XFnRR8LxR5pz3Of3rY3CfYBVs4xY44aLks= +golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20190628185345-da137c7871d7/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20190724013045-ca1201d0de80/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20191209160850-c0dbc17a3553/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20200114155413-6afb5195e5aa/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20200202094626-16171245cfb2/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20200222125558-5a598a2470a0/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20200301022130-244492dfa37a/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20200324143707-d3edc9973b7e/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= +golang.org/x/net v0.0.0-20200501053045-e0ff5e5a1de5/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= +golang.org/x/net v0.0.0-20200506145744-7e3656a0809f/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= +golang.org/x/net v0.0.0-20200513185701-a91f0712d120/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= +golang.org/x/net v0.0.0-20200520182314-0ba52f642ac2/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= +golang.org/x/net v0.0.0-20200625001655-4c5254603344/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= +golang.org/x/net v0.0.0-20200707034311-ab3426394381/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= +golang.org/x/net v0.0.0-20200822124328-c89045814202/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= +golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= +golang.org/x/net v0.0.0-20201031054903-ff519b6c9102/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= +golang.org/x/net v0.0.0-20201110031124-69a78807bb2b/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= +golang.org/x/net v0.0.0-20201209123823-ac852fbbde11/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= +golang.org/x/net v0.0.0-20210119194325-5f4716e94777/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= +golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= +golang.org/x/net v0.0.0-20210316092652-d523dce5a7f4/go.mod h1:RBQZq4jEuRlivfhVLdyRGr576XBO4/greRjx4P4O3yc= +golang.org/x/net v0.0.0-20210503060351-7fd8e65b6420 h1:a8jGStKg0XqKDlKqjLrXn0ioF5MH36pT7Z0BRTqLhbk= +golang.org/x/net v0.0.0-20210503060351-7fd8e65b6420/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= +golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= +golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= +golang.org/x/oauth2 v0.0.0-20191202225959-858c2ad4c8b6/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= +golang.org/x/oauth2 v0.0.0-20200107190931-bf48bf16ab8d/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= +golang.org/x/oauth2 v0.0.0-20200902213428-5d25da1a8d43/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= +golang.org/x/oauth2 v0.0.0-20201109201403-9fd604954f58/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= +golang.org/x/oauth2 v0.0.0-20201208152858-08078c50e5b5/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= +golang.org/x/oauth2 v0.0.0-20210218202405-ba52d332ba99/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= +golang.org/x/oauth2 v0.0.0-20210220000619-9bb904979d93/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= +golang.org/x/oauth2 v0.0.0-20210313182246-cd4f82c27b84/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= +golang.org/x/oauth2 v0.0.0-20210427180440-81ed05c6b58c/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= +golang.org/x/oauth2 v0.0.0-20210514164344-f6687ab2804c/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= +golang.org/x/oauth2 v0.0.0-20211104180415-d3ed0bb246c8 h1:RerP+noqYHUQ8CMRcPlC2nvTa4dcBIjegkuWdcUDuqg= +golang.org/x/oauth2 v0.0.0-20211104180415-d3ed0bb246c8/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= +golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20190227155943-e225da77a7e6/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20200317015054-43a5402ce75a/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20200625203802-6e8e738ad208/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20201207232520-09787c993a3a/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20210220032951-036812b2e83c h1:5KslGYwFpkhGh+Q16bwMP3cOontH8FOep7tGV86Y7SQ= +golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20190312061237-fead79001313/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190502145724-3ef323f4f1fd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190507160741-ecd444e8653b/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190606165138-5da285871e9c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190624142023-c5567b49c5d0/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190726091711-fc99dfbffb4e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20191001151750-bb3f8db39f24/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20191204072324-ce4227a45e2e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20191228213918-04cbcbbfeed8/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200113162924-86b910548bc1/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200122134326-e047566fdf82/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200202164722-d101bd2416d5/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200212091648-12a6c2dcc1e4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200223170610-d5e6a3e2c0ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200302150141-5c8b2ff67527/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200331124033-c3d80250170d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200501052902-10377860bb8e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200511232937-7e40ca221e25/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200515095857-1151b9dac4a9/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200523222454-059865788121/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200803210538-64077c9b5642/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200905004654-be1d3432aa8f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20201201145000-ef89a241ccb3/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210104204734-6f8348627aad/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210119212857-b64e53b001e4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210220050731-9a76102bfb43/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210305230114-8fe3ee5dd75b/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210315160823-c6e025ad8005/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210320140829-1e4c9ba3b0c4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210503080704-8803ae5d1324 h1:pAwJxDByZctfPwzlNGrDN2BQLsdPb9NkhoTJtUkAO28= +golang.org/x/sys v0.0.0-20210503080704-8803ae5d1324/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= +golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= +golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= +golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= +golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= +golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= +golang.org/x/text v0.3.4/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= +golang.org/x/text v0.3.5/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= +golang.org/x/text v0.3.6 h1:aRYxNxv6iGQlyVaZmk6ZgYEDa+Jg18DxebPSrd6bg1M= +golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= +golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= +golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= +golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= +golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20190226205152-f727befe758c/go.mod h1:9Yl7xja0Znq3iFh3HoIrodX9oNMXvdceNzlUR8zjMvY= +golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= +golang.org/x/tools v0.0.0-20190312151545-0bb0c0a6e846/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= +golang.org/x/tools v0.0.0-20190312170243-e65039ee4138/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= +golang.org/x/tools v0.0.0-20190425150028-36563e24a262/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= +golang.org/x/tools v0.0.0-20190506145303-2d16b83fe98c/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= +golang.org/x/tools v0.0.0-20190524140312-2c0ae7006135/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= +golang.org/x/tools v0.0.0-20190606124116-d0a3d012864b/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= +golang.org/x/tools v0.0.0-20190621195816-6e04913cbbac/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= +golang.org/x/tools v0.0.0-20190628153133-6cdbf07be9d0/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= +golang.org/x/tools v0.0.0-20190816200558-6889da9d5479/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20190911174233-4f2ddba30aff/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20191012152004-8de300cfc20a/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20191113191852-77e3bb0ad9e7/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20191115202509-3a792d9c32b2/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20191125144606-a911d9008d1f/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20191130070609-6e064ea0cf2d/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20191216173652-a0e659d51361/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20191227053925-7b8e75db28f4/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20200117161641-43d50277825c/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20200122220014-bf1340f18c4a/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20200130002326-2f3ba24bd6e7/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20200204074204-1cc6d1ef6c74/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20200207183749-b753a1ba74fa/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20200212150539-ea181f53ac56/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20200224181240-023911ca70b2/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20200227222343-706bc42d1f0d/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20200304193943-95d2e580d8eb/go.mod h1:o4KQGtdN14AW+yjsvvwRTJJuXz8XRtIHtEnmAXLyFUw= +golang.org/x/tools v0.0.0-20200312045724-11d5b4c81c7d/go.mod h1:o4KQGtdN14AW+yjsvvwRTJJuXz8XRtIHtEnmAXLyFUw= +golang.org/x/tools v0.0.0-20200331025713-a30bf2db82d4/go.mod h1:Sl4aGygMT6LrqrWclx+PTx3U+LnKx/seiNR+3G19Ar8= +golang.org/x/tools v0.0.0-20200501065659-ab2804fb9c9d/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= +golang.org/x/tools v0.0.0-20200512131952-2bc93b1c0c88/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= +golang.org/x/tools v0.0.0-20200515010526-7d3b6ebf133d/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= +golang.org/x/tools v0.0.0-20200618134242-20370b0cb4b2/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= +golang.org/x/tools v0.0.0-20200729194436-6467de6f59a7/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA= +golang.org/x/tools v0.0.0-20200804011535-6c149bb5ef0d/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA= +golang.org/x/tools v0.0.0-20200825202427-b303f430e36d/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA= +golang.org/x/tools v0.0.0-20200904185747-39188db58858/go.mod h1:Cj7w3i3Rnn0Xh82ur9kSqwfTHTeVxaDqrfMjpcNT6bE= +golang.org/x/tools v0.0.0-20201110124207-079ba7bd75cd/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= +golang.org/x/tools v0.0.0-20201201161351-ac6f37ff4c2a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= +golang.org/x/tools v0.0.0-20201208233053-a543418bbed2/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= +golang.org/x/tools v0.0.0-20210105154028-b0ab187a4818/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= +golang.org/x/tools v0.1.0 h1:po9/4sTYwZU9lPhi1tOrb4hCv3qrhiQ77LZfGa2OjwY= +golang.org/x/tools v0.1.0/go.mod h1:xkSsbof2nBLbhDlRMhhhyNLN/zl3eTqcnHD5viDpcZ0= +golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 h1:go1bK/D/BFZV2I8cIQd1NKEZ+0owSTG1fDTci4IqFcE= +golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +google.golang.org/api v0.4.0/go.mod h1:8k5glujaEP+g9n7WNsDg8QP6cUVNI86fCNMcbazEtwE= +google.golang.org/api v0.7.0/go.mod h1:WtwebWUNSVBH/HAw79HIFXZNqEvBhG+Ra+ax0hx3E3M= +google.golang.org/api v0.8.0/go.mod h1:o4eAsZoiT+ibD93RtjEohWalFOjRDx6CVaqeizhEnKg= +google.golang.org/api v0.9.0/go.mod h1:o4eAsZoiT+ibD93RtjEohWalFOjRDx6CVaqeizhEnKg= +google.golang.org/api v0.13.0/go.mod h1:iLdEw5Ide6rF15KTC1Kkl0iskquN2gFfn9o9XIsbkAI= +google.golang.org/api v0.14.0/go.mod h1:iLdEw5Ide6rF15KTC1Kkl0iskquN2gFfn9o9XIsbkAI= +google.golang.org/api v0.15.0/go.mod h1:iLdEw5Ide6rF15KTC1Kkl0iskquN2gFfn9o9XIsbkAI= +google.golang.org/api v0.17.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE= +google.golang.org/api v0.18.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE= +google.golang.org/api v0.19.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE= +google.golang.org/api v0.20.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE= +google.golang.org/api v0.22.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE= +google.golang.org/api v0.24.0/go.mod h1:lIXQywCXRcnZPGlsd8NbLnOjtAoL6em04bJ9+z0MncE= +google.golang.org/api v0.28.0/go.mod h1:lIXQywCXRcnZPGlsd8NbLnOjtAoL6em04bJ9+z0MncE= +google.golang.org/api v0.29.0/go.mod h1:Lcubydp8VUV7KeIHD9z2Bys/sm/vGKnG1UHuDBSrHWM= +google.golang.org/api v0.30.0/go.mod h1:QGmEvQ87FHZNiUVJkT14jQNYJ4ZJjdRF23ZXz5138Fc= +google.golang.org/api v0.35.0/go.mod h1:/XrVsuzM0rZmrsbjJutiuftIzeuTQcEeaYcSk/mQ1dg= +google.golang.org/api v0.36.0/go.mod h1:+z5ficQTmoYpPn8LCUNVpK5I7hwkpjbcgqA7I34qYtE= +google.golang.org/api v0.40.0/go.mod h1:fYKFpnQN0DsDSKRVRcQSDQNtqWPfM9i+zNPxepjRCQ8= +google.golang.org/api v0.41.0/go.mod h1:RkxM5lITDfTzmyKFPt+wGrCJbVfniCr2ool8kTBzRTU= +google.golang.org/api v0.43.0/go.mod h1:nQsDGjRXMo4lvh5hP0TKqF244gqhGcr/YSIykhUk/94= +google.golang.org/api v0.46.0 h1:jkDWHOBIoNSD0OQpq4rtBVu+Rh325MPjXG1rakAp8JU= +google.golang.org/api v0.46.0/go.mod h1:ceL4oozhkAiTID8XMmJBsIxID/9wMXJVVFXPg4ylg3I= +google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= +google.golang.org/appengine v1.5.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= +google.golang.org/appengine v1.6.1/go.mod h1:i06prIuMbXzDqacNJfV5OdTW448YApPu5ww/cMBSeb0= +google.golang.org/appengine v1.6.5/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc= +google.golang.org/appengine v1.6.6/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc= +google.golang.org/appengine v1.6.7 h1:FZR1q0exgwxzPzp/aF+VccGrSfxfPpkBqjIIEq3ru6c= +google.golang.org/appengine v1.6.7/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc= +google.golang.org/genproto v0.0.0-20190307195333-5fe7a883aa19/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= +google.golang.org/genproto v0.0.0-20190418145605-e7d98fc518a7/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= +google.golang.org/genproto v0.0.0-20190425155659-357c62f0e4bb/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= +google.golang.org/genproto v0.0.0-20190502173448-54afdca5d873/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= +google.golang.org/genproto v0.0.0-20190801165951-fa694d86fc64/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc= +google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc= +google.golang.org/genproto v0.0.0-20190911173649-1774047e7e51/go.mod h1:IbNlFCBrqXvoKpeg0TB2l7cyZUmoaFKYIwrEpbDKLA8= +google.golang.org/genproto v0.0.0-20191108220845-16a3f7862a1a/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= +google.golang.org/genproto v0.0.0-20191115194625-c23dd37a84c9/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= +google.golang.org/genproto v0.0.0-20191216164720-4f79533eabd1/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= +google.golang.org/genproto v0.0.0-20191230161307-f3c370f40bfb/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= +google.golang.org/genproto v0.0.0-20200115191322-ca5a22157cba/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= +google.golang.org/genproto v0.0.0-20200122232147-0452cf42e150/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= +google.golang.org/genproto v0.0.0-20200204135345-fa8e72b47b90/go.mod h1:GmwEX6Z4W5gMy59cAlVYjN9JhxgbQH6Gn+gFDQe2lzA= +google.golang.org/genproto v0.0.0-20200212174721-66ed5ce911ce/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= +google.golang.org/genproto v0.0.0-20200224152610-e50cd9704f63/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= +google.golang.org/genproto v0.0.0-20200228133532-8c2c7df3a383/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= +google.golang.org/genproto v0.0.0-20200305110556-506484158171/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= +google.golang.org/genproto v0.0.0-20200312145019-da6875a35672/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= +google.golang.org/genproto v0.0.0-20200331122359-1ee6d9798940/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= +google.golang.org/genproto v0.0.0-20200430143042-b979b6f78d84/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= +google.golang.org/genproto v0.0.0-20200511104702-f5ebc3bea380/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= +google.golang.org/genproto v0.0.0-20200513103714-09dca8ec2884/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= +google.golang.org/genproto v0.0.0-20200515170657-fc4c6c6a6587/go.mod h1:YsZOwe1myG/8QRHRsmBRE1LrgQY60beZKjly0O1fX9U= +google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013/go.mod h1:NbSheEEYHJ7i3ixzK3sjbqSGDJWnxyFXZblF3eUsNvo= +google.golang.org/genproto v0.0.0-20200618031413-b414f8b61790/go.mod h1:jDfRM7FcilCzHH/e9qn6dsT145K34l5v+OpcnNgKAAA= +google.golang.org/genproto v0.0.0-20200729003335-053ba62fc06f/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= +google.golang.org/genproto v0.0.0-20200804131852-c06518451d9c/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= +google.golang.org/genproto v0.0.0-20200825200019-8632dd797987/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= +google.golang.org/genproto v0.0.0-20200904004341-0bd0a958aa1d/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= +google.golang.org/genproto v0.0.0-20201109203340-2640f1f9cdfb/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= +google.golang.org/genproto v0.0.0-20201201144952-b05cb90ed32e/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= +google.golang.org/genproto v0.0.0-20201210142538-e3217bee35cc/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= +google.golang.org/genproto v0.0.0-20201214200347-8c77b98c765d/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= +google.golang.org/genproto v0.0.0-20210222152913-aa3ee6e6a81c/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= +google.golang.org/genproto v0.0.0-20210303154014-9728d6b83eeb/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= +google.golang.org/genproto v0.0.0-20210310155132-4ce2db91004e/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= +google.golang.org/genproto v0.0.0-20210319143718-93e7006c17a6/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= +google.golang.org/genproto v0.0.0-20210402141018-6c239bbf2bb1/go.mod h1:9lPAdzaEmUacj36I+k7YKbEc5CXzPIeORRgDAUOu28A= +google.golang.org/genproto v0.0.0-20210429181445-86c259c2b4ab/go.mod h1:P3QM42oQyzQSnHPnZ/vqoCdDmzH28fzWByN9asMeM8A= +google.golang.org/genproto v0.0.0-20210517163617-5e0236093d7a h1:VA0wtJaR+W1I11P2f535J7D/YxyvEFMTMvcmyeZ9FBE= +google.golang.org/genproto v0.0.0-20210517163617-5e0236093d7a/go.mod h1:P3QM42oQyzQSnHPnZ/vqoCdDmzH28fzWByN9asMeM8A= +google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= +google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= +google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= +google.golang.org/protobuf v1.20.1-0.20200309200217-e05f789c0967/go.mod h1:A+miEFZTKqfCUM6K7xSMQL9OKL/b6hQv+e19PK+JZNE= +google.golang.org/protobuf v1.21.0/go.mod h1:47Nbq4nVaFHyn7ilMalzfO3qCViNmqZ2kzikPIcrTAo= +google.golang.org/protobuf v1.22.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= +google.golang.org/protobuf v1.23.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= +google.golang.org/protobuf v1.23.1-0.20200526195155-81db48ad09cc/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= +google.golang.org/protobuf v1.24.0/go.mod h1:r/3tXBNzIEhYS9I1OUVjXDlt8tc493IdKGjtUeSXeh4= +google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlbajtzgsN7c= +google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= +google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= +google.golang.org/protobuf v1.27.1 h1:SnqbnDw1V7RiZcXPx5MEeqPv2s79L9i7BJUlG/+RurQ= +google.golang.org/protobuf v1.27.1/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= +gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI= +gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.2.3/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= +honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= +honnef.co/go/tools v0.0.0-20190106161140-3f1c8253044a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= +honnef.co/go/tools v0.0.0-20190418001031-e561f6794a2a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= +honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= +honnef.co/go/tools v0.0.1-2019.2.3/go.mod h1:a3bituU0lyd329TUQxRnasdCoJDkEUEAqEt0JzvZhAg= +honnef.co/go/tools v0.0.1-2020.1.3/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k= +honnef.co/go/tools v0.0.1-2020.1.4/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k= +rsc.io/binaryregexp v0.2.0/go.mod h1:qTv7/COck+e2FymRvadv62gMdZztPaShugOCi3I+8D8= +rsc.io/quote/v3 v3.1.0/go.mod h1:yEA65RcK8LyAZtP9Kv3t0HmxON59tX3rD+tICJqUlj0= +rsc.io/sampler v1.3.0/go.mod h1:T1hPZKmBbMNahiBKFy5HrXp6adAjACjK9JXDnKaTXpA= diff --git a/observability/internal/config/config.pb.go b/observability/internal/config/config.pb.go new file mode 100644 index 00000000000..16f840016fa --- /dev/null +++ b/observability/internal/config/config.pb.go @@ -0,0 +1,315 @@ +// Copyright 2022 The gRPC Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Observability Config is used by gRPC Observability plugin to control provided +// observability features. It contains parameters to enable/disable certain +// features, or fine tune the verbosity. +// +// Note that gRPC may use this config in JSON form, not in protobuf form. This +// proto definition is intended to help document the schema but might not +// actually be used directly by gRPC. + +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.25.0 +// protoc v3.14.0 +// source: observability/internal/config/config.proto + +package config + +import ( + proto "github.com/golang/protobuf/proto" + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +// This is a compile-time assertion that a sufficiently up-to-date version +// of the legacy proto package is being used. +const _ = proto.ProtoPackageIsVersion4 + +// Configuration for observability behaviors. By default, no configuration is +// required for tracing/metrics/logging to function. This config captures the +// most common knobs for gRPC users. It's always possible to override with +// explicit config in code. +type ObservabilityConfig struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // Whether the logging data uploading to CloudLogging should be enabled or + // not. The default value is true. + EnableCloudLogging bool `protobuf:"varint,1,opt,name=enable_cloud_logging,json=enableCloudLogging,proto3" json:"enable_cloud_logging,omitempty"` + // The destination GCP project identifier for the uploading log entries. If + // empty, the gRPC Observability plugin will attempt to fetch the project_id + // from the GCP environment variables, or from the default credentials. + DestinationProjectId string `protobuf:"bytes,2,opt,name=destination_project_id,json=destinationProjectId,proto3" json:"destination_project_id,omitempty"` + // A list of method config. The order matters here - the first pattern which + // matches the current method will apply the associated config options in + // the LogFilter. Any other LogFilter that also matches that comes later + // will be ignored. So a LogFilter of "*/*" should appear last in this list. + LogFilters []*ObservabilityConfig_LogFilter `protobuf:"bytes,3,rep,name=log_filters,json=logFilters,proto3" json:"log_filters,omitempty"` +} + +func (x *ObservabilityConfig) Reset() { + *x = ObservabilityConfig{} + if protoimpl.UnsafeEnabled { + mi := &file_observability_internal_config_config_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ObservabilityConfig) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ObservabilityConfig) ProtoMessage() {} + +func (x *ObservabilityConfig) ProtoReflect() protoreflect.Message { + mi := &file_observability_internal_config_config_proto_msgTypes[0] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ObservabilityConfig.ProtoReflect.Descriptor instead. +func (*ObservabilityConfig) Descriptor() ([]byte, []int) { + return file_observability_internal_config_config_proto_rawDescGZIP(), []int{0} +} + +func (x *ObservabilityConfig) GetEnableCloudLogging() bool { + if x != nil { + return x.EnableCloudLogging + } + return false +} + +func (x *ObservabilityConfig) GetDestinationProjectId() string { + if x != nil { + return x.DestinationProjectId + } + return "" +} + +func (x *ObservabilityConfig) GetLogFilters() []*ObservabilityConfig_LogFilter { + if x != nil { + return x.LogFilters + } + return nil +} + +type ObservabilityConfig_LogFilter struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // A string which can select a group of method names. Only "*" wildcard + // is accepted. + // Examples: + // - "Foo/Bar" selects only the method "Bar" from service "Foo" + // - "Foo/*" selects all methods from service "Foo" + // - "*/*" selects all methods from all services. + Pattern string `protobuf:"bytes,1,opt,name=pattern,proto3" json:"pattern,omitempty"` + // Number of bytes of each header to log. If the size of the header is + // greater than the defined limit, content pass the limit will be + // truncated. The default value is 0. + HeaderBytes int32 `protobuf:"varint,2,opt,name=header_bytes,json=headerBytes,proto3" json:"header_bytes,omitempty"` + // Number of bytes of each message to log. If the size of the message is + // greater than the defined limit, content pass the limit will be + // truncated. The default value is 0. + MessageBytes int32 `protobuf:"varint,3,opt,name=message_bytes,json=messageBytes,proto3" json:"message_bytes,omitempty"` +} + +func (x *ObservabilityConfig_LogFilter) Reset() { + *x = ObservabilityConfig_LogFilter{} + if protoimpl.UnsafeEnabled { + mi := &file_observability_internal_config_config_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ObservabilityConfig_LogFilter) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ObservabilityConfig_LogFilter) ProtoMessage() {} + +func (x *ObservabilityConfig_LogFilter) ProtoReflect() protoreflect.Message { + mi := &file_observability_internal_config_config_proto_msgTypes[1] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ObservabilityConfig_LogFilter.ProtoReflect.Descriptor instead. +func (*ObservabilityConfig_LogFilter) Descriptor() ([]byte, []int) { + return file_observability_internal_config_config_proto_rawDescGZIP(), []int{0, 0} +} + +func (x *ObservabilityConfig_LogFilter) GetPattern() string { + if x != nil { + return x.Pattern + } + return "" +} + +func (x *ObservabilityConfig_LogFilter) GetHeaderBytes() int32 { + if x != nil { + return x.HeaderBytes + } + return 0 +} + +func (x *ObservabilityConfig_LogFilter) GetMessageBytes() int32 { + if x != nil { + return x.MessageBytes + } + return 0 +} + +var File_observability_internal_config_config_proto protoreflect.FileDescriptor + +var file_observability_internal_config_config_proto_rawDesc = []byte{ + 0x0a, 0x2a, 0x6f, 0x62, 0x73, 0x65, 0x72, 0x76, 0x61, 0x62, 0x69, 0x6c, 0x69, 0x74, 0x79, 0x2f, + 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2f, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2f, + 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x21, 0x67, 0x72, + 0x70, 0x63, 0x2e, 0x6f, 0x62, 0x73, 0x65, 0x72, 0x76, 0x61, 0x62, 0x69, 0x6c, 0x69, 0x74, 0x79, + 0x2e, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x22, + 0xcf, 0x02, 0x0a, 0x13, 0x4f, 0x62, 0x73, 0x65, 0x72, 0x76, 0x61, 0x62, 0x69, 0x6c, 0x69, 0x74, + 0x79, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x12, 0x30, 0x0a, 0x14, 0x65, 0x6e, 0x61, 0x62, 0x6c, + 0x65, 0x5f, 0x63, 0x6c, 0x6f, 0x75, 0x64, 0x5f, 0x6c, 0x6f, 0x67, 0x67, 0x69, 0x6e, 0x67, 0x18, + 0x01, 0x20, 0x01, 0x28, 0x08, 0x52, 0x12, 0x65, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x43, 0x6c, 0x6f, + 0x75, 0x64, 0x4c, 0x6f, 0x67, 0x67, 0x69, 0x6e, 0x67, 0x12, 0x34, 0x0a, 0x16, 0x64, 0x65, 0x73, + 0x74, 0x69, 0x6e, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x70, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, + 0x5f, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x14, 0x64, 0x65, 0x73, 0x74, 0x69, + 0x6e, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x50, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x49, 0x64, 0x12, + 0x61, 0x0a, 0x0b, 0x6c, 0x6f, 0x67, 0x5f, 0x66, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x73, 0x18, 0x03, + 0x20, 0x03, 0x28, 0x0b, 0x32, 0x40, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x6f, 0x62, 0x73, 0x65, + 0x72, 0x76, 0x61, 0x62, 0x69, 0x6c, 0x69, 0x74, 0x79, 0x2e, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, + 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x2e, 0x4f, 0x62, 0x73, 0x65, 0x72, 0x76, 0x61, + 0x62, 0x69, 0x6c, 0x69, 0x74, 0x79, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2e, 0x4c, 0x6f, 0x67, + 0x46, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x52, 0x0a, 0x6c, 0x6f, 0x67, 0x46, 0x69, 0x6c, 0x74, 0x65, + 0x72, 0x73, 0x1a, 0x6d, 0x0a, 0x09, 0x4c, 0x6f, 0x67, 0x46, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x12, + 0x18, 0x0a, 0x07, 0x70, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, + 0x52, 0x07, 0x70, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x12, 0x21, 0x0a, 0x0c, 0x68, 0x65, 0x61, + 0x64, 0x65, 0x72, 0x5f, 0x62, 0x79, 0x74, 0x65, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, + 0x0b, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x42, 0x79, 0x74, 0x65, 0x73, 0x12, 0x23, 0x0a, 0x0d, + 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x5f, 0x62, 0x79, 0x74, 0x65, 0x73, 0x18, 0x03, 0x20, + 0x01, 0x28, 0x05, 0x52, 0x0c, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x42, 0x79, 0x74, 0x65, + 0x73, 0x42, 0x70, 0x0a, 0x1c, 0x69, 0x6f, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x6f, 0x62, 0x73, + 0x65, 0x72, 0x76, 0x61, 0x62, 0x69, 0x6c, 0x69, 0x74, 0x79, 0x2e, 0x63, 0x6f, 0x6e, 0x66, 0x69, + 0x67, 0x42, 0x18, 0x4f, 0x62, 0x73, 0x65, 0x72, 0x76, 0x61, 0x62, 0x69, 0x6c, 0x69, 0x74, 0x79, + 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x34, 0x67, + 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x67, 0x6f, 0x6c, 0x61, 0x6e, 0x67, 0x2e, 0x6f, 0x72, 0x67, + 0x2f, 0x67, 0x72, 0x70, 0x63, 0x2f, 0x6f, 0x62, 0x73, 0x65, 0x72, 0x76, 0x61, 0x62, 0x69, 0x6c, + 0x69, 0x74, 0x79, 0x2f, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2f, 0x63, 0x6f, 0x6e, + 0x66, 0x69, 0x67, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, +} + +var ( + file_observability_internal_config_config_proto_rawDescOnce sync.Once + file_observability_internal_config_config_proto_rawDescData = file_observability_internal_config_config_proto_rawDesc +) + +func file_observability_internal_config_config_proto_rawDescGZIP() []byte { + file_observability_internal_config_config_proto_rawDescOnce.Do(func() { + file_observability_internal_config_config_proto_rawDescData = protoimpl.X.CompressGZIP(file_observability_internal_config_config_proto_rawDescData) + }) + return file_observability_internal_config_config_proto_rawDescData +} + +var file_observability_internal_config_config_proto_msgTypes = make([]protoimpl.MessageInfo, 2) +var file_observability_internal_config_config_proto_goTypes = []interface{}{ + (*ObservabilityConfig)(nil), // 0: grpc.observability.config.v1alpha.ObservabilityConfig + (*ObservabilityConfig_LogFilter)(nil), // 1: grpc.observability.config.v1alpha.ObservabilityConfig.LogFilter +} +var file_observability_internal_config_config_proto_depIdxs = []int32{ + 1, // 0: grpc.observability.config.v1alpha.ObservabilityConfig.log_filters:type_name -> grpc.observability.config.v1alpha.ObservabilityConfig.LogFilter + 1, // [1:1] is the sub-list for method output_type + 1, // [1:1] is the sub-list for method input_type + 1, // [1:1] is the sub-list for extension type_name + 1, // [1:1] is the sub-list for extension extendee + 0, // [0:1] is the sub-list for field type_name +} + +func init() { file_observability_internal_config_config_proto_init() } +func file_observability_internal_config_config_proto_init() { + if File_observability_internal_config_config_proto != nil { + return + } + if !protoimpl.UnsafeEnabled { + file_observability_internal_config_config_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ObservabilityConfig); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_observability_internal_config_config_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ObservabilityConfig_LogFilter); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_observability_internal_config_config_proto_rawDesc, + NumEnums: 0, + NumMessages: 2, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_observability_internal_config_config_proto_goTypes, + DependencyIndexes: file_observability_internal_config_config_proto_depIdxs, + MessageInfos: file_observability_internal_config_config_proto_msgTypes, + }.Build() + File_observability_internal_config_config_proto = out.File + file_observability_internal_config_config_proto_rawDesc = nil + file_observability_internal_config_config_proto_goTypes = nil + file_observability_internal_config_config_proto_depIdxs = nil +} diff --git a/observability/internal/config/config.proto b/observability/internal/config/config.proto new file mode 100644 index 00000000000..7e8f992edd7 --- /dev/null +++ b/observability/internal/config/config.proto @@ -0,0 +1,69 @@ +// Copyright 2022 The gRPC Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Observability Config is used by gRPC Observability plugin to control provided +// observability features. It contains parameters to enable/disable certain +// features, or fine tune the verbosity. +// +// Note that gRPC may use this config in JSON form, not in protobuf form. This +// proto definition is intended to help document the schema but might not +// actually be used directly by gRPC. + +syntax = "proto3"; + +package grpc.observability.config.v1alpha; + +option java_package = "io.grpc.observability.config"; +option java_multiple_files = true; +option java_outer_classname = "ObservabilityConfigProto"; +option go_package = "google.golang.org/grpc/observability/internal/config"; + +// Configuration for observability behaviors. By default, no configuration is +// required for tracing/metrics/logging to function. This config captures the +// most common knobs for gRPC users. It's always possible to override with +// explicit config in code. +message ObservabilityConfig { + // Whether the logging data uploading to CloudLogging should be enabled or + // not. The default value is true. + bool enable_cloud_logging = 1; + + // The destination GCP project identifier for the uploading log entries. If + // empty, the gRPC Observability plugin will attempt to fetch the project_id + // from the GCP environment variables, or from the default credentials. + string destination_project_id = 2; + + message LogFilter { + // A string which can select a group of method names. Only "*" wildcard + // is accepted. + // Examples: + // - "Foo/Bar" selects only the method "Bar" from service "Foo" + // - "Foo/*" selects all methods from service "Foo" + // - "*/*" selects all methods from all services. + string pattern = 1; + // Number of bytes of each header to log. If the size of the header is + // greater than the defined limit, content pass the limit will be + // truncated. The default value is 0. + int32 header_bytes = 2; + // Number of bytes of each message to log. If the size of the message is + // greater than the defined limit, content pass the limit will be + // truncated. The default value is 0. + int32 message_bytes = 3; + } + + // A list of method config. The order matters here - the first pattern which + // matches the current method will apply the associated config options in + // the LogFilter. Any other LogFilter that also matches that comes later + // will be ignored. So a LogFilter of "*/*" should appear last in this list. + repeated LogFilter log_filters = 3; +} diff --git a/observability/internal/logging/logging.pb.go b/observability/internal/logging/logging.pb.go new file mode 100644 index 00000000000..69a8e4790e4 --- /dev/null +++ b/observability/internal/logging/logging.pb.go @@ -0,0 +1,914 @@ +// Copyright 2022 The gRPC Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.25.0 +// protoc v3.14.0 +// source: observability/internal/logging/logging.proto + +package logging + +import ( + proto "github.com/golang/protobuf/proto" + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + durationpb "google.golang.org/protobuf/types/known/durationpb" + timestamppb "google.golang.org/protobuf/types/known/timestamppb" + reflect "reflect" + sync "sync" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +// This is a compile-time assertion that a sufficiently up-to-date version +// of the legacy proto package is being used. +const _ = proto.ProtoPackageIsVersion4 + +// List of event types +type GrpcLogRecord_EventType int32 + +const ( + // Unknown event type + GrpcLogRecord_GRPC_CALL_UNKNOWN GrpcLogRecord_EventType = 0 + // Header sent from client to server + GrpcLogRecord_GRPC_CALL_REQUEST_HEADER GrpcLogRecord_EventType = 1 + // Header sent from server to client + GrpcLogRecord_GRPC_CALL_RESPONSE_HEADER GrpcLogRecord_EventType = 2 + // Message sent from client to server + GrpcLogRecord_GRPC_CALL_REQUEST_MESSAGE GrpcLogRecord_EventType = 3 + // Message sent from server to client + GrpcLogRecord_GRPC_CALL_RESPONSE_MESSAGE GrpcLogRecord_EventType = 4 + // Trailer indicates the end of the gRPC call + GrpcLogRecord_GRPC_CALL_TRAILER GrpcLogRecord_EventType = 5 + // A signal that client is done sending + GrpcLogRecord_GRPC_CALL_HALF_CLOSE GrpcLogRecord_EventType = 6 + // A signal that the rpc is canceled + GrpcLogRecord_GRPC_CALL_CANCEL GrpcLogRecord_EventType = 7 +) + +// Enum value maps for GrpcLogRecord_EventType. +var ( + GrpcLogRecord_EventType_name = map[int32]string{ + 0: "GRPC_CALL_UNKNOWN", + 1: "GRPC_CALL_REQUEST_HEADER", + 2: "GRPC_CALL_RESPONSE_HEADER", + 3: "GRPC_CALL_REQUEST_MESSAGE", + 4: "GRPC_CALL_RESPONSE_MESSAGE", + 5: "GRPC_CALL_TRAILER", + 6: "GRPC_CALL_HALF_CLOSE", + 7: "GRPC_CALL_CANCEL", + } + GrpcLogRecord_EventType_value = map[string]int32{ + "GRPC_CALL_UNKNOWN": 0, + "GRPC_CALL_REQUEST_HEADER": 1, + "GRPC_CALL_RESPONSE_HEADER": 2, + "GRPC_CALL_REQUEST_MESSAGE": 3, + "GRPC_CALL_RESPONSE_MESSAGE": 4, + "GRPC_CALL_TRAILER": 5, + "GRPC_CALL_HALF_CLOSE": 6, + "GRPC_CALL_CANCEL": 7, + } +) + +func (x GrpcLogRecord_EventType) Enum() *GrpcLogRecord_EventType { + p := new(GrpcLogRecord_EventType) + *p = x + return p +} + +func (x GrpcLogRecord_EventType) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (GrpcLogRecord_EventType) Descriptor() protoreflect.EnumDescriptor { + return file_observability_internal_logging_logging_proto_enumTypes[0].Descriptor() +} + +func (GrpcLogRecord_EventType) Type() protoreflect.EnumType { + return &file_observability_internal_logging_logging_proto_enumTypes[0] +} + +func (x GrpcLogRecord_EventType) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Use GrpcLogRecord_EventType.Descriptor instead. +func (GrpcLogRecord_EventType) EnumDescriptor() ([]byte, []int) { + return file_observability_internal_logging_logging_proto_rawDescGZIP(), []int{0, 0} +} + +// The entity that generates the log entry +type GrpcLogRecord_EventLogger int32 + +const ( + GrpcLogRecord_LOGGER_UNKNOWN GrpcLogRecord_EventLogger = 0 + GrpcLogRecord_LOGGER_CLIENT GrpcLogRecord_EventLogger = 1 + GrpcLogRecord_LOGGER_SERVER GrpcLogRecord_EventLogger = 2 +) + +// Enum value maps for GrpcLogRecord_EventLogger. +var ( + GrpcLogRecord_EventLogger_name = map[int32]string{ + 0: "LOGGER_UNKNOWN", + 1: "LOGGER_CLIENT", + 2: "LOGGER_SERVER", + } + GrpcLogRecord_EventLogger_value = map[string]int32{ + "LOGGER_UNKNOWN": 0, + "LOGGER_CLIENT": 1, + "LOGGER_SERVER": 2, + } +) + +func (x GrpcLogRecord_EventLogger) Enum() *GrpcLogRecord_EventLogger { + p := new(GrpcLogRecord_EventLogger) + *p = x + return p +} + +func (x GrpcLogRecord_EventLogger) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (GrpcLogRecord_EventLogger) Descriptor() protoreflect.EnumDescriptor { + return file_observability_internal_logging_logging_proto_enumTypes[1].Descriptor() +} + +func (GrpcLogRecord_EventLogger) Type() protoreflect.EnumType { + return &file_observability_internal_logging_logging_proto_enumTypes[1] +} + +func (x GrpcLogRecord_EventLogger) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Use GrpcLogRecord_EventLogger.Descriptor instead. +func (GrpcLogRecord_EventLogger) EnumDescriptor() ([]byte, []int) { + return file_observability_internal_logging_logging_proto_rawDescGZIP(), []int{0, 1} +} + +// The log severity level of the log entry +type GrpcLogRecord_LogLevel int32 + +const ( + GrpcLogRecord_LOG_LEVEL_UNKNOWN GrpcLogRecord_LogLevel = 0 + GrpcLogRecord_LOG_LEVEL_TRACE GrpcLogRecord_LogLevel = 1 + GrpcLogRecord_LOG_LEVEL_DEBUG GrpcLogRecord_LogLevel = 2 + GrpcLogRecord_LOG_LEVEL_INFO GrpcLogRecord_LogLevel = 3 + GrpcLogRecord_LOG_LEVEL_WARN GrpcLogRecord_LogLevel = 4 + GrpcLogRecord_LOG_LEVEL_ERROR GrpcLogRecord_LogLevel = 5 + GrpcLogRecord_LOG_LEVEL_CRITICAL GrpcLogRecord_LogLevel = 6 +) + +// Enum value maps for GrpcLogRecord_LogLevel. +var ( + GrpcLogRecord_LogLevel_name = map[int32]string{ + 0: "LOG_LEVEL_UNKNOWN", + 1: "LOG_LEVEL_TRACE", + 2: "LOG_LEVEL_DEBUG", + 3: "LOG_LEVEL_INFO", + 4: "LOG_LEVEL_WARN", + 5: "LOG_LEVEL_ERROR", + 6: "LOG_LEVEL_CRITICAL", + } + GrpcLogRecord_LogLevel_value = map[string]int32{ + "LOG_LEVEL_UNKNOWN": 0, + "LOG_LEVEL_TRACE": 1, + "LOG_LEVEL_DEBUG": 2, + "LOG_LEVEL_INFO": 3, + "LOG_LEVEL_WARN": 4, + "LOG_LEVEL_ERROR": 5, + "LOG_LEVEL_CRITICAL": 6, + } +) + +func (x GrpcLogRecord_LogLevel) Enum() *GrpcLogRecord_LogLevel { + p := new(GrpcLogRecord_LogLevel) + *p = x + return p +} + +func (x GrpcLogRecord_LogLevel) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (GrpcLogRecord_LogLevel) Descriptor() protoreflect.EnumDescriptor { + return file_observability_internal_logging_logging_proto_enumTypes[2].Descriptor() +} + +func (GrpcLogRecord_LogLevel) Type() protoreflect.EnumType { + return &file_observability_internal_logging_logging_proto_enumTypes[2] +} + +func (x GrpcLogRecord_LogLevel) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Use GrpcLogRecord_LogLevel.Descriptor instead. +func (GrpcLogRecord_LogLevel) EnumDescriptor() ([]byte, []int) { + return file_observability_internal_logging_logging_proto_rawDescGZIP(), []int{0, 2} +} + +type GrpcLogRecord_Address_Type int32 + +const ( + GrpcLogRecord_Address_TYPE_UNKNOWN GrpcLogRecord_Address_Type = 0 + GrpcLogRecord_Address_TYPE_IPV4 GrpcLogRecord_Address_Type = 1 // in 1.2.3.4 form + GrpcLogRecord_Address_TYPE_IPV6 GrpcLogRecord_Address_Type = 2 // IPv6 canonical form (RFC5952 section 4) + GrpcLogRecord_Address_TYPE_UNIX GrpcLogRecord_Address_Type = 3 // UDS string +) + +// Enum value maps for GrpcLogRecord_Address_Type. +var ( + GrpcLogRecord_Address_Type_name = map[int32]string{ + 0: "TYPE_UNKNOWN", + 1: "TYPE_IPV4", + 2: "TYPE_IPV6", + 3: "TYPE_UNIX", + } + GrpcLogRecord_Address_Type_value = map[string]int32{ + "TYPE_UNKNOWN": 0, + "TYPE_IPV4": 1, + "TYPE_IPV6": 2, + "TYPE_UNIX": 3, + } +) + +func (x GrpcLogRecord_Address_Type) Enum() *GrpcLogRecord_Address_Type { + p := new(GrpcLogRecord_Address_Type) + *p = x + return p +} + +func (x GrpcLogRecord_Address_Type) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (GrpcLogRecord_Address_Type) Descriptor() protoreflect.EnumDescriptor { + return file_observability_internal_logging_logging_proto_enumTypes[3].Descriptor() +} + +func (GrpcLogRecord_Address_Type) Type() protoreflect.EnumType { + return &file_observability_internal_logging_logging_proto_enumTypes[3] +} + +func (x GrpcLogRecord_Address_Type) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Use GrpcLogRecord_Address_Type.Descriptor instead. +func (GrpcLogRecord_Address_Type) EnumDescriptor() ([]byte, []int) { + return file_observability_internal_logging_logging_proto_rawDescGZIP(), []int{0, 2, 0} +} + +type GrpcLogRecord struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // The timestamp of the log event + Timestamp *timestamppb.Timestamp `protobuf:"bytes,1,opt,name=timestamp,proto3" json:"timestamp,omitempty"` + // Uniquely identifies a call. The value must not be 0 in order to disambiguate + // from an unset value. + // Each call may have several log entries. They will all have the same rpc_id. + // Nothing is guaranteed about their value other than they are unique across + // different RPCs in the same gRPC process. + RpcId string `protobuf:"bytes,2,opt,name=rpc_id,json=rpcId,proto3" json:"rpc_id,omitempty"` + EventType GrpcLogRecord_EventType `protobuf:"varint,3,opt,name=event_type,json=eventType,proto3,enum=grpc.observability.logging.v1.GrpcLogRecord_EventType" json:"event_type,omitempty"` // one of the above EventType enum + EventLogger GrpcLogRecord_EventLogger `protobuf:"varint,4,opt,name=event_logger,json=eventLogger,proto3,enum=grpc.observability.logging.v1.GrpcLogRecord_EventLogger" json:"event_logger,omitempty"` // one of the above EventLogger enum + // the name of the service + ServiceName string `protobuf:"bytes,5,opt,name=service_name,json=serviceName,proto3" json:"service_name,omitempty"` + // the name of the RPC method + MethodName string `protobuf:"bytes,6,opt,name=method_name,json=methodName,proto3" json:"method_name,omitempty"` + LogLevel GrpcLogRecord_LogLevel `protobuf:"varint,7,opt,name=log_level,json=logLevel,proto3,enum=grpc.observability.logging.v1.GrpcLogRecord_LogLevel" json:"log_level,omitempty"` // one of the above LogLevel enum + // Peer address information. On client side, peer is logged on server + // header event or trailer event (if trailer-only). On server side, peer + // is always logged on the client header event. + PeerAddress *GrpcLogRecord_Address `protobuf:"bytes,8,opt,name=peer_address,json=peerAddress,proto3" json:"peer_address,omitempty"` + // the RPC timeout value + Timeout *durationpb.Duration `protobuf:"bytes,11,opt,name=timeout,proto3" json:"timeout,omitempty"` + // A single process may be used to run multiple virtual servers with + // different identities. + // The authority is the name of such a server identify. It is typically a + // portion of the URI in the form of or :. + Authority string `protobuf:"bytes,12,opt,name=authority,proto3" json:"authority,omitempty"` + // Size of the message or metadata, depending on the event type, + // regardless of whether the full message or metadata is being logged + // (i.e. could be truncated or omitted). + PayloadSize uint32 `protobuf:"varint,13,opt,name=payload_size,json=payloadSize,proto3" json:"payload_size,omitempty"` + // true if message or metadata field is either truncated or omitted due + // to config options + PayloadTruncated bool `protobuf:"varint,14,opt,name=payload_truncated,json=payloadTruncated,proto3" json:"payload_truncated,omitempty"` + // Used by header event or trailer event + Metadata *GrpcLogRecord_Metadata `protobuf:"bytes,15,opt,name=metadata,proto3" json:"metadata,omitempty"` + // The entry sequence ID for this call. The first message has a value of 1, + // to disambiguate from an unset value. The purpose of this field is to + // detect missing entries in environments where durability or ordering is + // not guaranteed. + SequenceId uint64 `protobuf:"varint,16,opt,name=sequence_id,json=sequenceId,proto3" json:"sequence_id,omitempty"` + // Used by message event + Message []byte `protobuf:"bytes,17,opt,name=message,proto3" json:"message,omitempty"` + // The gRPC status code + StatusCode uint32 `protobuf:"varint,18,opt,name=status_code,json=statusCode,proto3" json:"status_code,omitempty"` + // The gRPC status message + StatusMessage string `protobuf:"bytes,19,opt,name=status_message,json=statusMessage,proto3" json:"status_message,omitempty"` + // The value of the grpc-status-details-bin metadata key, if any. + // This is always an encoded google.rpc.Status message + StatusDetails []byte `protobuf:"bytes,20,opt,name=status_details,json=statusDetails,proto3" json:"status_details,omitempty"` +} + +func (x *GrpcLogRecord) Reset() { + *x = GrpcLogRecord{} + if protoimpl.UnsafeEnabled { + mi := &file_observability_internal_logging_logging_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *GrpcLogRecord) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GrpcLogRecord) ProtoMessage() {} + +func (x *GrpcLogRecord) ProtoReflect() protoreflect.Message { + mi := &file_observability_internal_logging_logging_proto_msgTypes[0] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GrpcLogRecord.ProtoReflect.Descriptor instead. +func (*GrpcLogRecord) Descriptor() ([]byte, []int) { + return file_observability_internal_logging_logging_proto_rawDescGZIP(), []int{0} +} + +func (x *GrpcLogRecord) GetTimestamp() *timestamppb.Timestamp { + if x != nil { + return x.Timestamp + } + return nil +} + +func (x *GrpcLogRecord) GetRpcId() string { + if x != nil { + return x.RpcId + } + return "" +} + +func (x *GrpcLogRecord) GetEventType() GrpcLogRecord_EventType { + if x != nil { + return x.EventType + } + return GrpcLogRecord_GRPC_CALL_UNKNOWN +} + +func (x *GrpcLogRecord) GetEventLogger() GrpcLogRecord_EventLogger { + if x != nil { + return x.EventLogger + } + return GrpcLogRecord_LOGGER_UNKNOWN +} + +func (x *GrpcLogRecord) GetServiceName() string { + if x != nil { + return x.ServiceName + } + return "" +} + +func (x *GrpcLogRecord) GetMethodName() string { + if x != nil { + return x.MethodName + } + return "" +} + +func (x *GrpcLogRecord) GetLogLevel() GrpcLogRecord_LogLevel { + if x != nil { + return x.LogLevel + } + return GrpcLogRecord_LOG_LEVEL_UNKNOWN +} + +func (x *GrpcLogRecord) GetPeerAddress() *GrpcLogRecord_Address { + if x != nil { + return x.PeerAddress + } + return nil +} + +func (x *GrpcLogRecord) GetTimeout() *durationpb.Duration { + if x != nil { + return x.Timeout + } + return nil +} + +func (x *GrpcLogRecord) GetAuthority() string { + if x != nil { + return x.Authority + } + return "" +} + +func (x *GrpcLogRecord) GetPayloadSize() uint32 { + if x != nil { + return x.PayloadSize + } + return 0 +} + +func (x *GrpcLogRecord) GetPayloadTruncated() bool { + if x != nil { + return x.PayloadTruncated + } + return false +} + +func (x *GrpcLogRecord) GetMetadata() *GrpcLogRecord_Metadata { + if x != nil { + return x.Metadata + } + return nil +} + +func (x *GrpcLogRecord) GetSequenceId() uint64 { + if x != nil { + return x.SequenceId + } + return 0 +} + +func (x *GrpcLogRecord) GetMessage() []byte { + if x != nil { + return x.Message + } + return nil +} + +func (x *GrpcLogRecord) GetStatusCode() uint32 { + if x != nil { + return x.StatusCode + } + return 0 +} + +func (x *GrpcLogRecord) GetStatusMessage() string { + if x != nil { + return x.StatusMessage + } + return "" +} + +func (x *GrpcLogRecord) GetStatusDetails() []byte { + if x != nil { + return x.StatusDetails + } + return nil +} + +// A list of metadata pairs +type GrpcLogRecord_Metadata struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Entry []*GrpcLogRecord_MetadataEntry `protobuf:"bytes,1,rep,name=entry,proto3" json:"entry,omitempty"` +} + +func (x *GrpcLogRecord_Metadata) Reset() { + *x = GrpcLogRecord_Metadata{} + if protoimpl.UnsafeEnabled { + mi := &file_observability_internal_logging_logging_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *GrpcLogRecord_Metadata) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GrpcLogRecord_Metadata) ProtoMessage() {} + +func (x *GrpcLogRecord_Metadata) ProtoReflect() protoreflect.Message { + mi := &file_observability_internal_logging_logging_proto_msgTypes[1] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GrpcLogRecord_Metadata.ProtoReflect.Descriptor instead. +func (*GrpcLogRecord_Metadata) Descriptor() ([]byte, []int) { + return file_observability_internal_logging_logging_proto_rawDescGZIP(), []int{0, 0} +} + +func (x *GrpcLogRecord_Metadata) GetEntry() []*GrpcLogRecord_MetadataEntry { + if x != nil { + return x.Entry + } + return nil +} + +// One metadata key value pair +type GrpcLogRecord_MetadataEntry struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Key string `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"` + Value []byte `protobuf:"bytes,2,opt,name=value,proto3" json:"value,omitempty"` +} + +func (x *GrpcLogRecord_MetadataEntry) Reset() { + *x = GrpcLogRecord_MetadataEntry{} + if protoimpl.UnsafeEnabled { + mi := &file_observability_internal_logging_logging_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *GrpcLogRecord_MetadataEntry) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GrpcLogRecord_MetadataEntry) ProtoMessage() {} + +func (x *GrpcLogRecord_MetadataEntry) ProtoReflect() protoreflect.Message { + mi := &file_observability_internal_logging_logging_proto_msgTypes[2] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GrpcLogRecord_MetadataEntry.ProtoReflect.Descriptor instead. +func (*GrpcLogRecord_MetadataEntry) Descriptor() ([]byte, []int) { + return file_observability_internal_logging_logging_proto_rawDescGZIP(), []int{0, 1} +} + +func (x *GrpcLogRecord_MetadataEntry) GetKey() string { + if x != nil { + return x.Key + } + return "" +} + +func (x *GrpcLogRecord_MetadataEntry) GetValue() []byte { + if x != nil { + return x.Value + } + return nil +} + +// Address information +type GrpcLogRecord_Address struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Type GrpcLogRecord_Address_Type `protobuf:"varint,1,opt,name=type,proto3,enum=grpc.observability.logging.v1.GrpcLogRecord_Address_Type" json:"type,omitempty"` + Address string `protobuf:"bytes,2,opt,name=address,proto3" json:"address,omitempty"` + // only for TYPE_IPV4 and TYPE_IPV6 + IpPort uint32 `protobuf:"varint,3,opt,name=ip_port,json=ipPort,proto3" json:"ip_port,omitempty"` +} + +func (x *GrpcLogRecord_Address) Reset() { + *x = GrpcLogRecord_Address{} + if protoimpl.UnsafeEnabled { + mi := &file_observability_internal_logging_logging_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *GrpcLogRecord_Address) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GrpcLogRecord_Address) ProtoMessage() {} + +func (x *GrpcLogRecord_Address) ProtoReflect() protoreflect.Message { + mi := &file_observability_internal_logging_logging_proto_msgTypes[3] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GrpcLogRecord_Address.ProtoReflect.Descriptor instead. +func (*GrpcLogRecord_Address) Descriptor() ([]byte, []int) { + return file_observability_internal_logging_logging_proto_rawDescGZIP(), []int{0, 2} +} + +func (x *GrpcLogRecord_Address) GetType() GrpcLogRecord_Address_Type { + if x != nil { + return x.Type + } + return GrpcLogRecord_Address_TYPE_UNKNOWN +} + +func (x *GrpcLogRecord_Address) GetAddress() string { + if x != nil { + return x.Address + } + return "" +} + +func (x *GrpcLogRecord_Address) GetIpPort() uint32 { + if x != nil { + return x.IpPort + } + return 0 +} + +var File_observability_internal_logging_logging_proto protoreflect.FileDescriptor + +var file_observability_internal_logging_logging_proto_rawDesc = []byte{ + 0x0a, 0x2c, 0x6f, 0x62, 0x73, 0x65, 0x72, 0x76, 0x61, 0x62, 0x69, 0x6c, 0x69, 0x74, 0x79, 0x2f, + 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2f, 0x6c, 0x6f, 0x67, 0x67, 0x69, 0x6e, 0x67, + 0x2f, 0x6c, 0x6f, 0x67, 0x67, 0x69, 0x6e, 0x67, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x1d, + 0x67, 0x72, 0x70, 0x63, 0x2e, 0x6f, 0x62, 0x73, 0x65, 0x72, 0x76, 0x61, 0x62, 0x69, 0x6c, 0x69, + 0x74, 0x79, 0x2e, 0x6c, 0x6f, 0x67, 0x67, 0x69, 0x6e, 0x67, 0x2e, 0x76, 0x31, 0x1a, 0x1e, 0x67, + 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x64, + 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1f, 0x67, + 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x74, + 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xe5, + 0x0d, 0x0a, 0x0d, 0x47, 0x72, 0x70, 0x63, 0x4c, 0x6f, 0x67, 0x52, 0x65, 0x63, 0x6f, 0x72, 0x64, + 0x12, 0x38, 0x0a, 0x09, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x18, 0x01, 0x20, + 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x52, + 0x09, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x12, 0x15, 0x0a, 0x06, 0x72, 0x70, + 0x63, 0x5f, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x72, 0x70, 0x63, 0x49, + 0x64, 0x12, 0x55, 0x0a, 0x0a, 0x65, 0x76, 0x65, 0x6e, 0x74, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x18, + 0x03, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x36, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x6f, 0x62, 0x73, + 0x65, 0x72, 0x76, 0x61, 0x62, 0x69, 0x6c, 0x69, 0x74, 0x79, 0x2e, 0x6c, 0x6f, 0x67, 0x67, 0x69, + 0x6e, 0x67, 0x2e, 0x76, 0x31, 0x2e, 0x47, 0x72, 0x70, 0x63, 0x4c, 0x6f, 0x67, 0x52, 0x65, 0x63, + 0x6f, 0x72, 0x64, 0x2e, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x54, 0x79, 0x70, 0x65, 0x52, 0x09, 0x65, + 0x76, 0x65, 0x6e, 0x74, 0x54, 0x79, 0x70, 0x65, 0x12, 0x5b, 0x0a, 0x0c, 0x65, 0x76, 0x65, 0x6e, + 0x74, 0x5f, 0x6c, 0x6f, 0x67, 0x67, 0x65, 0x72, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x38, + 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x6f, 0x62, 0x73, 0x65, 0x72, 0x76, 0x61, 0x62, 0x69, 0x6c, + 0x69, 0x74, 0x79, 0x2e, 0x6c, 0x6f, 0x67, 0x67, 0x69, 0x6e, 0x67, 0x2e, 0x76, 0x31, 0x2e, 0x47, + 0x72, 0x70, 0x63, 0x4c, 0x6f, 0x67, 0x52, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x2e, 0x45, 0x76, 0x65, + 0x6e, 0x74, 0x4c, 0x6f, 0x67, 0x67, 0x65, 0x72, 0x52, 0x0b, 0x65, 0x76, 0x65, 0x6e, 0x74, 0x4c, + 0x6f, 0x67, 0x67, 0x65, 0x72, 0x12, 0x21, 0x0a, 0x0c, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, + 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x73, 0x65, 0x72, + 0x76, 0x69, 0x63, 0x65, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x1f, 0x0a, 0x0b, 0x6d, 0x65, 0x74, 0x68, + 0x6f, 0x64, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x6d, + 0x65, 0x74, 0x68, 0x6f, 0x64, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x52, 0x0a, 0x09, 0x6c, 0x6f, 0x67, + 0x5f, 0x6c, 0x65, 0x76, 0x65, 0x6c, 0x18, 0x07, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x35, 0x2e, 0x67, + 0x72, 0x70, 0x63, 0x2e, 0x6f, 0x62, 0x73, 0x65, 0x72, 0x76, 0x61, 0x62, 0x69, 0x6c, 0x69, 0x74, + 0x79, 0x2e, 0x6c, 0x6f, 0x67, 0x67, 0x69, 0x6e, 0x67, 0x2e, 0x76, 0x31, 0x2e, 0x47, 0x72, 0x70, + 0x63, 0x4c, 0x6f, 0x67, 0x52, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x2e, 0x4c, 0x6f, 0x67, 0x4c, 0x65, + 0x76, 0x65, 0x6c, 0x52, 0x08, 0x6c, 0x6f, 0x67, 0x4c, 0x65, 0x76, 0x65, 0x6c, 0x12, 0x57, 0x0a, + 0x0c, 0x70, 0x65, 0x65, 0x72, 0x5f, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x18, 0x08, 0x20, + 0x01, 0x28, 0x0b, 0x32, 0x34, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x6f, 0x62, 0x73, 0x65, 0x72, + 0x76, 0x61, 0x62, 0x69, 0x6c, 0x69, 0x74, 0x79, 0x2e, 0x6c, 0x6f, 0x67, 0x67, 0x69, 0x6e, 0x67, + 0x2e, 0x76, 0x31, 0x2e, 0x47, 0x72, 0x70, 0x63, 0x4c, 0x6f, 0x67, 0x52, 0x65, 0x63, 0x6f, 0x72, + 0x64, 0x2e, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x52, 0x0b, 0x70, 0x65, 0x65, 0x72, 0x41, + 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x12, 0x33, 0x0a, 0x07, 0x74, 0x69, 0x6d, 0x65, 0x6f, 0x75, + 0x74, 0x18, 0x0b, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, + 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x44, 0x75, 0x72, 0x61, 0x74, 0x69, + 0x6f, 0x6e, 0x52, 0x07, 0x74, 0x69, 0x6d, 0x65, 0x6f, 0x75, 0x74, 0x12, 0x1c, 0x0a, 0x09, 0x61, + 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x74, 0x79, 0x18, 0x0c, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, + 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x74, 0x79, 0x12, 0x21, 0x0a, 0x0c, 0x70, 0x61, 0x79, + 0x6c, 0x6f, 0x61, 0x64, 0x5f, 0x73, 0x69, 0x7a, 0x65, 0x18, 0x0d, 0x20, 0x01, 0x28, 0x0d, 0x52, + 0x0b, 0x70, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x53, 0x69, 0x7a, 0x65, 0x12, 0x2b, 0x0a, 0x11, + 0x70, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x5f, 0x74, 0x72, 0x75, 0x6e, 0x63, 0x61, 0x74, 0x65, + 0x64, 0x18, 0x0e, 0x20, 0x01, 0x28, 0x08, 0x52, 0x10, 0x70, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, + 0x54, 0x72, 0x75, 0x6e, 0x63, 0x61, 0x74, 0x65, 0x64, 0x12, 0x51, 0x0a, 0x08, 0x6d, 0x65, 0x74, + 0x61, 0x64, 0x61, 0x74, 0x61, 0x18, 0x0f, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x35, 0x2e, 0x67, 0x72, + 0x70, 0x63, 0x2e, 0x6f, 0x62, 0x73, 0x65, 0x72, 0x76, 0x61, 0x62, 0x69, 0x6c, 0x69, 0x74, 0x79, + 0x2e, 0x6c, 0x6f, 0x67, 0x67, 0x69, 0x6e, 0x67, 0x2e, 0x76, 0x31, 0x2e, 0x47, 0x72, 0x70, 0x63, + 0x4c, 0x6f, 0x67, 0x52, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x2e, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, + 0x74, 0x61, 0x52, 0x08, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x12, 0x1f, 0x0a, 0x0b, + 0x73, 0x65, 0x71, 0x75, 0x65, 0x6e, 0x63, 0x65, 0x5f, 0x69, 0x64, 0x18, 0x10, 0x20, 0x01, 0x28, + 0x04, 0x52, 0x0a, 0x73, 0x65, 0x71, 0x75, 0x65, 0x6e, 0x63, 0x65, 0x49, 0x64, 0x12, 0x18, 0x0a, + 0x07, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x18, 0x11, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x07, + 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x12, 0x1f, 0x0a, 0x0b, 0x73, 0x74, 0x61, 0x74, 0x75, + 0x73, 0x5f, 0x63, 0x6f, 0x64, 0x65, 0x18, 0x12, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x0a, 0x73, 0x74, + 0x61, 0x74, 0x75, 0x73, 0x43, 0x6f, 0x64, 0x65, 0x12, 0x25, 0x0a, 0x0e, 0x73, 0x74, 0x61, 0x74, + 0x75, 0x73, 0x5f, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x18, 0x13, 0x20, 0x01, 0x28, 0x09, + 0x52, 0x0d, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x12, + 0x25, 0x0a, 0x0e, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x5f, 0x64, 0x65, 0x74, 0x61, 0x69, 0x6c, + 0x73, 0x18, 0x14, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x0d, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x44, + 0x65, 0x74, 0x61, 0x69, 0x6c, 0x73, 0x1a, 0x5c, 0x0a, 0x08, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, + 0x74, 0x61, 0x12, 0x50, 0x0a, 0x05, 0x65, 0x6e, 0x74, 0x72, 0x79, 0x18, 0x01, 0x20, 0x03, 0x28, + 0x0b, 0x32, 0x3a, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x6f, 0x62, 0x73, 0x65, 0x72, 0x76, 0x61, + 0x62, 0x69, 0x6c, 0x69, 0x74, 0x79, 0x2e, 0x6c, 0x6f, 0x67, 0x67, 0x69, 0x6e, 0x67, 0x2e, 0x76, + 0x31, 0x2e, 0x47, 0x72, 0x70, 0x63, 0x4c, 0x6f, 0x67, 0x52, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x2e, + 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x05, 0x65, + 0x6e, 0x74, 0x72, 0x79, 0x1a, 0x37, 0x0a, 0x0d, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, + 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, + 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, + 0x18, 0x02, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x1a, 0xd2, 0x01, + 0x0a, 0x07, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x12, 0x4d, 0x0a, 0x04, 0x74, 0x79, 0x70, + 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x39, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x6f, + 0x62, 0x73, 0x65, 0x72, 0x76, 0x61, 0x62, 0x69, 0x6c, 0x69, 0x74, 0x79, 0x2e, 0x6c, 0x6f, 0x67, + 0x67, 0x69, 0x6e, 0x67, 0x2e, 0x76, 0x31, 0x2e, 0x47, 0x72, 0x70, 0x63, 0x4c, 0x6f, 0x67, 0x52, + 0x65, 0x63, 0x6f, 0x72, 0x64, 0x2e, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x2e, 0x54, 0x79, + 0x70, 0x65, 0x52, 0x04, 0x74, 0x79, 0x70, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x61, 0x64, 0x64, 0x72, + 0x65, 0x73, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, + 0x73, 0x73, 0x12, 0x17, 0x0a, 0x07, 0x69, 0x70, 0x5f, 0x70, 0x6f, 0x72, 0x74, 0x18, 0x03, 0x20, + 0x01, 0x28, 0x0d, 0x52, 0x06, 0x69, 0x70, 0x50, 0x6f, 0x72, 0x74, 0x22, 0x45, 0x0a, 0x04, 0x54, + 0x79, 0x70, 0x65, 0x12, 0x10, 0x0a, 0x0c, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x55, 0x4e, 0x4b, 0x4e, + 0x4f, 0x57, 0x4e, 0x10, 0x00, 0x12, 0x0d, 0x0a, 0x09, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x49, 0x50, + 0x56, 0x34, 0x10, 0x01, 0x12, 0x0d, 0x0a, 0x09, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x49, 0x50, 0x56, + 0x36, 0x10, 0x02, 0x12, 0x0d, 0x0a, 0x09, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x55, 0x4e, 0x49, 0x58, + 0x10, 0x03, 0x22, 0xe5, 0x01, 0x0a, 0x09, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x54, 0x79, 0x70, 0x65, + 0x12, 0x15, 0x0a, 0x11, 0x47, 0x52, 0x50, 0x43, 0x5f, 0x43, 0x41, 0x4c, 0x4c, 0x5f, 0x55, 0x4e, + 0x4b, 0x4e, 0x4f, 0x57, 0x4e, 0x10, 0x00, 0x12, 0x1c, 0x0a, 0x18, 0x47, 0x52, 0x50, 0x43, 0x5f, + 0x43, 0x41, 0x4c, 0x4c, 0x5f, 0x52, 0x45, 0x51, 0x55, 0x45, 0x53, 0x54, 0x5f, 0x48, 0x45, 0x41, + 0x44, 0x45, 0x52, 0x10, 0x01, 0x12, 0x1d, 0x0a, 0x19, 0x47, 0x52, 0x50, 0x43, 0x5f, 0x43, 0x41, + 0x4c, 0x4c, 0x5f, 0x52, 0x45, 0x53, 0x50, 0x4f, 0x4e, 0x53, 0x45, 0x5f, 0x48, 0x45, 0x41, 0x44, + 0x45, 0x52, 0x10, 0x02, 0x12, 0x1d, 0x0a, 0x19, 0x47, 0x52, 0x50, 0x43, 0x5f, 0x43, 0x41, 0x4c, + 0x4c, 0x5f, 0x52, 0x45, 0x51, 0x55, 0x45, 0x53, 0x54, 0x5f, 0x4d, 0x45, 0x53, 0x53, 0x41, 0x47, + 0x45, 0x10, 0x03, 0x12, 0x1e, 0x0a, 0x1a, 0x47, 0x52, 0x50, 0x43, 0x5f, 0x43, 0x41, 0x4c, 0x4c, + 0x5f, 0x52, 0x45, 0x53, 0x50, 0x4f, 0x4e, 0x53, 0x45, 0x5f, 0x4d, 0x45, 0x53, 0x53, 0x41, 0x47, + 0x45, 0x10, 0x04, 0x12, 0x15, 0x0a, 0x11, 0x47, 0x52, 0x50, 0x43, 0x5f, 0x43, 0x41, 0x4c, 0x4c, + 0x5f, 0x54, 0x52, 0x41, 0x49, 0x4c, 0x45, 0x52, 0x10, 0x05, 0x12, 0x18, 0x0a, 0x14, 0x47, 0x52, + 0x50, 0x43, 0x5f, 0x43, 0x41, 0x4c, 0x4c, 0x5f, 0x48, 0x41, 0x4c, 0x46, 0x5f, 0x43, 0x4c, 0x4f, + 0x53, 0x45, 0x10, 0x06, 0x12, 0x14, 0x0a, 0x10, 0x47, 0x52, 0x50, 0x43, 0x5f, 0x43, 0x41, 0x4c, + 0x4c, 0x5f, 0x43, 0x41, 0x4e, 0x43, 0x45, 0x4c, 0x10, 0x07, 0x22, 0x47, 0x0a, 0x0b, 0x45, 0x76, + 0x65, 0x6e, 0x74, 0x4c, 0x6f, 0x67, 0x67, 0x65, 0x72, 0x12, 0x12, 0x0a, 0x0e, 0x4c, 0x4f, 0x47, + 0x47, 0x45, 0x52, 0x5f, 0x55, 0x4e, 0x4b, 0x4e, 0x4f, 0x57, 0x4e, 0x10, 0x00, 0x12, 0x11, 0x0a, + 0x0d, 0x4c, 0x4f, 0x47, 0x47, 0x45, 0x52, 0x5f, 0x43, 0x4c, 0x49, 0x45, 0x4e, 0x54, 0x10, 0x01, + 0x12, 0x11, 0x0a, 0x0d, 0x4c, 0x4f, 0x47, 0x47, 0x45, 0x52, 0x5f, 0x53, 0x45, 0x52, 0x56, 0x45, + 0x52, 0x10, 0x02, 0x22, 0xa0, 0x01, 0x0a, 0x08, 0x4c, 0x6f, 0x67, 0x4c, 0x65, 0x76, 0x65, 0x6c, + 0x12, 0x15, 0x0a, 0x11, 0x4c, 0x4f, 0x47, 0x5f, 0x4c, 0x45, 0x56, 0x45, 0x4c, 0x5f, 0x55, 0x4e, + 0x4b, 0x4e, 0x4f, 0x57, 0x4e, 0x10, 0x00, 0x12, 0x13, 0x0a, 0x0f, 0x4c, 0x4f, 0x47, 0x5f, 0x4c, + 0x45, 0x56, 0x45, 0x4c, 0x5f, 0x54, 0x52, 0x41, 0x43, 0x45, 0x10, 0x01, 0x12, 0x13, 0x0a, 0x0f, + 0x4c, 0x4f, 0x47, 0x5f, 0x4c, 0x45, 0x56, 0x45, 0x4c, 0x5f, 0x44, 0x45, 0x42, 0x55, 0x47, 0x10, + 0x02, 0x12, 0x12, 0x0a, 0x0e, 0x4c, 0x4f, 0x47, 0x5f, 0x4c, 0x45, 0x56, 0x45, 0x4c, 0x5f, 0x49, + 0x4e, 0x46, 0x4f, 0x10, 0x03, 0x12, 0x12, 0x0a, 0x0e, 0x4c, 0x4f, 0x47, 0x5f, 0x4c, 0x45, 0x56, + 0x45, 0x4c, 0x5f, 0x57, 0x41, 0x52, 0x4e, 0x10, 0x04, 0x12, 0x13, 0x0a, 0x0f, 0x4c, 0x4f, 0x47, + 0x5f, 0x4c, 0x45, 0x56, 0x45, 0x4c, 0x5f, 0x45, 0x52, 0x52, 0x4f, 0x52, 0x10, 0x05, 0x12, 0x16, + 0x0a, 0x12, 0x4c, 0x4f, 0x47, 0x5f, 0x4c, 0x45, 0x56, 0x45, 0x4c, 0x5f, 0x43, 0x52, 0x49, 0x54, + 0x49, 0x43, 0x41, 0x4c, 0x10, 0x06, 0x42, 0x73, 0x0a, 0x1d, 0x69, 0x6f, 0x2e, 0x67, 0x72, 0x70, + 0x63, 0x2e, 0x6f, 0x62, 0x73, 0x65, 0x72, 0x76, 0x61, 0x62, 0x69, 0x6c, 0x69, 0x74, 0x79, 0x2e, + 0x6c, 0x6f, 0x67, 0x67, 0x69, 0x6e, 0x67, 0x42, 0x19, 0x4f, 0x62, 0x73, 0x65, 0x72, 0x76, 0x61, + 0x62, 0x69, 0x6c, 0x69, 0x74, 0x79, 0x4c, 0x6f, 0x67, 0x67, 0x69, 0x6e, 0x67, 0x50, 0x72, 0x6f, + 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x35, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x67, 0x6f, 0x6c, + 0x61, 0x6e, 0x67, 0x2e, 0x6f, 0x72, 0x67, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x2f, 0x6f, 0x62, 0x73, + 0x65, 0x72, 0x76, 0x61, 0x62, 0x69, 0x6c, 0x69, 0x74, 0x79, 0x2f, 0x69, 0x6e, 0x74, 0x65, 0x72, + 0x6e, 0x61, 0x6c, 0x2f, 0x6c, 0x6f, 0x67, 0x67, 0x69, 0x6e, 0x67, 0x62, 0x06, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x33, +} + +var ( + file_observability_internal_logging_logging_proto_rawDescOnce sync.Once + file_observability_internal_logging_logging_proto_rawDescData = file_observability_internal_logging_logging_proto_rawDesc +) + +func file_observability_internal_logging_logging_proto_rawDescGZIP() []byte { + file_observability_internal_logging_logging_proto_rawDescOnce.Do(func() { + file_observability_internal_logging_logging_proto_rawDescData = protoimpl.X.CompressGZIP(file_observability_internal_logging_logging_proto_rawDescData) + }) + return file_observability_internal_logging_logging_proto_rawDescData +} + +var file_observability_internal_logging_logging_proto_enumTypes = make([]protoimpl.EnumInfo, 4) +var file_observability_internal_logging_logging_proto_msgTypes = make([]protoimpl.MessageInfo, 4) +var file_observability_internal_logging_logging_proto_goTypes = []interface{}{ + (GrpcLogRecord_EventType)(0), // 0: grpc.observability.logging.v1.GrpcLogRecord.EventType + (GrpcLogRecord_EventLogger)(0), // 1: grpc.observability.logging.v1.GrpcLogRecord.EventLogger + (GrpcLogRecord_LogLevel)(0), // 2: grpc.observability.logging.v1.GrpcLogRecord.LogLevel + (GrpcLogRecord_Address_Type)(0), // 3: grpc.observability.logging.v1.GrpcLogRecord.Address.Type + (*GrpcLogRecord)(nil), // 4: grpc.observability.logging.v1.GrpcLogRecord + (*GrpcLogRecord_Metadata)(nil), // 5: grpc.observability.logging.v1.GrpcLogRecord.Metadata + (*GrpcLogRecord_MetadataEntry)(nil), // 6: grpc.observability.logging.v1.GrpcLogRecord.MetadataEntry + (*GrpcLogRecord_Address)(nil), // 7: grpc.observability.logging.v1.GrpcLogRecord.Address + (*timestamppb.Timestamp)(nil), // 8: google.protobuf.Timestamp + (*durationpb.Duration)(nil), // 9: google.protobuf.Duration +} +var file_observability_internal_logging_logging_proto_depIdxs = []int32{ + 8, // 0: grpc.observability.logging.v1.GrpcLogRecord.timestamp:type_name -> google.protobuf.Timestamp + 0, // 1: grpc.observability.logging.v1.GrpcLogRecord.event_type:type_name -> grpc.observability.logging.v1.GrpcLogRecord.EventType + 1, // 2: grpc.observability.logging.v1.GrpcLogRecord.event_logger:type_name -> grpc.observability.logging.v1.GrpcLogRecord.EventLogger + 2, // 3: grpc.observability.logging.v1.GrpcLogRecord.log_level:type_name -> grpc.observability.logging.v1.GrpcLogRecord.LogLevel + 7, // 4: grpc.observability.logging.v1.GrpcLogRecord.peer_address:type_name -> grpc.observability.logging.v1.GrpcLogRecord.Address + 9, // 5: grpc.observability.logging.v1.GrpcLogRecord.timeout:type_name -> google.protobuf.Duration + 5, // 6: grpc.observability.logging.v1.GrpcLogRecord.metadata:type_name -> grpc.observability.logging.v1.GrpcLogRecord.Metadata + 6, // 7: grpc.observability.logging.v1.GrpcLogRecord.Metadata.entry:type_name -> grpc.observability.logging.v1.GrpcLogRecord.MetadataEntry + 3, // 8: grpc.observability.logging.v1.GrpcLogRecord.Address.type:type_name -> grpc.observability.logging.v1.GrpcLogRecord.Address.Type + 9, // [9:9] is the sub-list for method output_type + 9, // [9:9] is the sub-list for method input_type + 9, // [9:9] is the sub-list for extension type_name + 9, // [9:9] is the sub-list for extension extendee + 0, // [0:9] is the sub-list for field type_name +} + +func init() { file_observability_internal_logging_logging_proto_init() } +func file_observability_internal_logging_logging_proto_init() { + if File_observability_internal_logging_logging_proto != nil { + return + } + if !protoimpl.UnsafeEnabled { + file_observability_internal_logging_logging_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*GrpcLogRecord); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_observability_internal_logging_logging_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*GrpcLogRecord_Metadata); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_observability_internal_logging_logging_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*GrpcLogRecord_MetadataEntry); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_observability_internal_logging_logging_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*GrpcLogRecord_Address); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_observability_internal_logging_logging_proto_rawDesc, + NumEnums: 4, + NumMessages: 4, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_observability_internal_logging_logging_proto_goTypes, + DependencyIndexes: file_observability_internal_logging_logging_proto_depIdxs, + EnumInfos: file_observability_internal_logging_logging_proto_enumTypes, + MessageInfos: file_observability_internal_logging_logging_proto_msgTypes, + }.Build() + File_observability_internal_logging_logging_proto = out.File + file_observability_internal_logging_logging_proto_rawDesc = nil + file_observability_internal_logging_logging_proto_goTypes = nil + file_observability_internal_logging_logging_proto_depIdxs = nil +} diff --git a/observability/internal/logging/logging.proto b/observability/internal/logging/logging.proto new file mode 100644 index 00000000000..5c6f645be3d --- /dev/null +++ b/observability/internal/logging/logging.proto @@ -0,0 +1,153 @@ +// Copyright 2022 The gRPC Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package grpc.observability.logging.v1; + +import "google/protobuf/duration.proto"; +import "google/protobuf/timestamp.proto"; + +option java_package = "io.grpc.observability.logging"; +option java_multiple_files = true; +option java_outer_classname = "ObservabilityLoggingProto"; +option go_package = "google.golang.org/grpc/observability/internal/logging"; + +message GrpcLogRecord { + // List of event types + enum EventType { + // Unknown event type + GRPC_CALL_UNKNOWN = 0; + // Header sent from client to server + GRPC_CALL_REQUEST_HEADER = 1; + // Header sent from server to client + GRPC_CALL_RESPONSE_HEADER = 2; + // Message sent from client to server + GRPC_CALL_REQUEST_MESSAGE = 3; + // Message sent from server to client + GRPC_CALL_RESPONSE_MESSAGE = 4; + // Trailer indicates the end of the gRPC call + GRPC_CALL_TRAILER = 5; + // A signal that client is done sending + GRPC_CALL_HALF_CLOSE = 6; + // A signal that the rpc is canceled + GRPC_CALL_CANCEL = 7; + } + // The entity that generates the log entry + enum EventLogger { + LOGGER_UNKNOWN = 0; + LOGGER_CLIENT = 1; + LOGGER_SERVER = 2; + } + // The log severity level of the log entry + enum LogLevel { + LOG_LEVEL_UNKNOWN = 0; + LOG_LEVEL_TRACE = 1; + LOG_LEVEL_DEBUG = 2; + LOG_LEVEL_INFO = 3; + LOG_LEVEL_WARN = 4; + LOG_LEVEL_ERROR = 5; + LOG_LEVEL_CRITICAL = 6; + } + + // The timestamp of the log event + google.protobuf.Timestamp timestamp = 1; + + // Uniquely identifies a call. The value must not be 0 in order to disambiguate + // from an unset value. + // Each call may have several log entries. They will all have the same rpc_id. + // Nothing is guaranteed about their value other than they are unique across + // different RPCs in the same gRPC process. + string rpc_id = 2; + + EventType event_type = 3; // one of the above EventType enum + EventLogger event_logger = 4; // one of the above EventLogger enum + + // the name of the service + string service_name = 5; + // the name of the RPC method + string method_name = 6; + + LogLevel log_level = 7; // one of the above LogLevel enum + + // Peer address information. On client side, peer is logged on server + // header event or trailer event (if trailer-only). On server side, peer + // is always logged on the client header event. + Address peer_address = 8; + + // the RPC timeout value + google.protobuf.Duration timeout = 11; + + // A single process may be used to run multiple virtual servers with + // different identities. + // The authority is the name of such a server identify. It is typically a + // portion of the URI in the form of or :. + string authority = 12; + + // Size of the message or metadata, depending on the event type, + // regardless of whether the full message or metadata is being logged + // (i.e. could be truncated or omitted). + uint32 payload_size = 13; + + // true if message or metadata field is either truncated or omitted due + // to config options + bool payload_truncated = 14; + + // Used by header event or trailer event + Metadata metadata = 15; + + // The entry sequence ID for this call. The first message has a value of 1, + // to disambiguate from an unset value. The purpose of this field is to + // detect missing entries in environments where durability or ordering is + // not guaranteed. + uint64 sequence_id = 16; + + // Used by message event + bytes message = 17; + + // The gRPC status code + uint32 status_code = 18; + + // The gRPC status message + string status_message = 19; + + // The value of the grpc-status-details-bin metadata key, if any. + // This is always an encoded google.rpc.Status message + bytes status_details = 20; + + // A list of metadata pairs + message Metadata { + repeated MetadataEntry entry = 1; + } + + // One metadata key value pair + message MetadataEntry { + string key = 1; + bytes value = 2; + } + + // Address information + message Address { + enum Type { + TYPE_UNKNOWN = 0; + TYPE_IPV4 = 1; // in 1.2.3.4 form + TYPE_IPV6 = 2; // IPv6 canonical form (RFC5952 section 4) + TYPE_UNIX = 3; // UDS string + } + Type type = 1; + string address = 2; + // only for TYPE_IPV4 and TYPE_IPV6 + uint32 ip_port = 3; + } +} diff --git a/observability/logging.go b/observability/logging.go new file mode 100644 index 00000000000..6baf1e49ac0 --- /dev/null +++ b/observability/logging.go @@ -0,0 +1,271 @@ +/* + * + * Copyright 2022 gRPC authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +package observability + +import ( + "fmt" + "net" + "strings" + "time" + + "github.com/golang/protobuf/ptypes" + "github.com/google/uuid" + binlogpb "google.golang.org/grpc/binarylog/grpc_binarylog_v1" + iblog "google.golang.org/grpc/internal/binarylog" + "google.golang.org/grpc/metadata" + configpb "google.golang.org/grpc/observability/internal/config" + grpclogrecordpb "google.golang.org/grpc/observability/internal/logging" + "google.golang.org/grpc/status" + "google.golang.org/protobuf/proto" +) + +func setMetadataToGrpcLogRecord(lr *grpclogrecordpb.GrpcLogRecord, m metadata.MD, mlc *iblog.MethodLoggerConfig) { + mdPb := iblog.MdToMetadataProto(m) + lr.PayloadTruncated = iblog.TruncateMetadata(mlc, mdPb) + lr.Metadata = &grpclogrecordpb.GrpcLogRecord_Metadata{ + Entry: make([]*grpclogrecordpb.GrpcLogRecord_MetadataEntry, len(mdPb.GetEntry())), + } + for i, e := range mdPb.GetEntry() { + lr.Metadata.Entry[i] = &grpclogrecordpb.GrpcLogRecord_MetadataEntry{ + Key: e.Key, + Value: e.Value, + } + } +} + +func setPeerToGrpcLogRecord(lr *grpclogrecordpb.GrpcLogRecord, peer net.Addr) { + if peer != nil { + peerPb := iblog.AddrToProto(peer) + lr.PeerAddress = &grpclogrecordpb.GrpcLogRecord_Address{ + Type: grpclogrecordpb.GrpcLogRecord_Address_Type(peerPb.GetType()), + Address: peerPb.GetAddress(), + IpPort: peerPb.GetIpPort(), + } + } +} + +func setMessageToGrpcLogRecord(lr *grpclogrecordpb.GrpcLogRecord, msg interface{}, mlc *iblog.MethodLoggerConfig) { + var ( + data []byte + err error + ) + if m, ok := msg.(proto.Message); ok { + data, err = proto.Marshal(m) + if err != nil { + logger.Infof("failed to marshal proto message: %v", err) + } + } else if b, ok := msg.([]byte); ok { + data = b + } else { + logger.Infof("message to log is neither proto.message nor []byte") + } + msgPb := &binlogpb.Message{ + Length: uint32(len(data)), + Data: data, + } + lr.PayloadTruncated = iblog.TruncateMessage(mlc, msgPb) + lr.Message = msgPb.Data + lr.PayloadSize = msgPb.Length +} + +func getEventLogger(isClient bool) grpclogrecordpb.GrpcLogRecord_EventLogger { + if isClient { + return grpclogrecordpb.GrpcLogRecord_LOGGER_CLIENT + } + return grpclogrecordpb.GrpcLogRecord_LOGGER_SERVER +} + +type observabilityBinaryMethodLogger struct { + rpcID, serviceName, methodName string + sequenceIDGen iblog.CallIDGenerator + originalMethodLogger iblog.MethodLogger + methodLoggerConfig *iblog.MethodLoggerConfig +} + +func (ml *observabilityBinaryMethodLogger) Log(c iblog.LogEntryConfig) { + // Invoke the original MethodLogger to maintain backward compatibility + if ml.originalMethodLogger != nil { + ml.originalMethodLogger.Log(c) + } + + timestamp, err := ptypes.TimestampProto(time.Now()) + if err != nil { + logger.Errorf("Failed to convert time.Now() to TimestampProto: %v", err) + } + grpcLogRecord := &grpclogrecordpb.GrpcLogRecord{ + Timestamp: timestamp, + RpcId: ml.rpcID, + SequenceId: ml.sequenceIDGen.Next(), + // Making DEBUG the default LogLevel + LogLevel: grpclogrecordpb.GrpcLogRecord_LOG_LEVEL_DEBUG, + } + switch v := c.(type) { + case *iblog.ClientHeader: + grpcLogRecord.EventType = grpclogrecordpb.GrpcLogRecord_GRPC_CALL_REQUEST_HEADER + grpcLogRecord.EventLogger = getEventLogger(v.OnClientSide) + methodName := v.MethodName + if strings.Contains(methodName, "/") { + tokens := strings.Split(methodName, "/") + if len(tokens) == 3 { + // Example method name: /grpc.testing.TestService/UnaryCall + ml.serviceName = tokens[1] + ml.methodName = tokens[2] + } else if len(tokens) == 2 { + // Example method name: grpc.testing.TestService/UnaryCall + ml.serviceName = tokens[0] + ml.methodName = tokens[1] + } else { + logger.Errorf("Malformed method name: %v", methodName) + } + } + grpcLogRecord.Timeout = ptypes.DurationProto(v.Timeout) + grpcLogRecord.Authority = v.Authority + setMetadataToGrpcLogRecord(grpcLogRecord, v.Header, ml.methodLoggerConfig) + setPeerToGrpcLogRecord(grpcLogRecord, v.PeerAddr) + case *iblog.ServerHeader: + grpcLogRecord.EventType = grpclogrecordpb.GrpcLogRecord_GRPC_CALL_RESPONSE_HEADER + grpcLogRecord.EventLogger = getEventLogger(v.OnClientSide) + setMetadataToGrpcLogRecord(grpcLogRecord, v.Header, ml.methodLoggerConfig) + setPeerToGrpcLogRecord(grpcLogRecord, v.PeerAddr) + case *iblog.ClientMessage: + grpcLogRecord.EventType = grpclogrecordpb.GrpcLogRecord_GRPC_CALL_REQUEST_MESSAGE + grpcLogRecord.EventLogger = getEventLogger(v.OnClientSide) + setMessageToGrpcLogRecord(grpcLogRecord, v.Message, ml.methodLoggerConfig) + case *iblog.ServerMessage: + grpcLogRecord.EventType = grpclogrecordpb.GrpcLogRecord_GRPC_CALL_RESPONSE_MESSAGE + grpcLogRecord.EventLogger = getEventLogger(v.OnClientSide) + setMessageToGrpcLogRecord(grpcLogRecord, v.Message, ml.methodLoggerConfig) + case *iblog.ClientHalfClose: + grpcLogRecord.EventType = grpclogrecordpb.GrpcLogRecord_GRPC_CALL_HALF_CLOSE + grpcLogRecord.EventLogger = getEventLogger(v.OnClientSide) + case *iblog.ServerTrailer: + grpcLogRecord.EventType = grpclogrecordpb.GrpcLogRecord_GRPC_CALL_TRAILER + grpcLogRecord.EventLogger = getEventLogger(v.OnClientSide) + setMetadataToGrpcLogRecord(grpcLogRecord, v.Trailer, ml.methodLoggerConfig) + setPeerToGrpcLogRecord(grpcLogRecord, v.PeerAddr) + st, ok := status.FromError(v.Err) + if !ok { + logger.Info("Error in trailer is not a status error") + } + stProto := st.Proto() + if stProto != nil && len(stProto.Details) != 0 { + detailsBytes, err := proto.Marshal(stProto) + if err != nil { + logger.Infof("Failed to marshal status proto: %v", err) + } else { + grpcLogRecord.StatusDetails = detailsBytes + } + } + grpcLogRecord.StatusCode = uint32(st.Code()) + grpcLogRecord.StatusMessage = st.Message() + case *iblog.Cancel: + grpcLogRecord.EventType = grpclogrecordpb.GrpcLogRecord_GRPC_CALL_CANCEL + grpcLogRecord.EventLogger = getEventLogger(v.OnClientSide) + default: + logger.Errorf("Unexpected LogEntryConfig: %+v", c) + return + } + + if ml.serviceName != "" { + grpcLogRecord.ServiceName = ml.serviceName + } + if ml.methodName != "" { + grpcLogRecord.MethodName = ml.methodName + } + + // CloudLogging client doesn't return error on entry write. Entry writes + // don't mean the data will be uploaded immediately. + globalLoggingExporter.EmitGrpcLogRecord(grpcLogRecord) +} + +type observabilityBinaryLogger struct { + // originalLogger is needed to ensure binary logging users won't be impacted + // by this plugin. Users are allowed to subscribe to a completely different + // set of methods. + originalLogger iblog.Logger + // wrappedLogger is needed to reuse the control string parsing, logger + // config managing logic + wrappedLogger iblog.Logger +} + +func (l *observabilityBinaryLogger) GetMethodLoggerConfig(methodName string) *iblog.MethodLoggerConfig { + if l.wrappedLogger == nil { + return nil + } + return l.wrappedLogger.GetMethodLoggerConfig(methodName) +} + +func (l *observabilityBinaryLogger) GetMethodLogger(methodName string) iblog.MethodLogger { + var ol iblog.MethodLogger + if l.originalLogger != nil { + ol = l.originalLogger.GetMethodLogger(methodName) + } + + mlc := l.GetMethodLoggerConfig(methodName) + if mlc == nil { + return ol + } + return &observabilityBinaryMethodLogger{ + originalMethodLogger: ol, + methodLoggerConfig: mlc, + rpcID: uuid.NewString(), + } +} + +func newObservabilityBinaryLogger(iblogger iblog.Logger) *observabilityBinaryLogger { + return &observabilityBinaryLogger{ + originalLogger: iblogger, + } +} + +func compileBinaryLogControlString(config *configpb.ObservabilityConfig) string { + if len(config.LogFilters) == 0 { + return "" + } + + entries := make([]string, 0, len(config.LogFilters)+1) + for _, logFilter := range config.LogFilters { + // With undefined HeaderBytes or MessageBytes, the intended behavior is + // logging zero payload. This detail is different than binary logging. + entries = append(entries, fmt.Sprintf("%v{h:%v;m:%v}", logFilter.Pattern, logFilter.HeaderBytes, logFilter.MessageBytes)) + } + // 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. + entries = append(entries, "-google.logging.v2.LoggingServiceV2/WriteLogEntries") + return strings.Join(entries, ",") +} + +var defaultLogger *observabilityBinaryLogger + +func prepareLogging() { + defaultLogger = newObservabilityBinaryLogger(iblog.GetLogger()) + iblog.SetLogger(defaultLogger) +} + +func startLogging(config *configpb.ObservabilityConfig) { + if config == nil { + return + } + binlogConfig := compileBinaryLogControlString(config) + defaultLogger.wrappedLogger = iblog.NewLoggerFromConfigString(binlogConfig) + logger.Infof("Start logging with config [%v]", binlogConfig) +} diff --git a/observability/observability.go b/observability/observability.go new file mode 100644 index 00000000000..483c8dadcc2 --- /dev/null +++ b/observability/observability.go @@ -0,0 +1,83 @@ +/* + * + * Copyright 2022 gRPC authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +// Package observability implements the tracing, metrics, and logging data +// collection, and provides controlling knobs via a config file. +// +// Experimental +// +// Notice: This package is EXPERIMENTAL and may be changed or removed in a +// later release. +package observability + +import ( + "context" + "fmt" + + "google.golang.org/grpc/grpclog" +) + +var logger = grpclog.Component("observability") + +func init() { + prepareLogging() +} + +// Start is the opt-in API for gRPC Observability plugin. This function should +// be invoked in the main function, and before creating any gRPC clients or +// servers, otherwise, they might not be instrumented. At high-level, this +// module does the following: +// +// - it loads observability config from environment; +// - it registers default exporters if not disabled by the config; +// - it sets up binary logging sink against the logging exporter. +// +// Note: this method should only be invoked once, it's not thread-safe. +// Note: currently, the binarylog module only supports one sink, so using the +// "observability" module will conflict with existing binarylog usage. +// Note: handle the error +func Start(ctx context.Context) error { + config := parseObservabilityConfig() + if config == nil { + return fmt.Errorf("no ObservabilityConfig found, it can be set via env %s", envObservabilityConfig) + } + + // Set the project ID if it isn't configured manually. + maybeUpdateProjectIDInObservabilityConfig(ctx, config) + + // Logging is controlled by the config at methods level. + startLogging(config) + + if config.GetDestinationProjectId() == "" || !config.GetEnableCloudLogging() { + return nil + } + if err := createDefaultLoggingExporter(ctx, config.DestinationProjectId); err != nil { + return err + } + return nil +} + +// End is the clean-up API for gRPC Observability plugin. It is expected to be +// invoked in the main function of the application. The suggested usage is +// "defer observability.End()". This function also flushes data to upstream, and +// cleanup resources. +// +// Note: this method should only be invoked once, it's not thread-safe. +func End() { + closeLoggingExporter() +} diff --git a/observability/observability_test.go b/observability/observability_test.go new file mode 100644 index 00000000000..2b16a6f8d40 --- /dev/null +++ b/observability/observability_test.go @@ -0,0 +1,505 @@ +/* + * + * Copyright 2022 gRPC authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +package observability + +import ( + "bytes" + "context" + "fmt" + "net" + "os" + "sync" + "testing" + "time" + + "google.golang.org/grpc" + "google.golang.org/grpc/credentials/insecure" + "google.golang.org/grpc/internal/grpctest" + "google.golang.org/grpc/internal/leakcheck" + testgrpc "google.golang.org/grpc/interop/grpc_testing" + testpb "google.golang.org/grpc/interop/grpc_testing" + "google.golang.org/grpc/metadata" + configpb "google.golang.org/grpc/observability/internal/config" + grpclogrecordpb "google.golang.org/grpc/observability/internal/logging" + "google.golang.org/grpc/status" + "google.golang.org/protobuf/encoding/protojson" + "google.golang.org/protobuf/proto" +) + +type s struct { + grpctest.Tester +} + +func Test(t *testing.T) { + grpctest.RunSubTests(t, s{}) +} + +func init() { + // OpenCensus, once included in binary, will spawn a global goroutine + // recorder that is not controllable by application. + // https://github.com/census-instrumentation/opencensus-go/issues/1191 + leakcheck.RegisterIgnoreGoroutine("go.opencensus.io/stats/view.(*worker).start") + // google-cloud-go leaks HTTP client. They are aware of this: + // https://github.com/googleapis/google-cloud-go/issues/1183 + leakcheck.RegisterIgnoreGoroutine("internal/poll.runtime_pollWait") +} + +var ( + defaultTestTimeout = 10 * time.Second + testHeaderMetadata = metadata.MD{"header": []string{"HeADer"}} + testTrailerMetadata = metadata.MD{"trailer": []string{"TrAileR"}} + testOkPayload = []byte{72, 101, 108, 108, 111, 32, 87, 111, 114, 108, 100} + testErrorPayload = []byte{77, 97, 114, 116, 104, 97} + testErrorMessage = "test case injected error" + infinitySizeBytes int32 = 1024 * 1024 * 1024 +) + +type testServer struct { + testgrpc.UnimplementedTestServiceServer +} + +func (s *testServer) UnaryCall(ctx context.Context, in *testpb.SimpleRequest) (*testpb.SimpleResponse, error) { + if err := grpc.SendHeader(ctx, testHeaderMetadata); err != nil { + return nil, status.Errorf(status.Code(err), "grpc.SendHeader(_, %v) = %v, want ", testHeaderMetadata, err) + } + if err := grpc.SetTrailer(ctx, testTrailerMetadata); err != nil { + return nil, status.Errorf(status.Code(err), "grpc.SetTrailer(_, %v) = %v, want ", testTrailerMetadata, err) + } + + if bytes.Equal(in.Payload.Body, testErrorPayload) { + return nil, fmt.Errorf(testErrorMessage) + } + + return &testpb.SimpleResponse{Payload: in.Payload}, nil +} + +type fakeLoggingExporter struct { + t *testing.T + clientEvents []*grpclogrecordpb.GrpcLogRecord + serverEvents []*grpclogrecordpb.GrpcLogRecord + isClosed bool + mu sync.Mutex +} + +func (fle *fakeLoggingExporter) EmitGrpcLogRecord(l *grpclogrecordpb.GrpcLogRecord) { + fle.mu.Lock() + defer fle.mu.Unlock() + switch l.EventLogger { + case grpclogrecordpb.GrpcLogRecord_LOGGER_CLIENT: + fle.clientEvents = append(fle.clientEvents, l) + case grpclogrecordpb.GrpcLogRecord_LOGGER_SERVER: + fle.serverEvents = append(fle.serverEvents, l) + default: + fle.t.Fatalf("unexpected event logger: %v", l.EventLogger) + } + eventJSON, _ := protojson.Marshal(l) + fle.t.Logf("fakeLoggingExporter Emit: %s", eventJSON) +} + +func (fle *fakeLoggingExporter) Close() error { + fle.isClosed = true + return nil +} + +// test is an end-to-end test. It should be created with the newTest +// func, modified as needed, and then started with its startServer method. +// It should be cleaned up with the tearDown method. +type test struct { + t *testing.T + fle *fakeLoggingExporter + + testServer testgrpc.TestServiceServer // nil means none + // srv and srvAddr are set once startServer is called. + srv *grpc.Server + srvAddr string + + cc *grpc.ClientConn // nil until requested via clientConn +} + +func (te *test) tearDown() { + if te.cc != nil { + te.cc.Close() + te.cc = nil + } + te.srv.Stop() + End() + + if !te.fle.isClosed { + te.t.Fatalf("fakeLoggingExporter not closed!") + } +} + +// newTest returns a new test using the provided testing.T and +// environment. It is returned with default values. Tests should +// modify it before calling its startServer and clientConn methods. +func newTest(t *testing.T) *test { + return &test{ + t: t, + fle: &fakeLoggingExporter{t: t}, + } +} + +// startServer starts a gRPC server listening. Callers should defer a +// call to te.tearDown to clean up. +func (te *test) startServer(ts testgrpc.TestServiceServer) { + te.testServer = ts + lis, err := net.Listen("tcp", "localhost:0") + if err != nil { + te.t.Fatalf("Failed to listen: %v", err) + } + var opts []grpc.ServerOption + s := grpc.NewServer(opts...) + te.srv = s + if te.testServer != nil { + testgrpc.RegisterTestServiceServer(s, te.testServer) + } + + go s.Serve(lis) + te.srvAddr = lis.Addr().String() +} + +func (te *test) clientConn() *grpc.ClientConn { + if te.cc != nil { + return te.cc + } + opts := []grpc.DialOption{ + grpc.WithTransportCredentials(insecure.NewCredentials()), + grpc.WithBlock(), + grpc.WithUserAgent("test/0.0.1"), + } + var err error + te.cc, err = grpc.Dial(te.srvAddr, opts...) + if err != nil { + te.t.Fatalf("Dial(%q) = %v", te.srvAddr, err) + } + return te.cc +} + +func (te *test) enablePluginWithFakeExporters() { + // Disables default exporters + config := &configpb.ObservabilityConfig{ + EnableCloudLogging: true, + DestinationProjectId: "", + LogFilters: []*configpb.ObservabilityConfig_LogFilter{ + { + Pattern: "*", + HeaderBytes: infinitySizeBytes, + MessageBytes: infinitySizeBytes, + }, + }, + } + configJSON, err := protojson.Marshal(config) + if err != nil { + te.t.Fatalf("failed to convert config to JSON: %v", err) + } + os.Setenv(envObservabilityConfig, string(configJSON)) + // Explicitly re-parse the ObservabilityConfig + Start(context.Background()) + // Injects the fake exporter for testing purposes + globalLoggingExporter = te.fle +} + +func (te *test) enablePluginWithEmptyConfig() { + os.Setenv(envObservabilityConfig, "{}") + // Explicitly re-parse the ObservabilityConfig + Start(context.Background()) + // Injects the fake exporter for testing purposes + globalLoggingExporter = te.fle +} + +func checkEventCommon(t *testing.T, seen *grpclogrecordpb.GrpcLogRecord) { + if seen.RpcId == "" { + t.Fatalf("expect non-empty RpcId") + } + if seen.SequenceId == 0 { + t.Fatalf("expect non-zero SequenceId") + } +} + +func checkEventRequestHeader(t *testing.T, seen *grpclogrecordpb.GrpcLogRecord, want *grpclogrecordpb.GrpcLogRecord) { + checkEventCommon(t, seen) + if seen.EventType != grpclogrecordpb.GrpcLogRecord_GRPC_CALL_REQUEST_HEADER { + t.Fatalf("got %v, want GrpcLogRecord_GRPC_CALL_REQUEST_HEADER", seen.EventType.String()) + } + if seen.EventLogger != want.EventLogger { + t.Fatalf("l.EventLogger = %v, want %v", seen.EventLogger, want.EventLogger) + } + if want.Authority != "" && seen.Authority != want.Authority { + t.Fatalf("l.Authority = %v, want %v", seen.Authority, want.Authority) + } + if want.ServiceName != "" && seen.ServiceName != want.ServiceName { + t.Fatalf("l.ServiceName = %v, want %v", seen.ServiceName, want.ServiceName) + } + if want.MethodName != "" && seen.MethodName != want.MethodName { + t.Fatalf("l.MethodName = %v, want %v", seen.MethodName, want.MethodName) + } + if len(seen.Metadata.Entry) != 1 { + t.Fatalf("unexpected header size: %v != 1", len(seen.Metadata.Entry)) + } + if seen.Metadata.Entry[0].Key != "header" { + t.Fatalf("unexpected header: %v", seen.Metadata.Entry[0].Key) + } + if !bytes.Equal(seen.Metadata.Entry[0].Value, []byte(testHeaderMetadata["header"][0])) { + t.Fatalf("unexpected header value: %v", seen.Metadata.Entry[0].Value) + } +} + +func checkEventResponseHeader(t *testing.T, seen *grpclogrecordpb.GrpcLogRecord, want *grpclogrecordpb.GrpcLogRecord) { + checkEventCommon(t, seen) + if seen.EventType != grpclogrecordpb.GrpcLogRecord_GRPC_CALL_RESPONSE_HEADER { + t.Fatalf("got %v, want GrpcLogRecord_GRPC_CALL_RESPONSE_HEADER", seen.EventType.String()) + } + if seen.EventLogger != want.EventLogger { + t.Fatalf("l.EventLogger = %v, want %v", seen.EventLogger, want.EventLogger) + } + if len(seen.Metadata.Entry) != 1 { + t.Fatalf("unexpected header size: %v != 1", len(seen.Metadata.Entry)) + } + if seen.Metadata.Entry[0].Key != "header" { + t.Fatalf("unexpected header: %v", seen.Metadata.Entry[0].Key) + } + if !bytes.Equal(seen.Metadata.Entry[0].Value, []byte(testHeaderMetadata["header"][0])) { + t.Fatalf("unexpected header value: %v", seen.Metadata.Entry[0].Value) + } +} + +func checkEventRequestMessage(t *testing.T, seen *grpclogrecordpb.GrpcLogRecord, want *grpclogrecordpb.GrpcLogRecord, payload []byte) { + checkEventCommon(t, seen) + if seen.EventType != grpclogrecordpb.GrpcLogRecord_GRPC_CALL_REQUEST_MESSAGE { + t.Fatalf("got %v, want GrpcLogRecord_GRPC_CALL_REQUEST_MESSAGE", seen.EventType.String()) + } + if seen.EventLogger != want.EventLogger { + t.Fatalf("l.EventLogger = %v, want %v", seen.EventLogger, want.EventLogger) + } + msg := &testpb.SimpleRequest{Payload: &testpb.Payload{Body: payload}} + msgBytes, _ := proto.Marshal(msg) + if !bytes.Equal(seen.Message, msgBytes) { + t.Fatalf("unexpected payload: %v != %v", seen.Message, payload) + } +} + +func checkEventResponseMessage(t *testing.T, seen *grpclogrecordpb.GrpcLogRecord, want *grpclogrecordpb.GrpcLogRecord, payload []byte) { + checkEventCommon(t, seen) + if seen.EventType != grpclogrecordpb.GrpcLogRecord_GRPC_CALL_RESPONSE_MESSAGE { + t.Fatalf("got %v, want GrpcLogRecord_GRPC_CALL_RESPONSE_MESSAGE", seen.EventType.String()) + } + if seen.EventLogger != want.EventLogger { + t.Fatalf("l.EventLogger = %v, want %v", seen.EventLogger, want.EventLogger) + } + msg := &testpb.SimpleResponse{Payload: &testpb.Payload{Body: payload}} + msgBytes, _ := proto.Marshal(msg) + if !bytes.Equal(seen.Message, msgBytes) { + t.Fatalf("unexpected payload: %v != %v", seen.Message, payload) + } +} + +func checkEventTrailer(t *testing.T, seen *grpclogrecordpb.GrpcLogRecord, want *grpclogrecordpb.GrpcLogRecord) { + checkEventCommon(t, seen) + if seen.EventType != grpclogrecordpb.GrpcLogRecord_GRPC_CALL_TRAILER { + t.Fatalf("got %v, want GrpcLogRecord_GRPC_CALL_TRAILER", seen.EventType.String()) + } + if seen.EventLogger != want.EventLogger { + t.Fatalf("l.EventLogger = %v, want %v", seen.EventLogger, want.EventLogger) + } + if seen.StatusCode != want.StatusCode { + t.Fatalf("l.StatusCode = %v, want %v", seen.StatusCode, want.StatusCode) + } + if seen.StatusMessage != want.StatusMessage { + t.Fatalf("l.StatusMessage = %v, want %v", seen.StatusMessage, want.StatusMessage) + } + if !bytes.Equal(seen.StatusDetails, want.StatusDetails) { + t.Fatalf("l.StatusDetails = %v, want %v", seen.StatusDetails, want.StatusDetails) + } + if len(seen.Metadata.Entry) != 1 { + t.Fatalf("unexpected trailer size: %v != 1", len(seen.Metadata.Entry)) + } + if seen.Metadata.Entry[0].Key != "trailer" { + t.Fatalf("unexpected trailer: %v", seen.Metadata.Entry[0].Key) + } + if !bytes.Equal(seen.Metadata.Entry[0].Value, []byte(testTrailerMetadata["trailer"][0])) { + t.Fatalf("unexpected trailer value: %v", seen.Metadata.Entry[0].Value) + } +} + +func (s) TestLoggingForOkCall(t *testing.T) { + te := newTest(t) + defer te.tearDown() + te.enablePluginWithFakeExporters() + te.startServer(&testServer{}) + tc := testgrpc.NewTestServiceClient(te.clientConn()) + + var ( + resp *testpb.SimpleResponse + req *testpb.SimpleRequest + err error + ) + req = &testpb.SimpleRequest{Payload: &testpb.Payload{Body: testOkPayload}} + tCtx, cancel := context.WithTimeout(context.Background(), defaultTestTimeout) + defer cancel() + resp, err = tc.UnaryCall(metadata.NewOutgoingContext(tCtx, testHeaderMetadata), req) + if err != nil { + t.Fatalf("unary call failed: %v", err) + } + t.Logf("unary call passed: %v", resp) + + // Wait for the gRPC transport to gracefully close to ensure no lost event. + te.cc.Close() + te.srv.GracefulStop() + // Check size of events + if len(te.fle.clientEvents) != 5 { + t.Fatalf("expects 5 client events, got %d", len(te.fle.clientEvents)) + } + if len(te.fle.serverEvents) != 5 { + t.Fatalf("expects 5 server events, got %d", len(te.fle.serverEvents)) + } + // Client events + checkEventRequestHeader(te.t, te.fle.clientEvents[0], &grpclogrecordpb.GrpcLogRecord{ + EventLogger: grpclogrecordpb.GrpcLogRecord_LOGGER_CLIENT, + Authority: te.srvAddr, + ServiceName: "grpc.testing.TestService", + MethodName: "UnaryCall", + }) + checkEventRequestMessage(te.t, te.fle.clientEvents[1], &grpclogrecordpb.GrpcLogRecord{ + EventLogger: grpclogrecordpb.GrpcLogRecord_LOGGER_CLIENT, + }, testOkPayload) + checkEventResponseHeader(te.t, te.fle.clientEvents[2], &grpclogrecordpb.GrpcLogRecord{ + EventLogger: grpclogrecordpb.GrpcLogRecord_LOGGER_CLIENT, + }) + checkEventResponseMessage(te.t, te.fle.clientEvents[3], &grpclogrecordpb.GrpcLogRecord{ + EventLogger: grpclogrecordpb.GrpcLogRecord_LOGGER_CLIENT, + }, testOkPayload) + checkEventTrailer(te.t, te.fle.clientEvents[4], &grpclogrecordpb.GrpcLogRecord{ + EventLogger: grpclogrecordpb.GrpcLogRecord_LOGGER_CLIENT, + StatusCode: 0, + }) + // Server events + checkEventRequestHeader(te.t, te.fle.serverEvents[0], &grpclogrecordpb.GrpcLogRecord{ + EventLogger: grpclogrecordpb.GrpcLogRecord_LOGGER_SERVER, + }) + checkEventRequestMessage(te.t, te.fle.serverEvents[1], &grpclogrecordpb.GrpcLogRecord{ + EventLogger: grpclogrecordpb.GrpcLogRecord_LOGGER_SERVER, + }, testOkPayload) + checkEventResponseHeader(te.t, te.fle.serverEvents[2], &grpclogrecordpb.GrpcLogRecord{ + EventLogger: grpclogrecordpb.GrpcLogRecord_LOGGER_SERVER, + }) + checkEventResponseMessage(te.t, te.fle.serverEvents[3], &grpclogrecordpb.GrpcLogRecord{ + EventLogger: grpclogrecordpb.GrpcLogRecord_LOGGER_SERVER, + }, testOkPayload) + checkEventTrailer(te.t, te.fle.serverEvents[4], &grpclogrecordpb.GrpcLogRecord{ + EventLogger: grpclogrecordpb.GrpcLogRecord_LOGGER_SERVER, + StatusCode: 0, + }) +} + +func (s) TestLoggingForErrorCall(t *testing.T) { + te := newTest(t) + defer te.tearDown() + te.enablePluginWithFakeExporters() + te.startServer(&testServer{}) + tc := testgrpc.NewTestServiceClient(te.clientConn()) + + var ( + req *testpb.SimpleRequest + err error + ) + req = &testpb.SimpleRequest{Payload: &testpb.Payload{Body: testErrorPayload}} + tCtx, cancel := context.WithTimeout(context.Background(), defaultTestTimeout) + defer cancel() + _, err = tc.UnaryCall(metadata.NewOutgoingContext(tCtx, testHeaderMetadata), req) + if err == nil { + t.Fatalf("unary call expected to fail, but passed") + } + + // Wait for the gRPC transport to gracefully close to ensure no lost event. + te.cc.Close() + te.srv.GracefulStop() + // Check size of events + if len(te.fle.clientEvents) != 4 { + t.Fatalf("expects 4 client events, got %d", len(te.fle.clientEvents)) + } + if len(te.fle.serverEvents) != 4 { + t.Fatalf("expects 4 server events, got %d", len(te.fle.serverEvents)) + } + // Client events + checkEventRequestHeader(te.t, te.fle.clientEvents[0], &grpclogrecordpb.GrpcLogRecord{ + EventLogger: grpclogrecordpb.GrpcLogRecord_LOGGER_CLIENT, + Authority: te.srvAddr, + ServiceName: "grpc.testing.TestService", + MethodName: "UnaryCall", + }) + checkEventRequestMessage(te.t, te.fle.clientEvents[1], &grpclogrecordpb.GrpcLogRecord{ + EventLogger: grpclogrecordpb.GrpcLogRecord_LOGGER_CLIENT, + }, testErrorPayload) + checkEventResponseHeader(te.t, te.fle.clientEvents[2], &grpclogrecordpb.GrpcLogRecord{ + EventLogger: grpclogrecordpb.GrpcLogRecord_LOGGER_CLIENT, + }) + checkEventTrailer(te.t, te.fle.clientEvents[3], &grpclogrecordpb.GrpcLogRecord{ + EventLogger: grpclogrecordpb.GrpcLogRecord_LOGGER_CLIENT, + StatusCode: 2, + StatusMessage: testErrorMessage, + }) + // Server events + checkEventRequestHeader(te.t, te.fle.serverEvents[0], &grpclogrecordpb.GrpcLogRecord{ + EventLogger: grpclogrecordpb.GrpcLogRecord_LOGGER_SERVER, + }) + checkEventRequestMessage(te.t, te.fle.serverEvents[1], &grpclogrecordpb.GrpcLogRecord{ + EventLogger: grpclogrecordpb.GrpcLogRecord_LOGGER_SERVER, + }, testErrorPayload) + checkEventResponseHeader(te.t, te.fle.serverEvents[2], &grpclogrecordpb.GrpcLogRecord{ + EventLogger: grpclogrecordpb.GrpcLogRecord_LOGGER_SERVER, + }) + checkEventTrailer(te.t, te.fle.serverEvents[3], &grpclogrecordpb.GrpcLogRecord{ + EventLogger: grpclogrecordpb.GrpcLogRecord_LOGGER_SERVER, + StatusCode: 2, + StatusMessage: testErrorMessage, + }) +} + +func (s) TestNoConfig(t *testing.T) { + te := newTest(t) + defer te.tearDown() + te.enablePluginWithEmptyConfig() + te.startServer(&testServer{}) + tc := testgrpc.NewTestServiceClient(te.clientConn()) + + var ( + resp *testpb.SimpleResponse + req *testpb.SimpleRequest + err error + ) + req = &testpb.SimpleRequest{Payload: &testpb.Payload{Body: testOkPayload}} + tCtx, cancel := context.WithTimeout(context.Background(), defaultTestTimeout) + defer cancel() + resp, err = tc.UnaryCall(metadata.NewOutgoingContext(tCtx, testHeaderMetadata), req) + if err != nil { + t.Fatalf("unary call failed: %v", err) + } + t.Logf("unary call passed: %v", resp) + + // Wait for the gRPC transport to gracefully close to ensure no lost event. + te.cc.Close() + te.srv.GracefulStop() + // Check size of events + if len(te.fle.clientEvents) != 0 { + t.Fatalf("expects 0 client events, got %d", len(te.fle.clientEvents)) + } + if len(te.fle.serverEvents) != 0 { + t.Fatalf("expects 0 server events, got %d", len(te.fle.serverEvents)) + } +} diff --git a/observability/tags.go b/observability/tags.go new file mode 100644 index 00000000000..705ba164834 --- /dev/null +++ b/observability/tags.go @@ -0,0 +1,41 @@ +/* + * + * Copyright 2022 gRPC authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +package observability + +import ( + "strings" +) + +const ( + envPrefixCustomTags = "GRPC_OBSERVABILITY_" + envPrefixLen = len(envPrefixCustomTags) +) + +func getCustomTags(envs []string) map[string]string { + m := make(map[string]string) + for _, e := range envs { + if !strings.HasPrefix(e, envPrefixCustomTags) { + continue + } + if i := strings.Index(e, "="); i > envPrefixLen { + m[e[envPrefixLen:i]] = e[i+1:] + } + } + return m +} diff --git a/observability/tags_test.go b/observability/tags_test.go new file mode 100644 index 00000000000..c3aa9c91070 --- /dev/null +++ b/observability/tags_test.go @@ -0,0 +1,64 @@ +/* + * + * Copyright 2018 gRPC authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +package observability + +import ( + "reflect" + "testing" +) + +// TestGetCustomTags tests the normal tags parsing +func (s) TestGetCustomTags(t *testing.T) { + var ( + input = []string{ + "GRPC_OBSERVABILITY_APP_NAME=app1", + "GRPC_OBSERVABILITY_DATACENTER=us-west1-a", + "GRPC_OBSERVABILITY_smallcase=OK", + } + expect = map[string]string{ + "APP_NAME": "app1", + "DATACENTER": "us-west1-a", + "smallcase": "OK", + } + ) + result := getCustomTags(input) + if !reflect.DeepEqual(result, expect) { + t.Errorf("result [%+v] != expect [%+v]", result, expect) + } +} + +// TestGetCustomTagsInvalid tests the sunny day path of the custom tags parsing +func (s) TestGetCustomTagsInvalid(t *testing.T) { + var ( + input = []string{ + "GRPC_OBSERVABILITY_APP_NAME=app1", + "GRPC_OBSERVABILITY=foo", + "GRPC_OBSERVABILITY_=foo", + "GRPC_STUFF=foo", + "STUFF_GRPC_OBSERVABILITY_=foo", + } + expect = map[string]string{ + "APP_NAME": "app1", + } + ) + result := getCustomTags(input) + if !reflect.DeepEqual(result, expect) { + t.Errorf("result [%+v] != expect [%+v]", result, expect) + } +} From c54d46e0647347a4720aab5585304f391251043c Mon Sep 17 00:00:00 2001 From: Lidi Zheng Date: Thu, 17 Mar 2022 15:45:31 -0700 Subject: [PATCH 02/23] Adopt reviewer's advices --- observability/logging.go | 227 ++++++++++++---------------- observability/observability_test.go | 3 + 2 files changed, 97 insertions(+), 133 deletions(-) diff --git a/observability/logging.go b/observability/logging.go index 6baf1e49ac0..e11b11a9333 100644 --- a/observability/logging.go +++ b/observability/logging.go @@ -20,82 +20,43 @@ package observability import ( "fmt" - "net" "strings" - "time" - "github.com/golang/protobuf/ptypes" "github.com/google/uuid" binlogpb "google.golang.org/grpc/binarylog/grpc_binarylog_v1" iblog "google.golang.org/grpc/internal/binarylog" - "google.golang.org/grpc/metadata" configpb "google.golang.org/grpc/observability/internal/config" grpclogrecordpb "google.golang.org/grpc/observability/internal/logging" - "google.golang.org/grpc/status" - "google.golang.org/protobuf/proto" ) -func setMetadataToGrpcLogRecord(lr *grpclogrecordpb.GrpcLogRecord, m metadata.MD, mlc *iblog.MethodLoggerConfig) { - mdPb := iblog.MdToMetadataProto(m) - lr.PayloadTruncated = iblog.TruncateMetadata(mlc, mdPb) - lr.Metadata = &grpclogrecordpb.GrpcLogRecord_Metadata{ - Entry: make([]*grpclogrecordpb.GrpcLogRecord_MetadataEntry, len(mdPb.GetEntry())), - } - for i, e := range mdPb.GetEntry() { - lr.Metadata.Entry[i] = &grpclogrecordpb.GrpcLogRecord_MetadataEntry{ +// translateMetadata translates the metadata from Binary Logging format to +// its GrpcLogRecord equivalent. +func translateMetadata(m *binlogpb.Metadata) *grpclogrecordpb.GrpcLogRecord_Metadata { + var res grpclogrecordpb.GrpcLogRecord_Metadata + res.Entry = make([]*grpclogrecordpb.GrpcLogRecord_MetadataEntry, len(m.Entry)) + for i, e := range m.Entry { + res.Entry[i] = &grpclogrecordpb.GrpcLogRecord_MetadataEntry{ Key: e.Key, Value: e.Value, } } + return &res } -func setPeerToGrpcLogRecord(lr *grpclogrecordpb.GrpcLogRecord, peer net.Addr) { - if peer != nil { - peerPb := iblog.AddrToProto(peer) - lr.PeerAddress = &grpclogrecordpb.GrpcLogRecord_Address{ - Type: grpclogrecordpb.GrpcLogRecord_Address_Type(peerPb.GetType()), - Address: peerPb.GetAddress(), - IpPort: peerPb.GetIpPort(), - } - } -} - -func setMessageToGrpcLogRecord(lr *grpclogrecordpb.GrpcLogRecord, msg interface{}, mlc *iblog.MethodLoggerConfig) { - var ( - data []byte - err error - ) - if m, ok := msg.(proto.Message); ok { - data, err = proto.Marshal(m) - if err != nil { - logger.Infof("failed to marshal proto message: %v", err) +func setPeerIfPresent(binlogEntry *binlogpb.GrpcLogEntry, grpcLogRecord *grpclogrecordpb.GrpcLogRecord) { + if binlogEntry.GetPeer() != nil { + grpcLogRecord.PeerAddress = &grpclogrecordpb.GrpcLogRecord_Address{ + Type: grpclogrecordpb.GrpcLogRecord_Address_Type(binlogEntry.Peer.Type), + Address: binlogEntry.Peer.Address, + IpPort: binlogEntry.Peer.IpPort, } - } else if b, ok := msg.([]byte); ok { - data = b - } else { - logger.Infof("message to log is neither proto.message nor []byte") - } - msgPb := &binlogpb.Message{ - Length: uint32(len(data)), - Data: data, - } - lr.PayloadTruncated = iblog.TruncateMessage(mlc, msgPb) - lr.Message = msgPb.Data - lr.PayloadSize = msgPb.Length -} - -func getEventLogger(isClient bool) grpclogrecordpb.GrpcLogRecord_EventLogger { - if isClient { - return grpclogrecordpb.GrpcLogRecord_LOGGER_CLIENT } - return grpclogrecordpb.GrpcLogRecord_LOGGER_SERVER } type observabilityBinaryMethodLogger struct { rpcID, serviceName, methodName string - sequenceIDGen iblog.CallIDGenerator originalMethodLogger iblog.MethodLogger - methodLoggerConfig *iblog.MethodLoggerConfig + wrappedMethodLogger iblog.MethodLogger } func (ml *observabilityBinaryMethodLogger) Log(c iblog.LogEntryConfig) { @@ -104,91 +65,96 @@ func (ml *observabilityBinaryMethodLogger) Log(c iblog.LogEntryConfig) { ml.originalMethodLogger.Log(c) } - timestamp, err := ptypes.TimestampProto(time.Now()) - if err != nil { - logger.Errorf("Failed to convert time.Now() to TimestampProto: %v", err) + // Fetch the compiled binary logging log entry + if ml.wrappedMethodLogger == nil { + logger.Info("No wrapped method logger found") + return + } + var binlogEntry *binlogpb.GrpcLogEntry + o, ok := ml.wrappedMethodLogger.(interface { + Build(iblog.LogEntryConfig) *binlogpb.GrpcLogEntry + }) + if !ok { + logger.Errorf("Failed to locate the Build method in wrapped method logger") + return } + binlogEntry = o.Build(c) + + // Translate to GrpcLogRecord grpcLogRecord := &grpclogrecordpb.GrpcLogRecord{ - Timestamp: timestamp, + Timestamp: binlogEntry.GetTimestamp(), RpcId: ml.rpcID, - SequenceId: ml.sequenceIDGen.Next(), + SequenceId: binlogEntry.GetSequenceIdWithinCall(), // Making DEBUG the default LogLevel LogLevel: grpclogrecordpb.GrpcLogRecord_LOG_LEVEL_DEBUG, } - switch v := c.(type) { - case *iblog.ClientHeader: + + switch binlogEntry.Logger { + case binlogpb.GrpcLogEntry_LOGGER_CLIENT: + grpcLogRecord.EventLogger = grpclogrecordpb.GrpcLogRecord_LOGGER_CLIENT + case binlogpb.GrpcLogEntry_LOGGER_SERVER: + grpcLogRecord.EventLogger = grpclogrecordpb.GrpcLogRecord_LOGGER_SERVER + default: + grpcLogRecord.EventLogger = grpclogrecordpb.GrpcLogRecord_LOGGER_UNKNOWN + } + + switch binlogEntry.GetType() { + case binlogpb.GrpcLogEntry_EVENT_TYPE_UNKNOWN: + grpcLogRecord.EventType = grpclogrecordpb.GrpcLogRecord_GRPC_CALL_UNKNOWN + case binlogpb.GrpcLogEntry_EVENT_TYPE_CLIENT_HEADER: grpcLogRecord.EventType = grpclogrecordpb.GrpcLogRecord_GRPC_CALL_REQUEST_HEADER - grpcLogRecord.EventLogger = getEventLogger(v.OnClientSide) - methodName := v.MethodName - if strings.Contains(methodName, "/") { - tokens := strings.Split(methodName, "/") - if len(tokens) == 3 { - // Example method name: /grpc.testing.TestService/UnaryCall - ml.serviceName = tokens[1] - ml.methodName = tokens[2] - } else if len(tokens) == 2 { - // Example method name: grpc.testing.TestService/UnaryCall - ml.serviceName = tokens[0] - ml.methodName = tokens[1] - } else { - logger.Errorf("Malformed method name: %v", methodName) + if binlogEntry.GetClientHeader() != nil { + methodName := binlogEntry.GetClientHeader().MethodName + // Example method name: /grpc.testing.TestService/UnaryCall + if strings.Contains(methodName, "/") { + tokens := strings.Split(methodName, "/") + if len(tokens) == 3 { + // Record service name and method name for all events + ml.serviceName = tokens[1] + ml.methodName = tokens[2] + } else { + logger.Warningf("Malformed method name: %v", methodName) + } } + grpcLogRecord.Timeout = binlogEntry.GetClientHeader().Timeout + grpcLogRecord.Authority = binlogEntry.GetClientHeader().Authority + grpcLogRecord.Metadata = translateMetadata(binlogEntry.GetClientHeader().Metadata) } - grpcLogRecord.Timeout = ptypes.DurationProto(v.Timeout) - grpcLogRecord.Authority = v.Authority - setMetadataToGrpcLogRecord(grpcLogRecord, v.Header, ml.methodLoggerConfig) - setPeerToGrpcLogRecord(grpcLogRecord, v.PeerAddr) - case *iblog.ServerHeader: + grpcLogRecord.PayloadTruncated = binlogEntry.GetPayloadTruncated() + setPeerIfPresent(binlogEntry, grpcLogRecord) + case binlogpb.GrpcLogEntry_EVENT_TYPE_SERVER_HEADER: grpcLogRecord.EventType = grpclogrecordpb.GrpcLogRecord_GRPC_CALL_RESPONSE_HEADER - grpcLogRecord.EventLogger = getEventLogger(v.OnClientSide) - setMetadataToGrpcLogRecord(grpcLogRecord, v.Header, ml.methodLoggerConfig) - setPeerToGrpcLogRecord(grpcLogRecord, v.PeerAddr) - case *iblog.ClientMessage: + grpcLogRecord.Metadata = translateMetadata(binlogEntry.GetServerHeader().Metadata) + grpcLogRecord.PayloadTruncated = binlogEntry.GetPayloadTruncated() + setPeerIfPresent(binlogEntry, grpcLogRecord) + case binlogpb.GrpcLogEntry_EVENT_TYPE_CLIENT_MESSAGE: grpcLogRecord.EventType = grpclogrecordpb.GrpcLogRecord_GRPC_CALL_REQUEST_MESSAGE - grpcLogRecord.EventLogger = getEventLogger(v.OnClientSide) - setMessageToGrpcLogRecord(grpcLogRecord, v.Message, ml.methodLoggerConfig) - case *iblog.ServerMessage: + grpcLogRecord.Message = binlogEntry.GetMessage().GetData() + grpcLogRecord.PayloadSize = binlogEntry.GetMessage().GetLength() + grpcLogRecord.PayloadTruncated = binlogEntry.GetPayloadTruncated() + case binlogpb.GrpcLogEntry_EVENT_TYPE_SERVER_MESSAGE: grpcLogRecord.EventType = grpclogrecordpb.GrpcLogRecord_GRPC_CALL_RESPONSE_MESSAGE - grpcLogRecord.EventLogger = getEventLogger(v.OnClientSide) - setMessageToGrpcLogRecord(grpcLogRecord, v.Message, ml.methodLoggerConfig) - case *iblog.ClientHalfClose: + grpcLogRecord.Message = binlogEntry.GetMessage().GetData() + grpcLogRecord.PayloadSize = binlogEntry.GetMessage().GetLength() + grpcLogRecord.PayloadTruncated = binlogEntry.GetPayloadTruncated() + case binlogpb.GrpcLogEntry_EVENT_TYPE_CLIENT_HALF_CLOSE: grpcLogRecord.EventType = grpclogrecordpb.GrpcLogRecord_GRPC_CALL_HALF_CLOSE - grpcLogRecord.EventLogger = getEventLogger(v.OnClientSide) - case *iblog.ServerTrailer: + case binlogpb.GrpcLogEntry_EVENT_TYPE_SERVER_TRAILER: grpcLogRecord.EventType = grpclogrecordpb.GrpcLogRecord_GRPC_CALL_TRAILER - grpcLogRecord.EventLogger = getEventLogger(v.OnClientSide) - setMetadataToGrpcLogRecord(grpcLogRecord, v.Trailer, ml.methodLoggerConfig) - setPeerToGrpcLogRecord(grpcLogRecord, v.PeerAddr) - st, ok := status.FromError(v.Err) - if !ok { - logger.Info("Error in trailer is not a status error") - } - stProto := st.Proto() - if stProto != nil && len(stProto.Details) != 0 { - detailsBytes, err := proto.Marshal(stProto) - if err != nil { - logger.Infof("Failed to marshal status proto: %v", err) - } else { - grpcLogRecord.StatusDetails = detailsBytes - } - } - grpcLogRecord.StatusCode = uint32(st.Code()) - grpcLogRecord.StatusMessage = st.Message() - case *iblog.Cancel: + grpcLogRecord.Metadata = translateMetadata(binlogEntry.GetTrailer().Metadata) + grpcLogRecord.StatusCode = binlogEntry.GetTrailer().GetStatusCode() + grpcLogRecord.StatusMessage = binlogEntry.GetTrailer().GetStatusMessage() + grpcLogRecord.StatusDetails = binlogEntry.GetTrailer().GetStatusDetails() + grpcLogRecord.PayloadTruncated = binlogEntry.GetPayloadTruncated() + setPeerIfPresent(binlogEntry, grpcLogRecord) + case binlogpb.GrpcLogEntry_EVENT_TYPE_CANCEL: grpcLogRecord.EventType = grpclogrecordpb.GrpcLogRecord_GRPC_CALL_CANCEL - grpcLogRecord.EventLogger = getEventLogger(v.OnClientSide) default: - logger.Errorf("Unexpected LogEntryConfig: %+v", c) + logger.Warningf("unknown event type: %v", binlogEntry.Type) return } - - if ml.serviceName != "" { - grpcLogRecord.ServiceName = ml.serviceName - } - if ml.methodName != "" { - grpcLogRecord.MethodName = ml.methodName - } - + grpcLogRecord.ServiceName = ml.serviceName + grpcLogRecord.MethodName = ml.methodName // CloudLogging client doesn't return error on entry write. Entry writes // don't mean the data will be uploaded immediately. globalLoggingExporter.EmitGrpcLogRecord(grpcLogRecord) @@ -204,26 +170,21 @@ type observabilityBinaryLogger struct { wrappedLogger iblog.Logger } -func (l *observabilityBinaryLogger) GetMethodLoggerConfig(methodName string) *iblog.MethodLoggerConfig { - if l.wrappedLogger == nil { - return nil - } - return l.wrappedLogger.GetMethodLoggerConfig(methodName) -} - func (l *observabilityBinaryLogger) GetMethodLogger(methodName string) iblog.MethodLogger { - var ol iblog.MethodLogger + var ol, ml iblog.MethodLogger if l.originalLogger != nil { ol = l.originalLogger.GetMethodLogger(methodName) } - - mlc := l.GetMethodLoggerConfig(methodName) - if mlc == nil { + if l.wrappedLogger == nil { + return ol + } + ml = l.wrappedLogger.GetMethodLogger(methodName) + if ml == nil { return ol } return &observabilityBinaryMethodLogger{ originalMethodLogger: ol, - methodLoggerConfig: mlc, + wrappedMethodLogger: ml, rpcID: uuid.NewString(), } } diff --git a/observability/observability_test.go b/observability/observability_test.go index 2b16a6f8d40..e9414c87dd9 100644 --- a/observability/observability_test.go +++ b/observability/observability_test.go @@ -61,13 +61,16 @@ func init() { } var ( + smallTimeout = 100 * time.Millisecond defaultTestTimeout = 10 * time.Second testHeaderMetadata = metadata.MD{"header": []string{"HeADer"}} testTrailerMetadata = metadata.MD{"trailer": []string{"TrAileR"}} testOkPayload = []byte{72, 101, 108, 108, 111, 32, 87, 111, 114, 108, 100} testErrorPayload = []byte{77, 97, 114, 116, 104, 97} + testCancelPayload = []byte{65, 65, 65} testErrorMessage = "test case injected error" infinitySizeBytes int32 = 1024 * 1024 * 1024 + infinityDuration = 3600 * time.Second ) type testServer struct { From a518a7781d2f3feb80670fbda29bae87cbdf7354 Mon Sep 17 00:00:00 2001 From: Lidi Zheng Date: Thu, 17 Mar 2022 15:53:03 -0700 Subject: [PATCH 03/23] Add additional comment for test cases --- observability/tags_test.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/observability/tags_test.go b/observability/tags_test.go index c3aa9c91070..c281d8b437a 100644 --- a/observability/tags_test.go +++ b/observability/tags_test.go @@ -43,13 +43,13 @@ func (s) TestGetCustomTags(t *testing.T) { } } -// TestGetCustomTagsInvalid tests the sunny day path of the custom tags parsing +// TestGetCustomTagsInvalid tests the invalid cases of tags parsing func (s) TestGetCustomTagsInvalid(t *testing.T) { var ( input = []string{ "GRPC_OBSERVABILITY_APP_NAME=app1", "GRPC_OBSERVABILITY=foo", - "GRPC_OBSERVABILITY_=foo", + "GRPC_OBSERVABILITY_=foo", // Users should not set "" as key name "GRPC_STUFF=foo", "STUFF_GRPC_OBSERVABILITY_=foo", } From ca1f842ea34047eea61fe6c782116e0775f076c7 Mon Sep 17 00:00:00 2001 From: Lidi Zheng Date: Mon, 21 Mar 2022 16:26:52 -0700 Subject: [PATCH 04/23] Address reviewer's comments --- observability/config.go | 2 +- observability/exporting.go | 34 ++------- observability/logging.go | 111 ++++++++++++++++++++-------- observability/observability.go | 16 +--- observability/observability_test.go | 24 ++---- 5 files changed, 98 insertions(+), 89 deletions(-) diff --git a/observability/config.go b/observability/config.go index bb861713fbb..121e6d22148 100644 --- a/observability/config.go +++ b/observability/config.go @@ -59,7 +59,7 @@ func parseObservabilityConfig() *configpb.ObservabilityConfig { if content := os.Getenv(envObservabilityConfig); content != "" { var config configpb.ObservabilityConfig if err := protojson.Unmarshal([]byte(content), &config); err != nil { - logger.Warningf("Error parsing observability config from env %v: %v", envObservabilityConfig, err) + logger.Infof("Error parsing observability config from env %v: %v", envObservabilityConfig, err) return nil } logger.Infof("Parsed ObservabilityConfig: %+v", &config) diff --git a/observability/exporting.go b/observability/exporting.go index 26e83f05187..07f186c3c3e 100644 --- a/observability/exporting.go +++ b/observability/exporting.go @@ -39,9 +39,6 @@ type loggingExporter interface { Close() error } -// globalLoggingExporter is the global logging exporter, may be nil. -var globalLoggingExporter loggingExporter - type cloudLoggingExporter struct { projectID string client *gcplogging.Client @@ -85,26 +82,20 @@ var protoToJSONOptions = &protojson.MarshalOptions{ func (cle *cloudLoggingExporter) EmitGrpcLogRecord(l *grpclogrecordpb.GrpcLogRecord) { // Converts the log record content to a more readable format via protojson. - // This is technically a hack, will be removed once we removed our - // dependencies to Cloud Logging SDK. jsonBytes, err := protoToJSONOptions.Marshal(l) if err != nil { - logger.Errorf("Unable to marshal log record: %v", l) + logger.Infof("Unable to marshal log record: %v", l) + return } var payload map[string]interface{} err = json.Unmarshal(jsonBytes, &payload) if err != nil { - logger.Errorf("Unable to unmarshal bytes to JSON: %v", jsonBytes) - } - // Converts severity from log level - var severity, ok = logLevelToSeverity[l.LogLevel] - if !ok { - logger.Errorf("Invalid log level: %v", l.LogLevel) - severity = 0 + logger.Infof("Unable to unmarshal bytes to JSON: %v", jsonBytes) + return } entry := gcplogging.Entry{ Timestamp: l.Timestamp.AsTime(), - Severity: severity, + Severity: logLevelToSeverity[l.LogLevel], Payload: payload, } cle.logger.Log(entry) @@ -129,18 +120,3 @@ func (cle *cloudLoggingExporter) Close() error { logger.Infof("Closed CloudLogging exporter") return nil } - -func createDefaultLoggingExporter(ctx context.Context, projectID string) error { - var err error - globalLoggingExporter, err = newCloudLoggingExporter(ctx, projectID) - return err -} - -func closeLoggingExporter() { - if globalLoggingExporter != nil { - if err := globalLoggingExporter.Close(); err != nil { - logger.Infof("Failed to close logging exporter: %v", err) - } - globalLoggingExporter = nil - } -} diff --git a/observability/logging.go b/observability/logging.go index e11b11a9333..75110abf178 100644 --- a/observability/logging.go +++ b/observability/logging.go @@ -19,8 +19,10 @@ package observability import ( + "context" "fmt" "strings" + "sync/atomic" "github.com/google/uuid" binlogpb "google.golang.org/grpc/binarylog/grpc_binarylog_v1" @@ -53,10 +55,17 @@ func setPeerIfPresent(binlogEntry *binlogpb.GrpcLogEntry, grpcLogRecord *grpclog } } +var loggerTypeToEventLogger = map[binlogpb.GrpcLogEntry_Logger]grpclogrecordpb.GrpcLogRecord_EventLogger{ + binlogpb.GrpcLogEntry_LOGGER_UNKNOWN: grpclogrecordpb.GrpcLogRecord_LOGGER_UNKNOWN, + binlogpb.GrpcLogEntry_LOGGER_CLIENT: grpclogrecordpb.GrpcLogRecord_LOGGER_CLIENT, + binlogpb.GrpcLogEntry_LOGGER_SERVER: grpclogrecordpb.GrpcLogRecord_LOGGER_SERVER, +} + type observabilityBinaryMethodLogger struct { rpcID, serviceName, methodName string originalMethodLogger iblog.MethodLogger wrappedMethodLogger iblog.MethodLogger + exporter loggingExporter } func (ml *observabilityBinaryMethodLogger) Log(c iblog.LogEntryConfig) { @@ -75,29 +84,21 @@ func (ml *observabilityBinaryMethodLogger) Log(c iblog.LogEntryConfig) { Build(iblog.LogEntryConfig) *binlogpb.GrpcLogEntry }) if !ok { - logger.Errorf("Failed to locate the Build method in wrapped method logger") + logger.Error("Failed to locate the Build method in wrapped method logger") return } binlogEntry = o.Build(c) // Translate to GrpcLogRecord grpcLogRecord := &grpclogrecordpb.GrpcLogRecord{ - Timestamp: binlogEntry.GetTimestamp(), - RpcId: ml.rpcID, - SequenceId: binlogEntry.GetSequenceIdWithinCall(), + Timestamp: binlogEntry.GetTimestamp(), + RpcId: ml.rpcID, + SequenceId: binlogEntry.GetSequenceIdWithinCall(), + EventLogger: loggerTypeToEventLogger[binlogEntry.Logger], // Making DEBUG the default LogLevel LogLevel: grpclogrecordpb.GrpcLogRecord_LOG_LEVEL_DEBUG, } - switch binlogEntry.Logger { - case binlogpb.GrpcLogEntry_LOGGER_CLIENT: - grpcLogRecord.EventLogger = grpclogrecordpb.GrpcLogRecord_LOGGER_CLIENT - case binlogpb.GrpcLogEntry_LOGGER_SERVER: - grpcLogRecord.EventLogger = grpclogrecordpb.GrpcLogRecord_LOGGER_SERVER - default: - grpcLogRecord.EventLogger = grpclogrecordpb.GrpcLogRecord_LOGGER_UNKNOWN - } - switch binlogEntry.GetType() { case binlogpb.GrpcLogEntry_EVENT_TYPE_UNKNOWN: grpcLogRecord.EventType = grpclogrecordpb.GrpcLogRecord_GRPC_CALL_UNKNOWN @@ -113,7 +114,7 @@ func (ml *observabilityBinaryMethodLogger) Log(c iblog.LogEntryConfig) { ml.serviceName = tokens[1] ml.methodName = tokens[2] } else { - logger.Warningf("Malformed method name: %v", methodName) + logger.Infof("Malformed method name: %v", methodName) } } grpcLogRecord.Timeout = binlogEntry.GetClientHeader().Timeout @@ -150,14 +151,12 @@ func (ml *observabilityBinaryMethodLogger) Log(c iblog.LogEntryConfig) { case binlogpb.GrpcLogEntry_EVENT_TYPE_CANCEL: grpcLogRecord.EventType = grpclogrecordpb.GrpcLogRecord_GRPC_CALL_CANCEL default: - logger.Warningf("unknown event type: %v", binlogEntry.Type) + logger.Infof("Unknown event type: %v", binlogEntry.Type) return } grpcLogRecord.ServiceName = ml.serviceName grpcLogRecord.MethodName = ml.methodName - // CloudLogging client doesn't return error on entry write. Entry writes - // don't mean the data will be uploaded immediately. - globalLoggingExporter.EmitGrpcLogRecord(grpcLogRecord) + ml.exporter.EmitGrpcLogRecord(grpcLogRecord) } type observabilityBinaryLogger struct { @@ -165,30 +164,89 @@ type observabilityBinaryLogger struct { // by this plugin. Users are allowed to subscribe to a completely different // set of methods. originalLogger iblog.Logger - // wrappedLogger is needed to reuse the control string parsing, logger + // wrappedLogger is a Logger needed to reuse the control string parsing, logger // config managing logic - wrappedLogger iblog.Logger + wrappedLogger atomic.Value + // exporter is a loggingExporter and the handle for uploading collected data to backends + exporter atomic.Value } func (l *observabilityBinaryLogger) GetMethodLogger(methodName string) iblog.MethodLogger { var ol, ml iblog.MethodLogger + if l.originalLogger != nil { ol = l.originalLogger.GetMethodLogger(methodName) } - if l.wrappedLogger == nil { + + wlPtr := l.wrappedLogger.Load() + if wlPtr == nil { return ol } - ml = l.wrappedLogger.GetMethodLogger(methodName) + ml = wlPtr.(iblog.Logger).GetMethodLogger(methodName) if ml == nil { return ol } + + ePtr := l.exporter.Load() + // If no exporter is specified, there is no point creating a method + // logger. We don't have any chance to inject exporter after its + // creation. + if ePtr == nil { + return ol + } + return &observabilityBinaryMethodLogger{ originalMethodLogger: ol, wrappedMethodLogger: ml, rpcID: uuid.NewString(), + exporter: ePtr.(loggingExporter), } } +func (l *observabilityBinaryLogger) Close() { + if l == nil { + return + } + exporter := l.exporter.Load() + if exporter != nil { + if err := exporter.(loggingExporter).Close(); err != nil { + logger.Infof("Failed to close logging exporter: %v", err) + } + } +} + +// start is the core logic for setting up the custom binary logging logger, and +// it's also useful for testing. +func (l *observabilityBinaryLogger) start(config *configpb.ObservabilityConfig, exporter loggingExporter) error { + binlogConfig := iblog.NewLoggerFromConfigString(compileBinaryLogControlString(config)) + if binlogConfig != nil { + defaultLogger.wrappedLogger.Store(binlogConfig) + } + if exporter != nil { + defaultLogger.exporter.Store(exporter) + } + logger.Infof("Start logging with config [%v]", binlogConfig) + return nil +} + +func (l *observabilityBinaryLogger) Start(ctx context.Context, config *configpb.ObservabilityConfig) error { + if config == nil { + return nil + } + if !config.GetEnableCloudLogging() { + return nil + } + if config.GetDestinationProjectId() == "" { + return fmt.Errorf("failed to enable CloudLogging: empty destination_project_id") + } + exporter, err := newCloudLoggingExporter(ctx, config.DestinationProjectId) + if err != nil { + return fmt.Errorf("unable to create CloudLogging exporter: %v", err) + } + l.start(config, exporter) + return nil +} + func newObservabilityBinaryLogger(iblogger iblog.Logger) *observabilityBinaryLogger { return &observabilityBinaryLogger{ originalLogger: iblogger, @@ -221,12 +279,3 @@ func prepareLogging() { defaultLogger = newObservabilityBinaryLogger(iblog.GetLogger()) iblog.SetLogger(defaultLogger) } - -func startLogging(config *configpb.ObservabilityConfig) { - if config == nil { - return - } - binlogConfig := compileBinaryLogControlString(config) - defaultLogger.wrappedLogger = iblog.NewLoggerFromConfigString(binlogConfig) - logger.Infof("Start logging with config [%v]", binlogConfig) -} diff --git a/observability/observability.go b/observability/observability.go index 483c8dadcc2..fce8be42a3e 100644 --- a/observability/observability.go +++ b/observability/observability.go @@ -47,7 +47,7 @@ func init() { // - it registers default exporters if not disabled by the config; // - it sets up binary logging sink against the logging exporter. // -// Note: this method should only be invoked once, it's not thread-safe. +// Note: this method should only be invoked once. // Note: currently, the binarylog module only supports one sink, so using the // "observability" module will conflict with existing binarylog usage. // Note: handle the error @@ -61,15 +61,7 @@ func Start(ctx context.Context) error { maybeUpdateProjectIDInObservabilityConfig(ctx, config) // Logging is controlled by the config at methods level. - startLogging(config) - - if config.GetDestinationProjectId() == "" || !config.GetEnableCloudLogging() { - return nil - } - if err := createDefaultLoggingExporter(ctx, config.DestinationProjectId); err != nil { - return err - } - return nil + return defaultLogger.Start(ctx, config) } // End is the clean-up API for gRPC Observability plugin. It is expected to be @@ -77,7 +69,7 @@ func Start(ctx context.Context) error { // "defer observability.End()". This function also flushes data to upstream, and // cleanup resources. // -// Note: this method should only be invoked once, it's not thread-safe. +// Note: this method should only be invoked once. func End() { - closeLoggingExporter() + defaultLogger.Close() } diff --git a/observability/observability_test.go b/observability/observability_test.go index e9414c87dd9..21db8363ef7 100644 --- a/observability/observability_test.go +++ b/observability/observability_test.go @@ -23,13 +23,13 @@ import ( "context" "fmt" "net" - "os" "sync" "testing" "time" "google.golang.org/grpc" "google.golang.org/grpc/credentials/insecure" + iblog "google.golang.org/grpc/internal/binarylog" "google.golang.org/grpc/internal/grpctest" "google.golang.org/grpc/internal/leakcheck" testgrpc "google.golang.org/grpc/interop/grpc_testing" @@ -61,16 +61,13 @@ func init() { } var ( - smallTimeout = 100 * time.Millisecond defaultTestTimeout = 10 * time.Second testHeaderMetadata = metadata.MD{"header": []string{"HeADer"}} testTrailerMetadata = metadata.MD{"trailer": []string{"TrAileR"}} testOkPayload = []byte{72, 101, 108, 108, 111, 32, 87, 111, 114, 108, 100} testErrorPayload = []byte{77, 97, 114, 116, 104, 97} - testCancelPayload = []byte{65, 65, 65} testErrorMessage = "test case injected error" infinitySizeBytes int32 = 1024 * 1024 * 1024 - infinityDuration = 3600 * time.Second ) type testServer struct { @@ -207,23 +204,18 @@ func (te *test) enablePluginWithFakeExporters() { }, }, } - configJSON, err := protojson.Marshal(config) - if err != nil { - te.t.Fatalf("failed to convert config to JSON: %v", err) - } - os.Setenv(envObservabilityConfig, string(configJSON)) - // Explicitly re-parse the ObservabilityConfig - Start(context.Background()) // Injects the fake exporter for testing purposes - globalLoggingExporter = te.fle + defaultLogger = newObservabilityBinaryLogger(nil) + iblog.SetLogger(defaultLogger) + defaultLogger.start(config, te.fle) } func (te *test) enablePluginWithEmptyConfig() { - os.Setenv(envObservabilityConfig, "{}") - // Explicitly re-parse the ObservabilityConfig - Start(context.Background()) + config := &configpb.ObservabilityConfig{} // Injects the fake exporter for testing purposes - globalLoggingExporter = te.fle + defaultLogger = newObservabilityBinaryLogger(nil) + iblog.SetLogger(defaultLogger) + defaultLogger.start(config, te.fle) } func checkEventCommon(t *testing.T, seen *grpclogrecordpb.GrpcLogRecord) { From 7478646b16e80b4202ddb54cd01e111ee857682c Mon Sep 17 00:00:00 2001 From: Lidi Zheng Date: Wed, 23 Mar 2022 10:54:16 -0700 Subject: [PATCH 05/23] Redo the filter logic --- internal/binarylog/binarylog.go | 6 +- internal/binarylog/env_config.go | 9 +- internal/binarylog/method_logger.go | 3 +- internal/binarylog/method_logger_test.go | 30 +++--- observability/internal/config/config.pb.go | 19 +++- observability/internal/config/config.proto | 19 +++- observability/logging.go | 104 +++++++++++++-------- observability/tags_test.go | 2 +- 8 files changed, 120 insertions(+), 72 deletions(-) diff --git a/internal/binarylog/binarylog.go b/internal/binarylog/binarylog.go index 66efc4856ff..c1a7e07e28b 100644 --- a/internal/binarylog/binarylog.go +++ b/internal/binarylog/binarylog.go @@ -162,16 +162,16 @@ func (l *logger) GetMethodLogger(methodName string) MethodLogger { return nil } if ml, ok := l.methods[s+"/"+m]; ok { - return newMethodLogger(ml.hdr, ml.msg) + return NewMethodLogger(ml.hdr, ml.msg) } if _, ok := l.blacklist[s+"/"+m]; ok { return nil } if ml, ok := l.services[s]; ok { - return newMethodLogger(ml.hdr, ml.msg) + return NewMethodLogger(ml.hdr, ml.msg) } if l.all == nil { return nil } - return newMethodLogger(l.all.hdr, l.all.msg) + return NewMethodLogger(l.all.hdr, l.all.msg) } diff --git a/internal/binarylog/env_config.go b/internal/binarylog/env_config.go index d8f4e7602fd..431e6956315 100644 --- a/internal/binarylog/env_config.go +++ b/internal/binarylog/env_config.go @@ -67,7 +67,7 @@ func (l *logger) fillMethodLoggerWithConfigString(config string) error { // "-service/method", blacklist, no * or {} allowed. if config[0] == '-' { - s, m, suffix, err := parseMethodConfigAndSuffix(config[1:]) + s, m, suffix, err := ParseMethodConfigAndSuffix(config[1:]) if err != nil { return fmt.Errorf("invalid config: %q, %v", config, err) } @@ -95,7 +95,7 @@ func (l *logger) fillMethodLoggerWithConfigString(config string) error { return nil } - s, m, suffix, err := parseMethodConfigAndSuffix(config) + s, m, suffix, err := ParseMethodConfigAndSuffix(config) if err != nil { return fmt.Errorf("invalid config: %q, %v", config, err) } @@ -138,8 +138,9 @@ var ( headerMessageConfigRegexp = regexp.MustCompile(headerMessageConfigRegexpStr) ) -// Turn "service/method{h;m}" into "service", "method", "{h;m}". -func parseMethodConfigAndSuffix(c string) (service, method, suffix string, _ error) { +// ParseMethodConfigAndSuffix turns "service/method{h;m}" into "service", +// "method", "{h;m}". +func ParseMethodConfigAndSuffix(c string) (service, method, suffix string, _ error) { // Regexp result: // // in: "p.s/m{h:123,m:123}", diff --git a/internal/binarylog/method_logger.go b/internal/binarylog/method_logger.go index 24df0a1a0c4..df480b34bb7 100644 --- a/internal/binarylog/method_logger.go +++ b/internal/binarylog/method_logger.go @@ -61,7 +61,8 @@ type methodLogger struct { sink Sink // TODO(blog): make this plugable. } -func newMethodLogger(h, m uint64) *methodLogger { +// NewMethodLogger creates methodLogger based on input config +func NewMethodLogger(h, m uint64) *methodLogger { return &methodLogger{ headerMaxLen: h, messageMaxLen: m, diff --git a/internal/binarylog/method_logger_test.go b/internal/binarylog/method_logger_test.go index 31cc076343f..ae07c66c77c 100644 --- a/internal/binarylog/method_logger_test.go +++ b/internal/binarylog/method_logger_test.go @@ -34,7 +34,7 @@ import ( func (s) TestLog(t *testing.T) { idGen.reset() - ml := newMethodLogger(10, 10) + ml := NewMethodLogger(10, 10) // Set sink to testing buffer. buf := bytes.NewBuffer(nil) ml.sink = newWriterSink(buf) @@ -354,7 +354,7 @@ func (s) TestTruncateMetadataNotTruncated(t *testing.T) { mpPb *pb.Metadata }{ { - ml: newMethodLogger(maxUInt, maxUInt), + ml: NewMethodLogger(maxUInt, maxUInt), mpPb: &pb.Metadata{ Entry: []*pb.MetadataEntry{ {Key: "", Value: []byte{1}}, @@ -362,7 +362,7 @@ func (s) TestTruncateMetadataNotTruncated(t *testing.T) { }, }, { - ml: newMethodLogger(2, maxUInt), + ml: NewMethodLogger(2, maxUInt), mpPb: &pb.Metadata{ Entry: []*pb.MetadataEntry{ {Key: "", Value: []byte{1}}, @@ -370,7 +370,7 @@ func (s) TestTruncateMetadataNotTruncated(t *testing.T) { }, }, { - ml: newMethodLogger(1, maxUInt), + ml: NewMethodLogger(1, maxUInt), mpPb: &pb.Metadata{ Entry: []*pb.MetadataEntry{ {Key: "", Value: nil}, @@ -378,7 +378,7 @@ func (s) TestTruncateMetadataNotTruncated(t *testing.T) { }, }, { - ml: newMethodLogger(2, maxUInt), + ml: NewMethodLogger(2, maxUInt), mpPb: &pb.Metadata{ Entry: []*pb.MetadataEntry{ {Key: "", Value: []byte{1, 1}}, @@ -386,7 +386,7 @@ func (s) TestTruncateMetadataNotTruncated(t *testing.T) { }, }, { - ml: newMethodLogger(2, maxUInt), + ml: NewMethodLogger(2, maxUInt), mpPb: &pb.Metadata{ Entry: []*pb.MetadataEntry{ {Key: "", Value: []byte{1}}, @@ -397,7 +397,7 @@ func (s) TestTruncateMetadataNotTruncated(t *testing.T) { // "grpc-trace-bin" is kept in log but not counted towards the size // limit. { - ml: newMethodLogger(1, maxUInt), + ml: NewMethodLogger(1, maxUInt), mpPb: &pb.Metadata{ Entry: []*pb.MetadataEntry{ {Key: "", Value: []byte{1}}, @@ -423,7 +423,7 @@ func (s) TestTruncateMetadataTruncated(t *testing.T) { entryLen int }{ { - ml: newMethodLogger(2, maxUInt), + ml: NewMethodLogger(2, maxUInt), mpPb: &pb.Metadata{ Entry: []*pb.MetadataEntry{ {Key: "", Value: []byte{1, 1, 1}}, @@ -432,7 +432,7 @@ func (s) TestTruncateMetadataTruncated(t *testing.T) { entryLen: 0, }, { - ml: newMethodLogger(2, maxUInt), + ml: NewMethodLogger(2, maxUInt), mpPb: &pb.Metadata{ Entry: []*pb.MetadataEntry{ {Key: "", Value: []byte{1}}, @@ -443,7 +443,7 @@ func (s) TestTruncateMetadataTruncated(t *testing.T) { entryLen: 2, }, { - ml: newMethodLogger(2, maxUInt), + ml: NewMethodLogger(2, maxUInt), mpPb: &pb.Metadata{ Entry: []*pb.MetadataEntry{ {Key: "", Value: []byte{1, 1}}, @@ -453,7 +453,7 @@ func (s) TestTruncateMetadataTruncated(t *testing.T) { entryLen: 1, }, { - ml: newMethodLogger(2, maxUInt), + ml: NewMethodLogger(2, maxUInt), mpPb: &pb.Metadata{ Entry: []*pb.MetadataEntry{ {Key: "", Value: []byte{1}}, @@ -482,19 +482,19 @@ func (s) TestTruncateMessageNotTruncated(t *testing.T) { msgPb *pb.Message }{ { - ml: newMethodLogger(maxUInt, maxUInt), + ml: NewMethodLogger(maxUInt, maxUInt), msgPb: &pb.Message{ Data: []byte{1}, }, }, { - ml: newMethodLogger(maxUInt, 3), + ml: NewMethodLogger(maxUInt, 3), msgPb: &pb.Message{ Data: []byte{1, 1}, }, }, { - ml: newMethodLogger(maxUInt, 2), + ml: NewMethodLogger(maxUInt, 2), msgPb: &pb.Message{ Data: []byte{1, 1}, }, @@ -517,7 +517,7 @@ func (s) TestTruncateMessageTruncated(t *testing.T) { oldLength uint32 }{ { - ml: newMethodLogger(maxUInt, 2), + ml: NewMethodLogger(maxUInt, 2), msgPb: &pb.Message{ Length: 3, Data: []byte{1, 1, 1}, diff --git a/observability/internal/config/config.pb.go b/observability/internal/config/config.pb.go index 16f840016fa..61b1093e757 100644 --- a/observability/internal/config/config.pb.go +++ b/observability/internal/config/config.pb.go @@ -128,12 +128,21 @@ type ObservabilityConfig_LogFilter struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - // A string which can select a group of method names. Only "*" wildcard - // is accepted. + // Pattern is a string which can select a group of method names. By + // default, the pattern is an empty string, matching no methods. + // + // Only "*" Wildcard is accepted for pattern. A pattern is in the form + // of / or just a character "*" . + // + // If the pattern is "*", it specifies the defaults for all the + // services; If the pattern is /*, it specifies the defaults + // for all methods in the specified service ; If the pattern is + // */, this is not supported. + // // Examples: - // - "Foo/Bar" selects only the method "Bar" from service "Foo" - // - "Foo/*" selects all methods from service "Foo" - // - "*/*" selects all methods from all services. + // - "Foo/Bar" selects only the method "Bar" from service "Foo" + // - "Foo/*" selects all methods from service "Foo" + // - "*" selects all methods from all services. Pattern string `protobuf:"bytes,1,opt,name=pattern,proto3" json:"pattern,omitempty"` // Number of bytes of each header to log. If the size of the header is // greater than the defined limit, content pass the limit will be diff --git a/observability/internal/config/config.proto b/observability/internal/config/config.proto index 7e8f992edd7..883d1984e18 100644 --- a/observability/internal/config/config.proto +++ b/observability/internal/config/config.proto @@ -44,12 +44,21 @@ message ObservabilityConfig { string destination_project_id = 2; message LogFilter { - // A string which can select a group of method names. Only "*" wildcard - // is accepted. + // Pattern is a string which can select a group of method names. By + // default, the pattern is an empty string, matching no methods. + // + // Only "*" Wildcard is accepted for pattern. A pattern is in the form + // of / or just a character "*" . + // + // If the pattern is "*", it specifies the defaults for all the + // services; If the pattern is /*, it specifies the defaults + // for all methods in the specified service ; If the pattern is + // */, this is not supported. + // // Examples: - // - "Foo/Bar" selects only the method "Bar" from service "Foo" - // - "Foo/*" selects all methods from service "Foo" - // - "*/*" selects all methods from all services. + // - "Foo/Bar" selects only the method "Bar" from service "Foo" + // - "Foo/*" selects all methods from service "Foo" + // - "*" selects all methods from all services. string pattern = 1; // Number of bytes of each header to log. If the size of the header is // greater than the defined limit, content pass the limit will be diff --git a/observability/logging.go b/observability/logging.go index 75110abf178..ce7684eaa70 100644 --- a/observability/logging.go +++ b/observability/logging.go @@ -27,6 +27,7 @@ import ( "github.com/google/uuid" binlogpb "google.golang.org/grpc/binarylog/grpc_binarylog_v1" iblog "google.golang.org/grpc/internal/binarylog" + "google.golang.org/grpc/internal/grpcutil" configpb "google.golang.org/grpc/observability/internal/config" grpclogrecordpb "google.golang.org/grpc/observability/internal/logging" ) @@ -164,11 +165,47 @@ type observabilityBinaryLogger struct { // by this plugin. Users are allowed to subscribe to a completely different // set of methods. originalLogger iblog.Logger - // wrappedLogger is a Logger needed to reuse the control string parsing, logger - // config managing logic - wrappedLogger atomic.Value // exporter is a loggingExporter and the handle for uploading collected data to backends exporter atomic.Value + // filters is []*configpb.ObservabilityConfig_LogFilter used to set config on methods + filters atomic.Value +} + +func matchLogFilter(serviceMethod string, filters []*configpb.ObservabilityConfig_LogFilter) *configpb.ObservabilityConfig_LogFilter { + // Validate the filters one by one, pick the first match. + for _, filter := range filters { + if filter.Pattern == "*" { + // Match a "*" + return filter + } + if strings.HasPrefix(filter.Pattern, "-") { + // Exclude "-..." + logger.Warningf("invalid log filter pattern: %v", filter.Pattern) + return nil + } + filterService, filterMethod, _, err := iblog.ParseMethodConfigAndSuffix(filter.Pattern) + if err != nil { + logger.Warningf("invalid log filter pattern: %v", err) + return nil + } + if filterMethod == "*" { + // Handle "p.s/*" case + s, _, err := grpcutil.ParseMethod(serviceMethod) + if err != nil { + logger.Warningf("invalid service method: %v", err) + return nil + } + if s == filterService { + return filter + } + return nil + } + if serviceMethod == filter.Pattern { + // Exact match of "p.s/m" + return filter + } + } + return nil } func (l *observabilityBinaryLogger) GetMethodLogger(methodName string) iblog.MethodLogger { @@ -178,15 +215,6 @@ func (l *observabilityBinaryLogger) GetMethodLogger(methodName string) iblog.Met ol = l.originalLogger.GetMethodLogger(methodName) } - wlPtr := l.wrappedLogger.Load() - if wlPtr == nil { - return ol - } - ml = wlPtr.(iblog.Logger).GetMethodLogger(methodName) - if ml == nil { - return ol - } - ePtr := l.exporter.Load() // If no exporter is specified, there is no point creating a method // logger. We don't have any chance to inject exporter after its @@ -194,12 +222,35 @@ func (l *observabilityBinaryLogger) GetMethodLogger(methodName string) iblog.Met if ePtr == nil { return ol } + exporter := ePtr.(loggingExporter) + + filtersPtr := l.filters.Load() + if filtersPtr == nil { + // No filters set + return ol + } + filters := filtersPtr.([]*configpb.ObservabilityConfig_LogFilter) + if len(filters) == 0 { + // No filters in the list + return ol + } + + // 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" { + return ol + } + filter := matchLogFilter(methodName, filters) + ml = iblog.NewMethodLogger(uint64(filter.HeaderBytes), uint64(filter.MessageBytes)) return &observabilityBinaryMethodLogger{ originalMethodLogger: ol, wrappedMethodLogger: ml, rpcID: uuid.NewString(), - exporter: ePtr.(loggingExporter), + exporter: exporter, } } @@ -218,14 +269,11 @@ func (l *observabilityBinaryLogger) Close() { // start is the core logic for setting up the custom binary logging logger, and // it's also useful for testing. func (l *observabilityBinaryLogger) start(config *configpb.ObservabilityConfig, exporter loggingExporter) error { - binlogConfig := iblog.NewLoggerFromConfigString(compileBinaryLogControlString(config)) - if binlogConfig != nil { - defaultLogger.wrappedLogger.Store(binlogConfig) - } + l.filters.Store(config.GetLogFilters()) if exporter != nil { defaultLogger.exporter.Store(exporter) } - logger.Infof("Start logging with config [%v]", binlogConfig) + logger.Info("Start gRPC Observability logger") return nil } @@ -253,26 +301,6 @@ func newObservabilityBinaryLogger(iblogger iblog.Logger) *observabilityBinaryLog } } -func compileBinaryLogControlString(config *configpb.ObservabilityConfig) string { - if len(config.LogFilters) == 0 { - return "" - } - - entries := make([]string, 0, len(config.LogFilters)+1) - for _, logFilter := range config.LogFilters { - // With undefined HeaderBytes or MessageBytes, the intended behavior is - // logging zero payload. This detail is different than binary logging. - entries = append(entries, fmt.Sprintf("%v{h:%v;m:%v}", logFilter.Pattern, logFilter.HeaderBytes, logFilter.MessageBytes)) - } - // 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. - entries = append(entries, "-google.logging.v2.LoggingServiceV2/WriteLogEntries") - return strings.Join(entries, ",") -} - var defaultLogger *observabilityBinaryLogger func prepareLogging() { diff --git a/observability/tags_test.go b/observability/tags_test.go index c281d8b437a..5a0353a0308 100644 --- a/observability/tags_test.go +++ b/observability/tags_test.go @@ -1,6 +1,6 @@ /* * - * Copyright 2018 gRPC authors. + * Copyright 2022 gRPC authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. From 13f8ebc3c4f9f76d3fde64e186f65ed1a9d1d4ec Mon Sep 17 00:00:00 2001 From: Lidi Zheng Date: Wed, 23 Mar 2022 12:45:05 -0700 Subject: [PATCH 06/23] Add a test case for filters' priority --- observability/observability_test.go | 98 +++++++++++++++++++++++------ 1 file changed, 79 insertions(+), 19 deletions(-) diff --git a/observability/observability_test.go b/observability/observability_test.go index 21db8363ef7..e8f5b2bb20a 100644 --- a/observability/observability_test.go +++ b/observability/observability_test.go @@ -191,9 +191,15 @@ func (te *test) clientConn() *grpc.ClientConn { return te.cc } -func (te *test) enablePluginWithFakeExporters() { - // Disables default exporters - config := &configpb.ObservabilityConfig{ +func (te *test) enablePluginWithConfig(config *configpb.ObservabilityConfig) { + // Injects the fake exporter for testing purposes + defaultLogger = newObservabilityBinaryLogger(nil) + iblog.SetLogger(defaultLogger) + defaultLogger.start(config, te.fle) +} + +func (te *test) enablePluginWithCaptureAll() { + te.enablePluginWithConfig(&configpb.ObservabilityConfig{ EnableCloudLogging: true, DestinationProjectId: "", LogFilters: []*configpb.ObservabilityConfig_LogFilter{ @@ -203,19 +209,7 @@ func (te *test) enablePluginWithFakeExporters() { MessageBytes: infinitySizeBytes, }, }, - } - // Injects the fake exporter for testing purposes - defaultLogger = newObservabilityBinaryLogger(nil) - iblog.SetLogger(defaultLogger) - defaultLogger.start(config, te.fle) -} - -func (te *test) enablePluginWithEmptyConfig() { - config := &configpb.ObservabilityConfig{} - // Injects the fake exporter for testing purposes - defaultLogger = newObservabilityBinaryLogger(nil) - iblog.SetLogger(defaultLogger) - defaultLogger.start(config, te.fle) + }) } func checkEventCommon(t *testing.T, seen *grpclogrecordpb.GrpcLogRecord) { @@ -335,7 +329,7 @@ func checkEventTrailer(t *testing.T, seen *grpclogrecordpb.GrpcLogRecord, want * func (s) TestLoggingForOkCall(t *testing.T) { te := newTest(t) defer te.tearDown() - te.enablePluginWithFakeExporters() + te.enablePluginWithCaptureAll() te.startServer(&testServer{}) tc := testgrpc.NewTestServiceClient(te.clientConn()) @@ -405,7 +399,7 @@ func (s) TestLoggingForOkCall(t *testing.T) { func (s) TestLoggingForErrorCall(t *testing.T) { te := newTest(t) defer te.tearDown() - te.enablePluginWithFakeExporters() + te.enablePluginWithCaptureAll() te.startServer(&testServer{}) tc := testgrpc.NewTestServiceClient(te.clientConn()) @@ -469,7 +463,7 @@ func (s) TestLoggingForErrorCall(t *testing.T) { func (s) TestNoConfig(t *testing.T) { te := newTest(t) defer te.tearDown() - te.enablePluginWithEmptyConfig() + te.enablePluginWithConfig(&configpb.ObservabilityConfig{}) te.startServer(&testServer{}) tc := testgrpc.NewTestServiceClient(te.clientConn()) @@ -498,3 +492,69 @@ func (s) TestNoConfig(t *testing.T) { t.Fatalf("expects 0 server events, got %d", len(te.fle.serverEvents)) } } + +func (s) TestOverrideConfig(t *testing.T) { + te := newTest(t) + defer te.tearDown() + // Setting 3 filters, expected to use the second filter. The second filter + // allows message payload logging, and others disabling the message payload + // logging. We should observe this behavior latter. + te.enablePluginWithConfig(&configpb.ObservabilityConfig{ + EnableCloudLogging: true, + LogFilters: []*configpb.ObservabilityConfig_LogFilter{ + &configpb.ObservabilityConfig_LogFilter{ + Pattern: "wont/match", + MessageBytes: 0, + }, + &configpb.ObservabilityConfig_LogFilter{ + Pattern: "*", + MessageBytes: 4096, + }, + &configpb.ObservabilityConfig_LogFilter{ + Pattern: "grpc.testing.TestService/*", + MessageBytes: 0, + }, + }, + }) + te.startServer(&testServer{}) + tc := testgrpc.NewTestServiceClient(te.clientConn()) + + var ( + resp *testpb.SimpleResponse + req *testpb.SimpleRequest + err error + ) + req = &testpb.SimpleRequest{Payload: &testpb.Payload{Body: testOkPayload}} + tCtx, cancel := context.WithTimeout(context.Background(), defaultTestTimeout) + defer cancel() + resp, err = tc.UnaryCall(metadata.NewOutgoingContext(tCtx, testHeaderMetadata), req) + if err != nil { + t.Fatalf("unary call failed: %v", err) + } + t.Logf("unary call passed: %v", resp) + + // Wait for the gRPC transport to gracefully close to ensure no lost event. + te.cc.Close() + te.srv.GracefulStop() + // Check size of events + if len(te.fle.clientEvents) != 5 { + t.Fatalf("expects 5 client events, got %d", len(te.fle.clientEvents)) + } + if len(te.fle.serverEvents) != 5 { + t.Fatalf("expects 5 server events, got %d", len(te.fle.serverEvents)) + } + // Check Client message payloads + checkEventRequestMessage(te.t, te.fle.clientEvents[1], &grpclogrecordpb.GrpcLogRecord{ + EventLogger: grpclogrecordpb.GrpcLogRecord_LOGGER_CLIENT, + }, testOkPayload) + checkEventResponseMessage(te.t, te.fle.clientEvents[3], &grpclogrecordpb.GrpcLogRecord{ + EventLogger: grpclogrecordpb.GrpcLogRecord_LOGGER_CLIENT, + }, testOkPayload) + // Check Server message payloads + checkEventRequestMessage(te.t, te.fle.serverEvents[1], &grpclogrecordpb.GrpcLogRecord{ + EventLogger: grpclogrecordpb.GrpcLogRecord_LOGGER_SERVER, + }, testOkPayload) + checkEventResponseMessage(te.t, te.fle.serverEvents[3], &grpclogrecordpb.GrpcLogRecord{ + EventLogger: grpclogrecordpb.GrpcLogRecord_LOGGER_SERVER, + }, testOkPayload) +} From e034f241d30d9c42378a0438b2f55b6f3dc94ea6 Mon Sep 17 00:00:00 2001 From: Lidi Zheng Date: Wed, 23 Mar 2022 12:48:56 -0700 Subject: [PATCH 07/23] Fix the internal binarylog unit tests --- internal/binarylog/env_config_test.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/internal/binarylog/env_config_test.go b/internal/binarylog/env_config_test.go index f67b4fd6032..94166a856ea 100644 --- a/internal/binarylog/env_config_test.go +++ b/internal/binarylog/env_config_test.go @@ -134,8 +134,8 @@ func (s) TestParseMethodConfigAndSuffix(t *testing.T) { }, } for _, tc := range testCases { - t.Logf("testing parseMethodConfigAndSuffix(%q)", tc.in) - s, m, suffix, err := parseMethodConfigAndSuffix(tc.in) + t.Logf("testing ParseMethodConfigAndSuffix(%q)", tc.in) + s, m, suffix, err := ParseMethodConfigAndSuffix(tc.in) if err != nil { t.Errorf("returned error %v, want nil", err) continue @@ -158,7 +158,7 @@ func (s) TestParseMethodConfigAndSuffixInvalid(t *testing.T) { "*/m{}", } for _, tc := range testCases { - s, m, suffix, err := parseMethodConfigAndSuffix(tc) + s, m, suffix, err := ParseMethodConfigAndSuffix(tc) if err == nil { t.Errorf("Parsing %q got nil error with %q, %q, %q, want non-nil error", tc, s, m, suffix) } From da1a378038c7c156cbe44d283e0f5ca593ab80b1 Mon Sep 17 00:00:00 2001 From: Lidi Zheng Date: Wed, 23 Mar 2022 13:00:15 -0700 Subject: [PATCH 08/23] Make vet.sh happy --- observability/observability_test.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/observability/observability_test.go b/observability/observability_test.go index e8f5b2bb20a..2981912466c 100644 --- a/observability/observability_test.go +++ b/observability/observability_test.go @@ -502,15 +502,15 @@ func (s) TestOverrideConfig(t *testing.T) { te.enablePluginWithConfig(&configpb.ObservabilityConfig{ EnableCloudLogging: true, LogFilters: []*configpb.ObservabilityConfig_LogFilter{ - &configpb.ObservabilityConfig_LogFilter{ + { Pattern: "wont/match", MessageBytes: 0, }, - &configpb.ObservabilityConfig_LogFilter{ + { Pattern: "*", MessageBytes: 4096, }, - &configpb.ObservabilityConfig_LogFilter{ + { Pattern: "grpc.testing.TestService/*", MessageBytes: 0, }, From 229534de3d212d50061b886d51ebb7f1a30050b0 Mon Sep 17 00:00:00 2001 From: Lidi Zheng Date: Wed, 23 Mar 2022 13:07:21 -0700 Subject: [PATCH 09/23] Don't expose internal struct --- internal/binarylog/method_logger.go | 2 +- internal/binarylog/method_logger_test.go | 22 +++++++++++----------- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/internal/binarylog/method_logger.go b/internal/binarylog/method_logger.go index df480b34bb7..07fb0657a9f 100644 --- a/internal/binarylog/method_logger.go +++ b/internal/binarylog/method_logger.go @@ -62,7 +62,7 @@ type methodLogger struct { } // NewMethodLogger creates methodLogger based on input config -func NewMethodLogger(h, m uint64) *methodLogger { +func NewMethodLogger(h, m uint64) MethodLogger { return &methodLogger{ headerMaxLen: h, messageMaxLen: m, diff --git a/internal/binarylog/method_logger_test.go b/internal/binarylog/method_logger_test.go index ae07c66c77c..ff2009a20c3 100644 --- a/internal/binarylog/method_logger_test.go +++ b/internal/binarylog/method_logger_test.go @@ -34,7 +34,7 @@ import ( func (s) TestLog(t *testing.T) { idGen.reset() - ml := NewMethodLogger(10, 10) + ml := NewMethodLogger(10, 10).(*methodLogger) // Set sink to testing buffer. buf := bytes.NewBuffer(nil) ml.sink = newWriterSink(buf) @@ -350,7 +350,7 @@ func (s) TestLog(t *testing.T) { func (s) TestTruncateMetadataNotTruncated(t *testing.T) { testCases := []struct { - ml *methodLogger + ml MethodLogger mpPb *pb.Metadata }{ { @@ -408,7 +408,7 @@ func (s) TestTruncateMetadataNotTruncated(t *testing.T) { } for i, tc := range testCases { - truncated := tc.ml.truncateMetadata(tc.mpPb) + truncated := tc.ml.(*methodLogger).truncateMetadata(tc.mpPb) if truncated { t.Errorf("test case %v, returned truncated, want not truncated", i) } @@ -417,7 +417,7 @@ func (s) TestTruncateMetadataNotTruncated(t *testing.T) { func (s) TestTruncateMetadataTruncated(t *testing.T) { testCases := []struct { - ml *methodLogger + ml MethodLogger mpPb *pb.Metadata entryLen int @@ -465,7 +465,7 @@ func (s) TestTruncateMetadataTruncated(t *testing.T) { } for i, tc := range testCases { - truncated := tc.ml.truncateMetadata(tc.mpPb) + truncated := tc.ml.(*methodLogger).truncateMetadata(tc.mpPb) if !truncated { t.Errorf("test case %v, returned not truncated, want truncated", i) continue @@ -478,7 +478,7 @@ func (s) TestTruncateMetadataTruncated(t *testing.T) { func (s) TestTruncateMessageNotTruncated(t *testing.T) { testCases := []struct { - ml *methodLogger + ml MethodLogger msgPb *pb.Message }{ { @@ -502,7 +502,7 @@ func (s) TestTruncateMessageNotTruncated(t *testing.T) { } for i, tc := range testCases { - truncated := tc.ml.truncateMessage(tc.msgPb) + truncated := tc.ml.(*methodLogger).truncateMessage(tc.msgPb) if truncated { t.Errorf("test case %v, returned truncated, want not truncated", i) } @@ -511,7 +511,7 @@ func (s) TestTruncateMessageNotTruncated(t *testing.T) { func (s) TestTruncateMessageTruncated(t *testing.T) { testCases := []struct { - ml *methodLogger + ml MethodLogger msgPb *pb.Message oldLength uint32 @@ -527,13 +527,13 @@ func (s) TestTruncateMessageTruncated(t *testing.T) { } for i, tc := range testCases { - truncated := tc.ml.truncateMessage(tc.msgPb) + truncated := tc.ml.(*methodLogger).truncateMessage(tc.msgPb) if !truncated { t.Errorf("test case %v, returned not truncated, want truncated", i) continue } - if len(tc.msgPb.Data) != int(tc.ml.messageMaxLen) { - t.Errorf("test case %v, message length: %v, want: %v", i, len(tc.msgPb.Data), tc.ml.messageMaxLen) + if len(tc.msgPb.Data) != int(tc.ml.(*methodLogger).messageMaxLen) { + t.Errorf("test case %v, message length: %v, want: %v", i, len(tc.msgPb.Data), tc.ml.(*methodLogger).messageMaxLen) } if tc.msgPb.Length != tc.oldLength { t.Errorf("test case %v, message.Length field: %v, want: %v", i, tc.msgPb.Length, tc.oldLength) From 97c9aada6b53b1e6c9b8f473ef1d1f15fdacdfa1 Mon Sep 17 00:00:00 2001 From: Lidi Zheng Date: Wed, 23 Mar 2022 17:50:04 -0700 Subject: [PATCH 10/23] Address reviewer's comments --- internal/binarylog/env_config.go | 8 ++-- internal/binarylog/env_config_test.go | 10 ++--- internal/binarylog/method_logger.go | 6 +-- observability/logging.go | 64 ++++++++++++++++++--------- observability/observability_test.go | 44 ++++++++++++++++++ 5 files changed, 98 insertions(+), 34 deletions(-) diff --git a/internal/binarylog/env_config.go b/internal/binarylog/env_config.go index 431e6956315..e5e469d09d5 100644 --- a/internal/binarylog/env_config.go +++ b/internal/binarylog/env_config.go @@ -67,7 +67,7 @@ func (l *logger) fillMethodLoggerWithConfigString(config string) error { // "-service/method", blacklist, no * or {} allowed. if config[0] == '-' { - s, m, suffix, err := ParseMethodConfigAndSuffix(config[1:]) + s, m, suffix, err := parseMethodConfigAndSuffix(config[1:]) if err != nil { return fmt.Errorf("invalid config: %q, %v", config, err) } @@ -95,7 +95,7 @@ func (l *logger) fillMethodLoggerWithConfigString(config string) error { return nil } - s, m, suffix, err := ParseMethodConfigAndSuffix(config) + s, m, suffix, err := parseMethodConfigAndSuffix(config) if err != nil { return fmt.Errorf("invalid config: %q, %v", config, err) } @@ -138,9 +138,9 @@ var ( headerMessageConfigRegexp = regexp.MustCompile(headerMessageConfigRegexpStr) ) -// ParseMethodConfigAndSuffix turns "service/method{h;m}" into "service", +// parseMethodConfigAndSuffix turns "service/method{h;m}" into "service", // "method", "{h;m}". -func ParseMethodConfigAndSuffix(c string) (service, method, suffix string, _ error) { +func parseMethodConfigAndSuffix(c string) (service, method, suffix string, _ error) { // Regexp result: // // in: "p.s/m{h:123,m:123}", diff --git a/internal/binarylog/env_config_test.go b/internal/binarylog/env_config_test.go index 94166a856ea..82325025656 100644 --- a/internal/binarylog/env_config_test.go +++ b/internal/binarylog/env_config_test.go @@ -90,7 +90,7 @@ func (s) TestNewLoggerFromConfigStringInvalid(t *testing.T) { } } -func (s) TestParseMethodConfigAndSuffix(t *testing.T) { +func (s) TestparseMethodConfigAndSuffix(t *testing.T) { testCases := []struct { in, service, method, suffix string }{ @@ -134,8 +134,8 @@ func (s) TestParseMethodConfigAndSuffix(t *testing.T) { }, } for _, tc := range testCases { - t.Logf("testing ParseMethodConfigAndSuffix(%q)", tc.in) - s, m, suffix, err := ParseMethodConfigAndSuffix(tc.in) + t.Logf("testing parseMethodConfigAndSuffix(%q)", tc.in) + s, m, suffix, err := parseMethodConfigAndSuffix(tc.in) if err != nil { t.Errorf("returned error %v, want nil", err) continue @@ -152,13 +152,13 @@ func (s) TestParseMethodConfigAndSuffix(t *testing.T) { } } -func (s) TestParseMethodConfigAndSuffixInvalid(t *testing.T) { +func (s) TestparseMethodConfigAndSuffixInvalid(t *testing.T) { testCases := []string{ "*/m", "*/m{}", } for _, tc := range testCases { - s, m, suffix, err := ParseMethodConfigAndSuffix(tc) + s, m, suffix, err := parseMethodConfigAndSuffix(tc) if err == nil { t.Errorf("Parsing %q got nil error with %q, %q, %q, want non-nil error", tc, s, m, suffix) } diff --git a/internal/binarylog/method_logger.go b/internal/binarylog/method_logger.go index 07fb0657a9f..f5cf3db603d 100644 --- a/internal/binarylog/method_logger.go +++ b/internal/binarylog/method_logger.go @@ -62,10 +62,10 @@ type methodLogger struct { } // NewMethodLogger creates methodLogger based on input config -func NewMethodLogger(h, m uint64) MethodLogger { +func NewMethodLogger(headerMaxLen, messageMaxLen uint64) MethodLogger { return &methodLogger{ - headerMaxLen: h, - messageMaxLen: m, + headerMaxLen: headerMaxLen, + messageMaxLen: messageMaxLen, callID: idGen.next(), idWithinCallGen: &callIDGenerator{}, diff --git a/observability/logging.go b/observability/logging.go index ce7684eaa70..2c1e020d607 100644 --- a/observability/logging.go +++ b/observability/logging.go @@ -23,6 +23,7 @@ import ( "fmt" "strings" "sync/atomic" + "unsafe" "github.com/google/uuid" binlogpb "google.golang.org/grpc/binarylog/grpc_binarylog_v1" @@ -166,9 +167,9 @@ type observabilityBinaryLogger struct { // set of methods. originalLogger iblog.Logger // exporter is a loggingExporter and the handle for uploading collected data to backends - exporter atomic.Value + exporter unsafe.Pointer // loggingExporter // filters is []*configpb.ObservabilityConfig_LogFilter used to set config on methods - filters atomic.Value + filters unsafe.Pointer // []*configpb.ObservabilityConfig_LogFilter } func matchLogFilter(serviceMethod string, filters []*configpb.ObservabilityConfig_LogFilter) *configpb.ObservabilityConfig_LogFilter { @@ -180,19 +181,34 @@ func matchLogFilter(serviceMethod string, filters []*configpb.ObservabilityConfi } if strings.HasPrefix(filter.Pattern, "-") { // Exclude "-..." - logger.Warningf("invalid log filter pattern: %v", filter.Pattern) + logger.Warningf("Invalid log filter pattern: %v: pattern can't start with \"-\"", filter.Pattern) return nil } - filterService, filterMethod, _, err := iblog.ParseMethodConfigAndSuffix(filter.Pattern) - if err != nil { - logger.Warningf("invalid log filter pattern: %v", err) + + tokens := strings.SplitN(filter.Pattern, "/", 2) + if len(tokens) != 2 { + // No / in the pattern + logger.Warningf("Invalid log filter pattern: %v: pattern doesn't contain a \"/\"", filter.Pattern) + return nil + } + filterService := tokens[0] + filterMethod := tokens[1] + if strings.Contains(filterService, "*") && len(filterService) != 1 { + // Exclude "Fo*o/..." + logger.Warningf("Invalid log filter pattern: %v: incorrect use of \"*\"", filter.Pattern) return nil } + if strings.Contains(filterMethod, "*") && len(filterMethod) != 1 { + // Exclude ".../Ba*r" + logger.Warningf("Invalid log filter pattern: %v: incorrect use of \"*\"", filter.Pattern) + return nil + } + if filterMethod == "*" { // Handle "p.s/*" case s, _, err := grpcutil.ParseMethod(serviceMethod) if err != nil { - logger.Warningf("invalid service method: %v", err) + logger.Warningf("Invalid service method: %v", err) return nil } if s == filterService { @@ -215,25 +231,21 @@ func (l *observabilityBinaryLogger) GetMethodLogger(methodName string) iblog.Met ol = l.originalLogger.GetMethodLogger(methodName) } - ePtr := l.exporter.Load() + ePtr := atomic.LoadPointer(&l.exporter) // If no exporter is specified, there is no point creating a method // logger. We don't have any chance to inject exporter after its // creation. if ePtr == nil { return ol } - exporter := ePtr.(loggingExporter) + exporter := (*loggingExporter)(ePtr) - filtersPtr := l.filters.Load() + filtersPtr := atomic.LoadPointer(&l.filters) if filtersPtr == nil { // No filters set return ol } - filters := filtersPtr.([]*configpb.ObservabilityConfig_LogFilter) - if len(filters) == 0 { - // No filters in the list - return ol - } + filters := (*[]*configpb.ObservabilityConfig_LogFilter)(filtersPtr) // 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 @@ -244,13 +256,17 @@ func (l *observabilityBinaryLogger) GetMethodLogger(methodName string) iblog.Met return ol } - filter := matchLogFilter(methodName, filters) + filter := matchLogFilter(methodName, *filters) + if filter == nil { + // No matching filter found + return ol + } ml = iblog.NewMethodLogger(uint64(filter.HeaderBytes), uint64(filter.MessageBytes)) return &observabilityBinaryMethodLogger{ originalMethodLogger: ol, wrappedMethodLogger: ml, rpcID: uuid.NewString(), - exporter: exporter, + exporter: *exporter, } } @@ -258,9 +274,10 @@ func (l *observabilityBinaryLogger) Close() { if l == nil { return } - exporter := l.exporter.Load() - if exporter != nil { - if err := exporter.(loggingExporter).Close(); err != nil { + ePtr := atomic.LoadPointer(&l.exporter) + if ePtr != nil { + exporter := (*loggingExporter)(ePtr) + if err := (*exporter).Close(); err != nil { logger.Infof("Failed to close logging exporter: %v", err) } } @@ -269,9 +286,12 @@ func (l *observabilityBinaryLogger) Close() { // start is the core logic for setting up the custom binary logging logger, and // it's also useful for testing. func (l *observabilityBinaryLogger) start(config *configpb.ObservabilityConfig, exporter loggingExporter) error { - l.filters.Store(config.GetLogFilters()) + filters := config.GetLogFilters() + if len(filters) > 0 { + atomic.StorePointer(&l.filters, unsafe.Pointer(&filters)) + } if exporter != nil { - defaultLogger.exporter.Store(exporter) + atomic.StorePointer(&l.exporter, unsafe.Pointer(&exporter)) } logger.Info("Start gRPC Observability logger") return nil diff --git a/observability/observability_test.go b/observability/observability_test.go index 2981912466c..4de774ac6e2 100644 --- a/observability/observability_test.go +++ b/observability/observability_test.go @@ -558,3 +558,47 @@ func (s) TestOverrideConfig(t *testing.T) { EventLogger: grpclogrecordpb.GrpcLogRecord_LOGGER_SERVER, }, testOkPayload) } + +func (s) TestNoMatch(t *testing.T) { + te := newTest(t) + defer te.tearDown() + // Setting 3 filters, expected to use the second filter. The second filter + // allows message payload logging, and others disabling the message payload + // logging. We should observe this behavior latter. + te.enablePluginWithConfig(&configpb.ObservabilityConfig{ + EnableCloudLogging: true, + LogFilters: []*configpb.ObservabilityConfig_LogFilter{ + { + Pattern: "wont/match", + MessageBytes: 0, + }, + }, + }) + te.startServer(&testServer{}) + tc := testgrpc.NewTestServiceClient(te.clientConn()) + + var ( + resp *testpb.SimpleResponse + req *testpb.SimpleRequest + err error + ) + req = &testpb.SimpleRequest{Payload: &testpb.Payload{Body: testOkPayload}} + tCtx, cancel := context.WithTimeout(context.Background(), defaultTestTimeout) + defer cancel() + resp, err = tc.UnaryCall(metadata.NewOutgoingContext(tCtx, testHeaderMetadata), req) + if err != nil { + t.Fatalf("unary call failed: %v", err) + } + t.Logf("unary call passed: %v", resp) + + // Wait for the gRPC transport to gracefully close to ensure no lost event. + te.cc.Close() + te.srv.GracefulStop() + // Check size of events + if len(te.fle.clientEvents) != 0 { + t.Fatalf("expects 0 client events, got %d", len(te.fle.clientEvents)) + } + if len(te.fle.serverEvents) != 0 { + t.Fatalf("expects 0 server events, got %d", len(te.fle.serverEvents)) + } +} From 4672b81b40db32cb8ae5d2f33381d81a81a6056a Mon Sep 17 00:00:00 2001 From: Lidi Zheng Date: Wed, 23 Mar 2022 18:00:55 -0700 Subject: [PATCH 11/23] Resolve one more missed comment --- observability/tags.go | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/observability/tags.go b/observability/tags.go index 705ba164834..c9a900970ea 100644 --- a/observability/tags.go +++ b/observability/tags.go @@ -33,8 +33,13 @@ func getCustomTags(envs []string) map[string]string { if !strings.HasPrefix(e, envPrefixCustomTags) { continue } - if i := strings.Index(e, "="); i > envPrefixLen { - m[e[envPrefixLen:i]] = e[i+1:] + tokens := strings.SplitN(e, "=", 2) + if len(tokens) == 2 { + if len(tokens[0]) == envPrefixLen { + // Empty key is not allowed + continue + } + m[tokens[0][envPrefixLen:]] = tokens[1] } } return m From 4d04d3ddfd3032e37336120d99d55fa229fb78b9 Mon Sep 17 00:00:00 2001 From: Lidi Zheng Date: Thu, 24 Mar 2022 10:14:33 -0700 Subject: [PATCH 12/23] Separate validation and matching of patterns && 2 more test cases --- internal/binarylog/env_config.go | 3 +-- internal/binarylog/env_config_test.go | 4 +-- observability/config.go | 34 +++++++++++++++++++----- observability/logging.go | 29 ++++---------------- observability/observability.go | 5 +++- observability/observability_test.go | 38 +++++++++++++++++++++++++-- 6 files changed, 75 insertions(+), 38 deletions(-) diff --git a/internal/binarylog/env_config.go b/internal/binarylog/env_config.go index e5e469d09d5..d8f4e7602fd 100644 --- a/internal/binarylog/env_config.go +++ b/internal/binarylog/env_config.go @@ -138,8 +138,7 @@ var ( headerMessageConfigRegexp = regexp.MustCompile(headerMessageConfigRegexpStr) ) -// parseMethodConfigAndSuffix turns "service/method{h;m}" into "service", -// "method", "{h;m}". +// Turn "service/method{h;m}" into "service", "method", "{h;m}". func parseMethodConfigAndSuffix(c string) (service, method, suffix string, _ error) { // Regexp result: // diff --git a/internal/binarylog/env_config_test.go b/internal/binarylog/env_config_test.go index 82325025656..f67b4fd6032 100644 --- a/internal/binarylog/env_config_test.go +++ b/internal/binarylog/env_config_test.go @@ -90,7 +90,7 @@ func (s) TestNewLoggerFromConfigStringInvalid(t *testing.T) { } } -func (s) TestparseMethodConfigAndSuffix(t *testing.T) { +func (s) TestParseMethodConfigAndSuffix(t *testing.T) { testCases := []struct { in, service, method, suffix string }{ @@ -152,7 +152,7 @@ func (s) TestparseMethodConfigAndSuffix(t *testing.T) { } } -func (s) TestparseMethodConfigAndSuffixInvalid(t *testing.T) { +func (s) TestParseMethodConfigAndSuffixInvalid(t *testing.T) { testCases := []string{ "*/m", "*/m{}", diff --git a/observability/config.go b/observability/config.go index 121e6d22148..8f6e5616f1b 100644 --- a/observability/config.go +++ b/observability/config.go @@ -20,7 +20,9 @@ package observability import ( "context" + "fmt" "os" + "regexp" gcplogging "cloud.google.com/go/logging" "golang.org/x/oauth2/google" @@ -29,10 +31,13 @@ import ( ) const ( - envObservabilityConfig = "GRPC_CONFIG_OBSERVABILITY" - envProjectID = "GOOGLE_CLOUD_PROJECT" + envObservabilityConfig = "GRPC_CONFIG_OBSERVABILITY" + envProjectID = "GOOGLE_CLOUD_PROJECT" + logFilterPatternRegexpStr = `^([\w./]+)/((?:\w+)|[*])$` ) +var logFilterPatternRegexp = regexp.MustCompile(logFilterPatternRegexpStr) + // fetchDefaultProjectID fetches the default GCP project id from environment. func fetchDefaultProjectID(ctx context.Context) string { // Step 1: Check ENV var @@ -54,19 +59,34 @@ func fetchDefaultProjectID(ctx context.Context) string { return credentials.ProjectID } -func parseObservabilityConfig() *configpb.ObservabilityConfig { +func validateFilters(config *configpb.ObservabilityConfig) error { + for _, filter := range config.GetLogFilters() { + if filter.Pattern == "*" { + continue + } + match := logFilterPatternRegexp.FindStringSubmatch(filter.Pattern) + if match == nil { + return fmt.Errorf("invalid log filter pattern: %v", filter.Pattern) + } + } + return nil +} + +func parseObservabilityConfig() (*configpb.ObservabilityConfig, error) { // Parse the config from ENV var if content := os.Getenv(envObservabilityConfig); content != "" { var config configpb.ObservabilityConfig if err := protojson.Unmarshal([]byte(content), &config); err != nil { - logger.Infof("Error parsing observability config from env %v: %v", envObservabilityConfig, err) - return nil + return nil, fmt.Errorf("error parsing observability config from env %v: %v", envObservabilityConfig, err) + } + if err := validateFilters(&config); err != nil { + return nil, fmt.Errorf("error parsing observability config: %v", err) } logger.Infof("Parsed ObservabilityConfig: %+v", &config) - return &config + return &config, nil } // If the ENV var doesn't exist, do nothing - return nil + return nil, nil } func maybeUpdateProjectIDInObservabilityConfig(ctx context.Context, config *configpb.ObservabilityConfig) { diff --git a/observability/logging.go b/observability/logging.go index 2c1e020d607..c6b68a70575 100644 --- a/observability/logging.go +++ b/observability/logging.go @@ -173,42 +173,23 @@ type observabilityBinaryLogger struct { } func matchLogFilter(serviceMethod string, filters []*configpb.ObservabilityConfig_LogFilter) *configpb.ObservabilityConfig_LogFilter { - // Validate the filters one by one, pick the first match. + // Try matching the filters one by one, pick the first match. The + // correctness of the log filter pattern is ensured by config.go. for _, filter := range filters { if filter.Pattern == "*" { // Match a "*" return filter } - if strings.HasPrefix(filter.Pattern, "-") { - // Exclude "-..." - logger.Warningf("Invalid log filter pattern: %v: pattern can't start with \"-\"", filter.Pattern) - return nil - } - tokens := strings.SplitN(filter.Pattern, "/", 2) - if len(tokens) != 2 { - // No / in the pattern - logger.Warningf("Invalid log filter pattern: %v: pattern doesn't contain a \"/\"", filter.Pattern) - return nil - } filterService := tokens[0] filterMethod := tokens[1] - if strings.Contains(filterService, "*") && len(filterService) != 1 { - // Exclude "Fo*o/..." - logger.Warningf("Invalid log filter pattern: %v: incorrect use of \"*\"", filter.Pattern) - return nil - } - if strings.Contains(filterMethod, "*") && len(filterMethod) != 1 { - // Exclude ".../Ba*r" - logger.Warningf("Invalid log filter pattern: %v: incorrect use of \"*\"", filter.Pattern) - return nil - } - if filterMethod == "*" { // Handle "p.s/*" case s, _, err := grpcutil.ParseMethod(serviceMethod) if err != nil { - logger.Warningf("Invalid service method: %v", err) + // This service method string is provided by upstream code, if + // it's malformed, we are in bigger trouble. + logger.Errorf("Invalid service method: %v", err) return nil } if s == filterService { diff --git a/observability/observability.go b/observability/observability.go index fce8be42a3e..aa392268d02 100644 --- a/observability/observability.go +++ b/observability/observability.go @@ -52,7 +52,10 @@ func init() { // "observability" module will conflict with existing binarylog usage. // Note: handle the error func Start(ctx context.Context) error { - config := parseObservabilityConfig() + config, err := parseObservabilityConfig() + if err != nil { + return err + } if config == nil { return fmt.Errorf("no ObservabilityConfig found, it can be set via env %s", envObservabilityConfig) } diff --git a/observability/observability_test.go b/observability/observability_test.go index 4de774ac6e2..ac366305806 100644 --- a/observability/observability_test.go +++ b/observability/observability_test.go @@ -23,6 +23,7 @@ import ( "context" "fmt" "net" + "os" "sync" "testing" "time" @@ -195,7 +196,9 @@ func (te *test) enablePluginWithConfig(config *configpb.ObservabilityConfig) { // Injects the fake exporter for testing purposes defaultLogger = newObservabilityBinaryLogger(nil) iblog.SetLogger(defaultLogger) - defaultLogger.start(config, te.fle) + if err := defaultLogger.start(config, te.fle); err != nil { + te.t.Fatalf("Failed to start plugin: %v", err) + } } func (te *test) enablePluginWithCaptureAll() { @@ -460,7 +463,7 @@ func (s) TestLoggingForErrorCall(t *testing.T) { }) } -func (s) TestNoConfig(t *testing.T) { +func (s) TestEmptyConfig(t *testing.T) { te := newTest(t) defer te.tearDown() te.enablePluginWithConfig(&configpb.ObservabilityConfig{}) @@ -602,3 +605,34 @@ func (s) TestNoMatch(t *testing.T) { t.Fatalf("expects 0 server events, got %d", len(te.fle.serverEvents)) } } + +func (s) TestRefuseStartWithInvalidPatterns(t *testing.T) { + config := &configpb.ObservabilityConfig{ + EnableCloudLogging: true, + LogFilters: []*configpb.ObservabilityConfig_LogFilter{ + { + Pattern: ":-)", + }, + { + Pattern: "*", + }, + }, + } + configJSON, err := protojson.Marshal(config) + if err != nil { + t.Fatalf("failed to convert config to JSON: %v", err) + } + os.Setenv(envObservabilityConfig, string(configJSON)) + // If there is at least one invalid pattern, which should not be silently tolerated. + if err := Start(context.Background()); err == nil { + t.Fatalf("Invalid patterns not triggering error") + } +} + +func (s) TestNoEnvSet(t *testing.T) { + os.Setenv(envObservabilityConfig, "") + // If there is no observability config set at all, the Start should return an error. + if err := Start(context.Background()); err == nil { + t.Fatalf("Invalid patterns not triggering error") + } +} From 38dbab559fe0a8127c6fa9534375aebb7296d710 Mon Sep 17 00:00:00 2001 From: Lidi Zheng Date: Fri, 25 Mar 2022 17:02:46 -0700 Subject: [PATCH 13/23] Add stricter config check && address other comments --- observability/config.go | 12 ++-- observability/logging.go | 95 +++++++++++++++++------------ observability/observability.go | 4 +- observability/observability_test.go | 13 ++-- 4 files changed, 73 insertions(+), 51 deletions(-) diff --git a/observability/config.go b/observability/config.go index 8f6e5616f1b..aea2a2db329 100644 --- a/observability/config.go +++ b/observability/config.go @@ -89,12 +89,14 @@ func parseObservabilityConfig() (*configpb.ObservabilityConfig, error) { return nil, nil } -func maybeUpdateProjectIDInObservabilityConfig(ctx context.Context, config *configpb.ObservabilityConfig) { - if config == nil { - return - } +func ensureProjectIDInObservabilityConfig(ctx context.Context, config *configpb.ObservabilityConfig) error { if config.GetDestinationProjectId() == "" { // Try to fetch the GCP project id - config.DestinationProjectId = fetchDefaultProjectID(ctx) + projectID := fetchDefaultProjectID(ctx) + if projectID == "" { + return fmt.Errorf("empty destination project ID") + } + config.DestinationProjectId = projectID } + return nil } diff --git a/observability/logging.go b/observability/logging.go index c6b68a70575..fd99016c2cb 100644 --- a/observability/logging.go +++ b/observability/logging.go @@ -63,14 +63,14 @@ var loggerTypeToEventLogger = map[binlogpb.GrpcLogEntry_Logger]grpclogrecordpb.G binlogpb.GrpcLogEntry_LOGGER_SERVER: grpclogrecordpb.GrpcLogRecord_LOGGER_SERVER, } -type observabilityBinaryMethodLogger struct { +type binaryMethodLogger struct { rpcID, serviceName, methodName string originalMethodLogger iblog.MethodLogger wrappedMethodLogger iblog.MethodLogger exporter loggingExporter } -func (ml *observabilityBinaryMethodLogger) Log(c iblog.LogEntryConfig) { +func (ml *binaryMethodLogger) Log(c iblog.LogEntryConfig) { // Invoke the original MethodLogger to maintain backward compatibility if ml.originalMethodLogger != nil { ml.originalMethodLogger.Log(c) @@ -161,7 +161,7 @@ func (ml *observabilityBinaryMethodLogger) Log(c iblog.LogEntryConfig) { ml.exporter.EmitGrpcLogRecord(grpcLogRecord) } -type observabilityBinaryLogger struct { +type binaryLogger struct { // originalLogger is needed to ensure binary logging users won't be impacted // by this plugin. Users are allowed to subscribe to a completely different // set of methods. @@ -172,7 +172,34 @@ type observabilityBinaryLogger struct { filters unsafe.Pointer // []*configpb.ObservabilityConfig_LogFilter } +func (l *binaryLogger) loadExporter() loggingExporter { + ptrPtr := atomic.LoadPointer(&l.exporter) + if ptrPtr == nil { + return nil + } + exporterPtr := (*loggingExporter)(ptrPtr) + return *exporterPtr +} + +func (l *binaryLogger) loadFilters() []*configpb.ObservabilityConfig_LogFilter { + ptrPtr := atomic.LoadPointer(&l.filters) + if ptrPtr == nil { + return nil + } + filterPtr := (*[]*configpb.ObservabilityConfig_LogFilter)(ptrPtr) + return *filterPtr +} + func matchLogFilter(serviceMethod string, filters []*configpb.ObservabilityConfig_LogFilter) *configpb.ObservabilityConfig_LogFilter { + // Split input serviceMethod + s, _, err := grpcutil.ParseMethod(serviceMethod) + if err != nil { + // This service method string is provided by upstream code, if + // it's malformed, we are in bigger trouble. + logger.Errorf("Invalid service method: %v", err) + return nil + } + // Try matching the filters one by one, pick the first match. The // correctness of the log filter pattern is ensured by config.go. for _, filter := range filters { @@ -185,13 +212,6 @@ func matchLogFilter(serviceMethod string, filters []*configpb.ObservabilityConfi filterMethod := tokens[1] if filterMethod == "*" { // Handle "p.s/*" case - s, _, err := grpcutil.ParseMethod(serviceMethod) - if err != nil { - // This service method string is provided by upstream code, if - // it's malformed, we are in bigger trouble. - logger.Errorf("Invalid service method: %v", err) - return nil - } if s == filterService { return filter } @@ -205,28 +225,20 @@ func matchLogFilter(serviceMethod string, filters []*configpb.ObservabilityConfi return nil } -func (l *observabilityBinaryLogger) GetMethodLogger(methodName string) iblog.MethodLogger { +func (l *binaryLogger) GetMethodLogger(methodName string) iblog.MethodLogger { var ol, ml iblog.MethodLogger if l.originalLogger != nil { ol = l.originalLogger.GetMethodLogger(methodName) } - ePtr := atomic.LoadPointer(&l.exporter) // If no exporter is specified, there is no point creating a method // logger. We don't have any chance to inject exporter after its // creation. - if ePtr == nil { - return ol - } - exporter := (*loggingExporter)(ePtr) - - filtersPtr := atomic.LoadPointer(&l.filters) - if filtersPtr == nil { - // No filters set + exporter := l.loadExporter() + if exporter == nil { return ol } - filters := (*[]*configpb.ObservabilityConfig_LogFilter)(filtersPtr) // 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 @@ -237,21 +249,21 @@ func (l *observabilityBinaryLogger) GetMethodLogger(methodName string) iblog.Met return ol } - filter := matchLogFilter(methodName, *filters) + filter := matchLogFilter(methodName, l.loadFilters()) if filter == nil { // No matching filter found return ol } ml = iblog.NewMethodLogger(uint64(filter.HeaderBytes), uint64(filter.MessageBytes)) - return &observabilityBinaryMethodLogger{ + return &binaryMethodLogger{ originalMethodLogger: ol, wrappedMethodLogger: ml, rpcID: uuid.NewString(), - exporter: *exporter, + exporter: exporter, } } -func (l *observabilityBinaryLogger) Close() { +func (l *binaryLogger) Close() { if l == nil { return } @@ -266,23 +278,26 @@ func (l *observabilityBinaryLogger) Close() { // start is the core logic for setting up the custom binary logging logger, and // it's also useful for testing. -func (l *observabilityBinaryLogger) start(config *configpb.ObservabilityConfig, exporter loggingExporter) error { +func (l *binaryLogger) start(config *configpb.ObservabilityConfig, exporter loggingExporter) error { filters := config.GetLogFilters() - if len(filters) > 0 { - atomic.StorePointer(&l.filters, unsafe.Pointer(&filters)) - } - if exporter != nil { - atomic.StorePointer(&l.exporter, unsafe.Pointer(&exporter)) + if len(filters) == 0 || exporter == nil { + // Doing nothing is allowed + if exporter != nil { + // The exporter is owned by binaryLogger, so we should close it if + // we are not planning to use it. + exporter.Close() + } + logger.Info("Skipping gRPC Observability logger: no config") + return nil } + atomic.StorePointer(&l.filters, unsafe.Pointer(&filters)) + atomic.StorePointer(&l.exporter, unsafe.Pointer(&exporter)) logger.Info("Start gRPC Observability logger") return nil } -func (l *observabilityBinaryLogger) Start(ctx context.Context, config *configpb.ObservabilityConfig) error { - if config == nil { - return nil - } - if !config.GetEnableCloudLogging() { +func (l *binaryLogger) Start(ctx context.Context, config *configpb.ObservabilityConfig) error { + if config == nil || !config.GetEnableCloudLogging() { return nil } if config.GetDestinationProjectId() == "" { @@ -296,15 +311,15 @@ func (l *observabilityBinaryLogger) Start(ctx context.Context, config *configpb. return nil } -func newObservabilityBinaryLogger(iblogger iblog.Logger) *observabilityBinaryLogger { - return &observabilityBinaryLogger{ +func newBinaryLogger(iblogger iblog.Logger) *binaryLogger { + return &binaryLogger{ originalLogger: iblogger, } } -var defaultLogger *observabilityBinaryLogger +var defaultLogger *binaryLogger func prepareLogging() { - defaultLogger = newObservabilityBinaryLogger(iblog.GetLogger()) + defaultLogger = newBinaryLogger(iblog.GetLogger()) iblog.SetLogger(defaultLogger) } diff --git a/observability/observability.go b/observability/observability.go index aa392268d02..b0269249b38 100644 --- a/observability/observability.go +++ b/observability/observability.go @@ -61,7 +61,9 @@ func Start(ctx context.Context) error { } // Set the project ID if it isn't configured manually. - maybeUpdateProjectIDInObservabilityConfig(ctx, config) + if err := ensureProjectIDInObservabilityConfig(ctx, config); err != nil { + return err + } // Logging is controlled by the config at methods level. return defaultLogger.Start(ctx, config) diff --git a/observability/observability_test.go b/observability/observability_test.go index ac366305806..c8f62d6992c 100644 --- a/observability/observability_test.go +++ b/observability/observability_test.go @@ -194,7 +194,7 @@ func (te *test) clientConn() *grpc.ClientConn { func (te *test) enablePluginWithConfig(config *configpb.ObservabilityConfig) { // Injects the fake exporter for testing purposes - defaultLogger = newObservabilityBinaryLogger(nil) + defaultLogger = newBinaryLogger(nil) iblog.SetLogger(defaultLogger) if err := defaultLogger.start(config, te.fle); err != nil { te.t.Fatalf("Failed to start plugin: %v", err) @@ -204,7 +204,7 @@ func (te *test) enablePluginWithConfig(config *configpb.ObservabilityConfig) { func (te *test) enablePluginWithCaptureAll() { te.enablePluginWithConfig(&configpb.ObservabilityConfig{ EnableCloudLogging: true, - DestinationProjectId: "", + DestinationProjectId: "fake", LogFilters: []*configpb.ObservabilityConfig_LogFilter{ { Pattern: "*", @@ -503,7 +503,8 @@ func (s) TestOverrideConfig(t *testing.T) { // allows message payload logging, and others disabling the message payload // logging. We should observe this behavior latter. te.enablePluginWithConfig(&configpb.ObservabilityConfig{ - EnableCloudLogging: true, + EnableCloudLogging: true, + DestinationProjectId: "fake", LogFilters: []*configpb.ObservabilityConfig_LogFilter{ { Pattern: "wont/match", @@ -569,7 +570,8 @@ func (s) TestNoMatch(t *testing.T) { // allows message payload logging, and others disabling the message payload // logging. We should observe this behavior latter. te.enablePluginWithConfig(&configpb.ObservabilityConfig{ - EnableCloudLogging: true, + EnableCloudLogging: true, + DestinationProjectId: "fake", LogFilters: []*configpb.ObservabilityConfig_LogFilter{ { Pattern: "wont/match", @@ -608,7 +610,8 @@ func (s) TestNoMatch(t *testing.T) { func (s) TestRefuseStartWithInvalidPatterns(t *testing.T) { config := &configpb.ObservabilityConfig{ - EnableCloudLogging: true, + EnableCloudLogging: true, + DestinationProjectId: "fake", LogFilters: []*configpb.ObservabilityConfig_LogFilter{ { Pattern: ":-)", From 74b5a2fe0546f938a76ea441adc3471371497a3e Mon Sep 17 00:00:00 2001 From: Lidi Zheng Date: Fri, 1 Apr 2022 15:43:43 -0700 Subject: [PATCH 14/23] Update the logic of deciding priorities for log_filters --- internal/binarylog/binarylog.go | 77 ++++++++------ internal/binarylog/env_config.go | 6 +- internal/binarylog/env_config_test.go | 46 ++++----- internal/binarylog/method_logger.go | 7 +- internal/binarylog/method_logger_test.go | 50 ++++----- observability/logging.go | 125 +++++++++++++---------- observability/observability_test.go | 11 +- 7 files changed, 175 insertions(+), 147 deletions(-) diff --git a/internal/binarylog/binarylog.go b/internal/binarylog/binarylog.go index c1a7e07e28b..98ab3dc486c 100644 --- a/internal/binarylog/binarylog.go +++ b/internal/binarylog/binarylog.go @@ -75,17 +75,30 @@ func init() { binLogger = NewLoggerFromConfigString(configStr) } -type methodLoggerConfig struct { +// MethodLoggerConfig contains the setting for logging behavior of a method +// logger. Currently, it contains the max length of header and message. +type MethodLoggerConfig struct { // Max length of header and message. - hdr, msg uint64 + Header, Message uint64 +} + +// LoggerConfig contains the config for loggers to create method loggers. +type LoggerConfig struct { + All *MethodLoggerConfig + Services map[string]*MethodLoggerConfig + Methods map[string]*MethodLoggerConfig + + Blacklist map[string]struct{} } type logger struct { - all *methodLoggerConfig - services map[string]*methodLoggerConfig - methods map[string]*methodLoggerConfig + config LoggerConfig +} - blacklist map[string]struct{} +// NewLoggerFromConfig builds a logger with the given LoggerConfig. +func NewLoggerFromConfig(config *LoggerConfig) Logger { + // Copies the LoggerConfig, so it's immutable pass this point. + return &logger{config: *config} } // newEmptyLogger creates an empty logger. The map fields need to be filled in @@ -95,57 +108,57 @@ func newEmptyLogger() *logger { } // Set method logger for "*". -func (l *logger) setDefaultMethodLogger(ml *methodLoggerConfig) error { - if l.all != nil { +func (l *logger) setDefaultMethodLogger(ml *MethodLoggerConfig) error { + if l.config.All != nil { return fmt.Errorf("conflicting global rules found") } - l.all = ml + l.config.All = ml return nil } // Set method logger for "service/*". // // New methodLogger with same service overrides the old one. -func (l *logger) setServiceMethodLogger(service string, ml *methodLoggerConfig) error { - if _, ok := l.services[service]; ok { +func (l *logger) setServiceMethodLogger(service string, ml *MethodLoggerConfig) error { + if _, ok := l.config.Services[service]; ok { return fmt.Errorf("conflicting service rules for service %v found", service) } - if l.services == nil { - l.services = make(map[string]*methodLoggerConfig) + if l.config.Services == nil { + l.config.Services = make(map[string]*MethodLoggerConfig) } - l.services[service] = ml + l.config.Services[service] = ml return nil } // Set method logger for "service/method". // // New methodLogger with same method overrides the old one. -func (l *logger) setMethodMethodLogger(method string, ml *methodLoggerConfig) error { - if _, ok := l.blacklist[method]; ok { +func (l *logger) setMethodMethodLogger(method string, ml *MethodLoggerConfig) error { + if _, ok := l.config.Blacklist[method]; ok { return fmt.Errorf("conflicting blacklist rules for method %v found", method) } - if _, ok := l.methods[method]; ok { + if _, ok := l.config.Methods[method]; ok { return fmt.Errorf("conflicting method rules for method %v found", method) } - if l.methods == nil { - l.methods = make(map[string]*methodLoggerConfig) + if l.config.Methods == nil { + l.config.Methods = make(map[string]*MethodLoggerConfig) } - l.methods[method] = ml + l.config.Methods[method] = ml return nil } // Set blacklist method for "-service/method". func (l *logger) setBlacklist(method string) error { - if _, ok := l.blacklist[method]; ok { + if _, ok := l.config.Blacklist[method]; ok { return fmt.Errorf("conflicting blacklist rules for method %v found", method) } - if _, ok := l.methods[method]; ok { + if _, ok := l.config.Methods[method]; ok { return fmt.Errorf("conflicting method rules for method %v found", method) } - if l.blacklist == nil { - l.blacklist = make(map[string]struct{}) + if l.config.Blacklist == nil { + l.config.Blacklist = make(map[string]struct{}) } - l.blacklist[method] = struct{}{} + l.config.Blacklist[method] = struct{}{} return nil } @@ -161,17 +174,17 @@ func (l *logger) GetMethodLogger(methodName string) MethodLogger { grpclogLogger.Infof("binarylogging: failed to parse %q: %v", methodName, err) return nil } - if ml, ok := l.methods[s+"/"+m]; ok { - return NewMethodLogger(ml.hdr, ml.msg) + if ml, ok := l.config.Methods[s+"/"+m]; ok { + return newMethodLogger(ml.Header, ml.Message) } - if _, ok := l.blacklist[s+"/"+m]; ok { + if _, ok := l.config.Blacklist[s+"/"+m]; ok { return nil } - if ml, ok := l.services[s]; ok { - return NewMethodLogger(ml.hdr, ml.msg) + if ml, ok := l.config.Services[s]; ok { + return newMethodLogger(ml.Header, ml.Message) } - if l.all == nil { + if l.config.All == nil { return nil } - return NewMethodLogger(l.all.hdr, l.all.msg) + return newMethodLogger(l.config.All.Header, l.config.All.Message) } diff --git a/internal/binarylog/env_config.go b/internal/binarylog/env_config.go index d8f4e7602fd..ab589a76bf9 100644 --- a/internal/binarylog/env_config.go +++ b/internal/binarylog/env_config.go @@ -89,7 +89,7 @@ func (l *logger) fillMethodLoggerWithConfigString(config string) error { if err != nil { return fmt.Errorf("invalid config: %q, %v", config, err) } - if err := l.setDefaultMethodLogger(&methodLoggerConfig{hdr: hdr, msg: msg}); err != nil { + if err := l.setDefaultMethodLogger(&MethodLoggerConfig{Header: hdr, Message: msg}); err != nil { return fmt.Errorf("invalid config: %v", err) } return nil @@ -104,11 +104,11 @@ func (l *logger) fillMethodLoggerWithConfigString(config string) error { return fmt.Errorf("invalid header/message length config: %q, %v", suffix, err) } if m == "*" { - if err := l.setServiceMethodLogger(s, &methodLoggerConfig{hdr: hdr, msg: msg}); err != nil { + if err := l.setServiceMethodLogger(s, &MethodLoggerConfig{Header: hdr, Message: msg}); err != nil { return fmt.Errorf("invalid config: %v", err) } } else { - if err := l.setMethodMethodLogger(s+"/"+m, &methodLoggerConfig{hdr: hdr, msg: msg}); err != nil { + if err := l.setMethodMethodLogger(s+"/"+m, &MethodLoggerConfig{Header: hdr, Message: msg}); err != nil { return fmt.Errorf("invalid config: %v", err) } } diff --git a/internal/binarylog/env_config_test.go b/internal/binarylog/env_config_test.go index f67b4fd6032..9f888ad870e 100644 --- a/internal/binarylog/env_config_test.go +++ b/internal/binarylog/env_config_test.go @@ -36,29 +36,29 @@ func (s) TestNewLoggerFromConfigString(t *testing.T) { c := fmt.Sprintf("*{h:1;m:2},%s{h},%s{m},%s{h;m}", s1+"/*", fullM1, fullM2) l := NewLoggerFromConfigString(c).(*logger) - if l.all.hdr != 1 || l.all.msg != 2 { - t.Errorf("l.all = %#v, want headerLen: 1, messageLen: 2", l.all) + if l.config.All.Header != 1 || l.config.All.Message != 2 { + t.Errorf("l.config.All = %#v, want headerLen: 1, messageLen: 2", l.config.All) } - if ml, ok := l.services[s1]; ok { - if ml.hdr != maxUInt || ml.msg != 0 { - t.Errorf("want maxUInt header, 0 message, got header: %v, message: %v", ml.hdr, ml.msg) + if ml, ok := l.config.Services[s1]; ok { + if ml.Header != maxUInt || ml.Message != 0 { + t.Errorf("want maxUInt header, 0 message, got header: %v, message: %v", ml.Header, ml.Message) } } else { t.Errorf("service/* is not set") } - if ml, ok := l.methods[fullM1]; ok { - if ml.hdr != 0 || ml.msg != maxUInt { - t.Errorf("want 0 header, maxUInt message, got header: %v, message: %v", ml.hdr, ml.msg) + if ml, ok := l.config.Methods[fullM1]; ok { + if ml.Header != 0 || ml.Message != maxUInt { + t.Errorf("want 0 header, maxUInt message, got header: %v, message: %v", ml.Header, ml.Message) } } else { t.Errorf("service/method{h} is not set") } - if ml, ok := l.methods[fullM2]; ok { - if ml.hdr != maxUInt || ml.msg != maxUInt { - t.Errorf("want maxUInt header, maxUInt message, got header: %v, message: %v", ml.hdr, ml.msg) + if ml, ok := l.config.Methods[fullM2]; ok { + if ml.Header != maxUInt || ml.Message != maxUInt { + t.Errorf("want maxUInt header, maxUInt message, got header: %v, message: %v", ml.Header, ml.Message) } } else { t.Errorf("service/method{h;m} is not set") @@ -249,7 +249,7 @@ func (s) TestFillMethodLoggerWithConfigStringBlacklist(t *testing.T) { t.Errorf("returned err %v, want nil", err) continue } - _, ok := l.blacklist[tc] + _, ok := l.config.Blacklist[tc] if !ok { t.Errorf("blacklist[%q] is not set", tc) } @@ -306,15 +306,15 @@ func (s) TestFillMethodLoggerWithConfigStringGlobal(t *testing.T) { t.Errorf("returned err %v, want nil", err) continue } - if l.all == nil { - t.Errorf("l.all is not set") + if l.config.All == nil { + t.Errorf("l.config.All is not set") continue } - if hdr := l.all.hdr; hdr != tc.hdr { + if hdr := l.config.All.Header; hdr != tc.hdr { t.Errorf("header length = %v, want %v", hdr, tc.hdr) } - if msg := l.all.msg; msg != tc.msg { + if msg := l.config.All.Message; msg != tc.msg { t.Errorf("message length = %v, want %v", msg, tc.msg) } } @@ -371,16 +371,16 @@ func (s) TestFillMethodLoggerWithConfigStringPerService(t *testing.T) { t.Errorf("returned err %v, want nil", err) continue } - ml, ok := l.services[serviceName] + ml, ok := l.config.Services[serviceName] if !ok { t.Errorf("l.service[%q] is not set", serviceName) continue } - if hdr := ml.hdr; hdr != tc.hdr { + if hdr := ml.Header; hdr != tc.hdr { t.Errorf("header length = %v, want %v", hdr, tc.hdr) } - if msg := ml.msg; msg != tc.msg { + if msg := ml.Message; msg != tc.msg { t.Errorf("message length = %v, want %v", msg, tc.msg) } } @@ -441,16 +441,16 @@ func (s) TestFillMethodLoggerWithConfigStringPerMethod(t *testing.T) { t.Errorf("returned err %v, want nil", err) continue } - ml, ok := l.methods[fullMethodName] + ml, ok := l.config.Methods[fullMethodName] if !ok { - t.Errorf("l.methods[%q] is not set", fullMethodName) + t.Errorf("l.config.Methods[%q] is not set", fullMethodName) continue } - if hdr := ml.hdr; hdr != tc.hdr { + if hdr := ml.Header; hdr != tc.hdr { t.Errorf("header length = %v, want %v", hdr, tc.hdr) } - if msg := ml.msg; msg != tc.msg { + if msg := ml.Message; msg != tc.msg { t.Errorf("message length = %v, want %v", msg, tc.msg) } } diff --git a/internal/binarylog/method_logger.go b/internal/binarylog/method_logger.go index f5cf3db603d..24df0a1a0c4 100644 --- a/internal/binarylog/method_logger.go +++ b/internal/binarylog/method_logger.go @@ -61,11 +61,10 @@ type methodLogger struct { sink Sink // TODO(blog): make this plugable. } -// NewMethodLogger creates methodLogger based on input config -func NewMethodLogger(headerMaxLen, messageMaxLen uint64) MethodLogger { +func newMethodLogger(h, m uint64) *methodLogger { return &methodLogger{ - headerMaxLen: headerMaxLen, - messageMaxLen: messageMaxLen, + headerMaxLen: h, + messageMaxLen: m, callID: idGen.next(), idWithinCallGen: &callIDGenerator{}, diff --git a/internal/binarylog/method_logger_test.go b/internal/binarylog/method_logger_test.go index ff2009a20c3..31cc076343f 100644 --- a/internal/binarylog/method_logger_test.go +++ b/internal/binarylog/method_logger_test.go @@ -34,7 +34,7 @@ import ( func (s) TestLog(t *testing.T) { idGen.reset() - ml := NewMethodLogger(10, 10).(*methodLogger) + ml := newMethodLogger(10, 10) // Set sink to testing buffer. buf := bytes.NewBuffer(nil) ml.sink = newWriterSink(buf) @@ -350,11 +350,11 @@ func (s) TestLog(t *testing.T) { func (s) TestTruncateMetadataNotTruncated(t *testing.T) { testCases := []struct { - ml MethodLogger + ml *methodLogger mpPb *pb.Metadata }{ { - ml: NewMethodLogger(maxUInt, maxUInt), + ml: newMethodLogger(maxUInt, maxUInt), mpPb: &pb.Metadata{ Entry: []*pb.MetadataEntry{ {Key: "", Value: []byte{1}}, @@ -362,7 +362,7 @@ func (s) TestTruncateMetadataNotTruncated(t *testing.T) { }, }, { - ml: NewMethodLogger(2, maxUInt), + ml: newMethodLogger(2, maxUInt), mpPb: &pb.Metadata{ Entry: []*pb.MetadataEntry{ {Key: "", Value: []byte{1}}, @@ -370,7 +370,7 @@ func (s) TestTruncateMetadataNotTruncated(t *testing.T) { }, }, { - ml: NewMethodLogger(1, maxUInt), + ml: newMethodLogger(1, maxUInt), mpPb: &pb.Metadata{ Entry: []*pb.MetadataEntry{ {Key: "", Value: nil}, @@ -378,7 +378,7 @@ func (s) TestTruncateMetadataNotTruncated(t *testing.T) { }, }, { - ml: NewMethodLogger(2, maxUInt), + ml: newMethodLogger(2, maxUInt), mpPb: &pb.Metadata{ Entry: []*pb.MetadataEntry{ {Key: "", Value: []byte{1, 1}}, @@ -386,7 +386,7 @@ func (s) TestTruncateMetadataNotTruncated(t *testing.T) { }, }, { - ml: NewMethodLogger(2, maxUInt), + ml: newMethodLogger(2, maxUInt), mpPb: &pb.Metadata{ Entry: []*pb.MetadataEntry{ {Key: "", Value: []byte{1}}, @@ -397,7 +397,7 @@ func (s) TestTruncateMetadataNotTruncated(t *testing.T) { // "grpc-trace-bin" is kept in log but not counted towards the size // limit. { - ml: NewMethodLogger(1, maxUInt), + ml: newMethodLogger(1, maxUInt), mpPb: &pb.Metadata{ Entry: []*pb.MetadataEntry{ {Key: "", Value: []byte{1}}, @@ -408,7 +408,7 @@ func (s) TestTruncateMetadataNotTruncated(t *testing.T) { } for i, tc := range testCases { - truncated := tc.ml.(*methodLogger).truncateMetadata(tc.mpPb) + truncated := tc.ml.truncateMetadata(tc.mpPb) if truncated { t.Errorf("test case %v, returned truncated, want not truncated", i) } @@ -417,13 +417,13 @@ func (s) TestTruncateMetadataNotTruncated(t *testing.T) { func (s) TestTruncateMetadataTruncated(t *testing.T) { testCases := []struct { - ml MethodLogger + ml *methodLogger mpPb *pb.Metadata entryLen int }{ { - ml: NewMethodLogger(2, maxUInt), + ml: newMethodLogger(2, maxUInt), mpPb: &pb.Metadata{ Entry: []*pb.MetadataEntry{ {Key: "", Value: []byte{1, 1, 1}}, @@ -432,7 +432,7 @@ func (s) TestTruncateMetadataTruncated(t *testing.T) { entryLen: 0, }, { - ml: NewMethodLogger(2, maxUInt), + ml: newMethodLogger(2, maxUInt), mpPb: &pb.Metadata{ Entry: []*pb.MetadataEntry{ {Key: "", Value: []byte{1}}, @@ -443,7 +443,7 @@ func (s) TestTruncateMetadataTruncated(t *testing.T) { entryLen: 2, }, { - ml: NewMethodLogger(2, maxUInt), + ml: newMethodLogger(2, maxUInt), mpPb: &pb.Metadata{ Entry: []*pb.MetadataEntry{ {Key: "", Value: []byte{1, 1}}, @@ -453,7 +453,7 @@ func (s) TestTruncateMetadataTruncated(t *testing.T) { entryLen: 1, }, { - ml: NewMethodLogger(2, maxUInt), + ml: newMethodLogger(2, maxUInt), mpPb: &pb.Metadata{ Entry: []*pb.MetadataEntry{ {Key: "", Value: []byte{1}}, @@ -465,7 +465,7 @@ func (s) TestTruncateMetadataTruncated(t *testing.T) { } for i, tc := range testCases { - truncated := tc.ml.(*methodLogger).truncateMetadata(tc.mpPb) + truncated := tc.ml.truncateMetadata(tc.mpPb) if !truncated { t.Errorf("test case %v, returned not truncated, want truncated", i) continue @@ -478,23 +478,23 @@ func (s) TestTruncateMetadataTruncated(t *testing.T) { func (s) TestTruncateMessageNotTruncated(t *testing.T) { testCases := []struct { - ml MethodLogger + ml *methodLogger msgPb *pb.Message }{ { - ml: NewMethodLogger(maxUInt, maxUInt), + ml: newMethodLogger(maxUInt, maxUInt), msgPb: &pb.Message{ Data: []byte{1}, }, }, { - ml: NewMethodLogger(maxUInt, 3), + ml: newMethodLogger(maxUInt, 3), msgPb: &pb.Message{ Data: []byte{1, 1}, }, }, { - ml: NewMethodLogger(maxUInt, 2), + ml: newMethodLogger(maxUInt, 2), msgPb: &pb.Message{ Data: []byte{1, 1}, }, @@ -502,7 +502,7 @@ func (s) TestTruncateMessageNotTruncated(t *testing.T) { } for i, tc := range testCases { - truncated := tc.ml.(*methodLogger).truncateMessage(tc.msgPb) + truncated := tc.ml.truncateMessage(tc.msgPb) if truncated { t.Errorf("test case %v, returned truncated, want not truncated", i) } @@ -511,13 +511,13 @@ func (s) TestTruncateMessageNotTruncated(t *testing.T) { func (s) TestTruncateMessageTruncated(t *testing.T) { testCases := []struct { - ml MethodLogger + ml *methodLogger msgPb *pb.Message oldLength uint32 }{ { - ml: NewMethodLogger(maxUInt, 2), + ml: newMethodLogger(maxUInt, 2), msgPb: &pb.Message{ Length: 3, Data: []byte{1, 1, 1}, @@ -527,13 +527,13 @@ func (s) TestTruncateMessageTruncated(t *testing.T) { } for i, tc := range testCases { - truncated := tc.ml.(*methodLogger).truncateMessage(tc.msgPb) + truncated := tc.ml.truncateMessage(tc.msgPb) if !truncated { t.Errorf("test case %v, returned not truncated, want truncated", i) continue } - if len(tc.msgPb.Data) != int(tc.ml.(*methodLogger).messageMaxLen) { - t.Errorf("test case %v, message length: %v, want: %v", i, len(tc.msgPb.Data), tc.ml.(*methodLogger).messageMaxLen) + if len(tc.msgPb.Data) != int(tc.ml.messageMaxLen) { + t.Errorf("test case %v, message length: %v, want: %v", i, len(tc.msgPb.Data), tc.ml.messageMaxLen) } if tc.msgPb.Length != tc.oldLength { t.Errorf("test case %v, message.Length field: %v, want: %v", i, tc.msgPb.Length, tc.oldLength) diff --git a/observability/logging.go b/observability/logging.go index fd99016c2cb..e9de47b1d01 100644 --- a/observability/logging.go +++ b/observability/logging.go @@ -28,7 +28,6 @@ import ( "github.com/google/uuid" binlogpb "google.golang.org/grpc/binarylog/grpc_binarylog_v1" iblog "google.golang.org/grpc/internal/binarylog" - "google.golang.org/grpc/internal/grpcutil" configpb "google.golang.org/grpc/observability/internal/config" grpclogrecordpb "google.golang.org/grpc/observability/internal/logging" ) @@ -166,10 +165,12 @@ type binaryLogger struct { // by this plugin. Users are allowed to subscribe to a completely different // set of methods. originalLogger iblog.Logger - // exporter is a loggingExporter and the handle for uploading collected data to backends + // exporter is a loggingExporter and the handle for uploading collected data + // to backends. exporter unsafe.Pointer // loggingExporter - // filters is []*configpb.ObservabilityConfig_LogFilter used to set config on methods - filters unsafe.Pointer // []*configpb.ObservabilityConfig_LogFilter + // logger is a iblog.Logger wrapped for reusing the pattern matching logic + // and the method logger creating logic. + logger unsafe.Pointer // iblog.Logger } func (l *binaryLogger) loadExporter() loggingExporter { @@ -181,57 +182,31 @@ func (l *binaryLogger) loadExporter() loggingExporter { return *exporterPtr } -func (l *binaryLogger) loadFilters() []*configpb.ObservabilityConfig_LogFilter { - ptrPtr := atomic.LoadPointer(&l.filters) +func (l *binaryLogger) loadLogger() iblog.Logger { + ptrPtr := atomic.LoadPointer(&l.logger) if ptrPtr == nil { return nil } - filterPtr := (*[]*configpb.ObservabilityConfig_LogFilter)(ptrPtr) - return *filterPtr -} - -func matchLogFilter(serviceMethod string, filters []*configpb.ObservabilityConfig_LogFilter) *configpb.ObservabilityConfig_LogFilter { - // Split input serviceMethod - s, _, err := grpcutil.ParseMethod(serviceMethod) - if err != nil { - // This service method string is provided by upstream code, if - // it's malformed, we are in bigger trouble. - logger.Errorf("Invalid service method: %v", err) - return nil - } - - // Try matching the filters one by one, pick the first match. The - // correctness of the log filter pattern is ensured by config.go. - for _, filter := range filters { - if filter.Pattern == "*" { - // Match a "*" - return filter - } - tokens := strings.SplitN(filter.Pattern, "/", 2) - filterService := tokens[0] - filterMethod := tokens[1] - if filterMethod == "*" { - // Handle "p.s/*" case - if s == filterService { - return filter - } - return nil - } - if serviceMethod == filter.Pattern { - // Exact match of "p.s/m" - return filter - } - } - return nil + loggerPtr := (*iblog.Logger)(ptrPtr) + return *loggerPtr } func (l *binaryLogger) GetMethodLogger(methodName string) iblog.MethodLogger { - var ol, ml iblog.MethodLogger + var ol iblog.MethodLogger if l.originalLogger != nil { 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" { + return ol + } + // If no exporter is specified, there is no point creating a method // logger. We don't have any chance to inject exporter after its // creation. @@ -240,21 +215,18 @@ func (l *binaryLogger) GetMethodLogger(methodName string) iblog.MethodLogger { return ol } - // 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" { + // If no logger is specified, e.g., during init period, do nothing. + binLogger := l.loadLogger() + if binLogger == nil { return ol } - filter := matchLogFilter(methodName, l.loadFilters()) - if filter == nil { - // No matching filter found + // If this method is not picked by LoggerConfig, do nothing. + ml := binLogger.GetMethodLogger(methodName) + if ml == nil { return ol } - ml = iblog.NewMethodLogger(uint64(filter.HeaderBytes), uint64(filter.MessageBytes)) + return &binaryMethodLogger{ originalMethodLogger: ol, wrappedMethodLogger: ml, @@ -276,6 +248,45 @@ func (l *binaryLogger) Close() { } } +func createBinaryLoggerConfig(filters []*configpb.ObservabilityConfig_LogFilter) *iblog.LoggerConfig { + config := &iblog.LoggerConfig{ + Services: make(map[string]*iblog.MethodLoggerConfig), + Methods: make(map[string]*iblog.MethodLoggerConfig), + } + // Try matching the filters one by one, pick the first match. The + // correctness of the log filter pattern is ensured by config.go. + for _, filter := range filters { + if filter.Pattern == "*" { + // Match a "*" + if config.All != nil { + logger.Warningf("Ignored log_filter config: %+v", filter) + continue + } + config.All = &iblog.MethodLoggerConfig{Header: uint64(filter.HeaderBytes), Message: uint64(filter.MessageBytes)} + continue + } + tokens := strings.SplitN(filter.Pattern, "/", 2) + filterService := tokens[0] + filterMethod := tokens[1] + if filterMethod == "*" { + // Handle "p.s/*" case + if config.Services[filterService] != nil { + logger.Warningf("Ignored log_filter config: %+v", filter) + continue + } + config.Services[filterService] = &iblog.MethodLoggerConfig{Header: uint64(filter.HeaderBytes), Message: uint64(filter.MessageBytes)} + continue + } + // Exact match like "p.s/m" + if config.Methods[filter.Pattern] != nil { + logger.Warningf("Ignored log_filter config: %+v", filter) + continue + } + config.Methods[filter.Pattern] = &iblog.MethodLoggerConfig{Header: uint64(filter.HeaderBytes), Message: uint64(filter.MessageBytes)} + } + return config +} + // start is the core logic for setting up the custom binary logging logger, and // it's also useful for testing. func (l *binaryLogger) start(config *configpb.ObservabilityConfig, exporter loggingExporter) error { @@ -290,7 +301,11 @@ func (l *binaryLogger) start(config *configpb.ObservabilityConfig, exporter logg logger.Info("Skipping gRPC Observability logger: no config") return nil } - atomic.StorePointer(&l.filters, unsafe.Pointer(&filters)) + + binLogger := iblog.NewLoggerFromConfig(createBinaryLoggerConfig(filters)) + if binLogger != nil { + atomic.StorePointer(&l.logger, unsafe.Pointer(&binLogger)) + } atomic.StorePointer(&l.exporter, unsafe.Pointer(&exporter)) logger.Info("Start gRPC Observability logger") return nil diff --git a/observability/observability_test.go b/observability/observability_test.go index c8f62d6992c..1785dcd2fa5 100644 --- a/observability/observability_test.go +++ b/observability/observability_test.go @@ -499,9 +499,10 @@ func (s) TestEmptyConfig(t *testing.T) { func (s) TestOverrideConfig(t *testing.T) { te := newTest(t) defer te.tearDown() - // Setting 3 filters, expected to use the second filter. The second filter - // allows message payload logging, and others disabling the message payload - // logging. We should observe this behavior latter. + // Setting 3 filters, expected to use the third filter, because it's the + // most specific one. The third filter allows message payload logging, and + // others disabling the message payload logging. We should observe this + // behavior latter. te.enablePluginWithConfig(&configpb.ObservabilityConfig{ EnableCloudLogging: true, DestinationProjectId: "fake", @@ -512,11 +513,11 @@ func (s) TestOverrideConfig(t *testing.T) { }, { Pattern: "*", - MessageBytes: 4096, + MessageBytes: 0, }, { Pattern: "grpc.testing.TestService/*", - MessageBytes: 0, + MessageBytes: 4096, }, }, }) From 2efb72b06115d81e1680e5bca832df132c2df7cb Mon Sep 17 00:00:00 2001 From: Lidi Zheng Date: Fri, 1 Apr 2022 17:24:02 -0700 Subject: [PATCH 15/23] Produce more granular warning for method logger config --- observability/go.mod | 1 - observability/go.sum | 4 ++-- observability/logging.go | 19 +++++++++++++------ 3 files changed, 15 insertions(+), 9 deletions(-) diff --git a/observability/go.mod b/observability/go.mod index 1e53dc8dd93..d2233a27dbd 100644 --- a/observability/go.mod +++ b/observability/go.mod @@ -5,7 +5,6 @@ go 1.14 require ( cloud.google.com/go/logging v1.4.2 github.com/golang/protobuf v1.5.2 - github.com/google/go-cmp v0.5.6 // indirect github.com/google/uuid v1.3.0 golang.org/x/oauth2 v0.0.0-20211104180415-d3ed0bb246c8 google.golang.org/grpc v1.43.0 diff --git a/observability/go.sum b/observability/go.sum index 2343a4361d5..0f46213edea 100644 --- a/observability/go.sum +++ b/observability/go.sum @@ -48,11 +48,11 @@ github.com/chzyer/logex v1.1.10/go.mod h1:+Ywpsq7O8HXn0nuIou7OrIPyXbp3wmkHB+jjWR github.com/chzyer/readline v0.0.0-20180603132655-2972be24d48e/go.mod h1:nSuG5e5PlCu98SY8svDHJxuZscDgtXS6KTTbou5AhLI= github.com/chzyer/test v0.0.0-20180213035817-a1ea475d72b1/go.mod h1:Q3SI9o4m/ZMnBNeIyt5eFwwo7qiLfzFZmjNmxjkiQlU= github.com/cncf/udpa/go v0.0.0-20210930031921-04548b0d99d4/go.mod h1:6pvJx4me5XPnfI9Z40ddWsdw2W/uZgQLFXToKeRcDiI= -github.com/cncf/xds/go v0.0.0-20210805033703-aa0b78936158/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= github.com/cncf/xds/go v0.0.0-20210922020428-25de7278fc84/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= +github.com/cncf/xds/go v0.0.0-20211001041855-01bcc9b48dfe/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= github.com/cncf/xds/go v0.0.0-20211011173535-cb28da3451f1/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/envoyproxy/go-control-plane v0.9.10-0.20210907150352-cf90f659a021/go.mod h1:AFq3mo9L8Lqqiid3OhADV3RfLJnjiw63cSpi+fDTRC0= +github.com/envoyproxy/go-control-plane v0.10.2-0.20220325020618-49ff273808a1/go.mod h1:KJwIaB5Mv44NWtYuAOFCVOjcI94vtpEz2JU/D2v6IjE= github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04= github.com/go-gl/glfw v0.0.0-20190409004039-e6da0acd62b1/go.mod h1:vR7hzQXu2zJy9AVAgeJqvqgH9Q5CA+iKCZ2gyEVpxRU= diff --git a/observability/logging.go b/observability/logging.go index e9de47b1d01..7840acbc954 100644 --- a/observability/logging.go +++ b/observability/logging.go @@ -248,6 +248,16 @@ func (l *binaryLogger) Close() { } } +func validateExistingMethodLoggerConfig(existing *iblog.MethodLoggerConfig, filter *configpb.ObservabilityConfig_LogFilter) bool { + // In future, we could add more validations. Currently, we only check if the + // new filter configs are different than the existing one, if so, we log a + // warning. + if existing != nil && (existing.Header != uint64(filter.HeaderBytes) || existing.Message != uint64(filter.MessageBytes)) { + logger.Warningf("Ignored log_filter config: %+v", filter) + } + return existing == nil +} + func createBinaryLoggerConfig(filters []*configpb.ObservabilityConfig_LogFilter) *iblog.LoggerConfig { config := &iblog.LoggerConfig{ Services: make(map[string]*iblog.MethodLoggerConfig), @@ -258,8 +268,7 @@ func createBinaryLoggerConfig(filters []*configpb.ObservabilityConfig_LogFilter) for _, filter := range filters { if filter.Pattern == "*" { // Match a "*" - if config.All != nil { - logger.Warningf("Ignored log_filter config: %+v", filter) + if !validateExistingMethodLoggerConfig(config.All, filter) { continue } config.All = &iblog.MethodLoggerConfig{Header: uint64(filter.HeaderBytes), Message: uint64(filter.MessageBytes)} @@ -270,16 +279,14 @@ func createBinaryLoggerConfig(filters []*configpb.ObservabilityConfig_LogFilter) filterMethod := tokens[1] if filterMethod == "*" { // Handle "p.s/*" case - if config.Services[filterService] != nil { - logger.Warningf("Ignored log_filter config: %+v", filter) + if !validateExistingMethodLoggerConfig(config.Services[filterService], filter) { continue } config.Services[filterService] = &iblog.MethodLoggerConfig{Header: uint64(filter.HeaderBytes), Message: uint64(filter.MessageBytes)} continue } // Exact match like "p.s/m" - if config.Methods[filter.Pattern] != nil { - logger.Warningf("Ignored log_filter config: %+v", filter) + if !validateExistingMethodLoggerConfig(config.Methods[filter.Pattern], filter) { continue } config.Methods[filter.Pattern] = &iblog.MethodLoggerConfig{Header: uint64(filter.HeaderBytes), Message: uint64(filter.MessageBytes)} From 8df1c14240b465ef59441b780a2347bb5415ba4e Mon Sep 17 00:00:00 2001 From: Lidi Zheng Date: Mon, 4 Apr 2022 15:27:41 -0700 Subject: [PATCH 16/23] Address reviewer's comments --- internal/binarylog/binarylog.go | 5 ++--- observability/exporting.go | 8 ++++++++ observability/logging.go | 12 ++++++------ 3 files changed, 16 insertions(+), 9 deletions(-) diff --git a/internal/binarylog/binarylog.go b/internal/binarylog/binarylog.go index 98ab3dc486c..0a25ce43f3f 100644 --- a/internal/binarylog/binarylog.go +++ b/internal/binarylog/binarylog.go @@ -96,9 +96,8 @@ type logger struct { } // NewLoggerFromConfig builds a logger with the given LoggerConfig. -func NewLoggerFromConfig(config *LoggerConfig) Logger { - // Copies the LoggerConfig, so it's immutable pass this point. - return &logger{config: *config} +func NewLoggerFromConfig(config LoggerConfig) Logger { + return &logger{config: config} } // newEmptyLogger creates an empty logger. The map fields need to be filled in diff --git a/observability/exporting.go b/observability/exporting.go index 07f186c3c3e..9ebc88f2241 100644 --- a/observability/exporting.go +++ b/observability/exporting.go @@ -107,6 +107,14 @@ func (cle *cloudLoggingExporter) EmitGrpcLogRecord(l *grpclogrecordpb.GrpcLogRec func (cle *cloudLoggingExporter) Close() error { if cle.logger != nil { if err := cle.logger.Flush(); err != nil { + // Try to close the client regardless the Flush is successful or not. + if cle.client != nil { + if err := cle.client.Close(); err != nil { + logger.Infof("Close CloudLogging client failed: %v", err) + } else { + cle.client = nil + } + } return err } cle.logger = nil diff --git a/observability/logging.go b/observability/logging.go index 7840acbc954..fc9366440e3 100644 --- a/observability/logging.go +++ b/observability/logging.go @@ -65,7 +65,7 @@ var loggerTypeToEventLogger = map[binlogpb.GrpcLogEntry_Logger]grpclogrecordpb.G type binaryMethodLogger struct { rpcID, serviceName, methodName string originalMethodLogger iblog.MethodLogger - wrappedMethodLogger iblog.MethodLogger + childMethodLogger iblog.MethodLogger exporter loggingExporter } @@ -76,12 +76,12 @@ func (ml *binaryMethodLogger) Log(c iblog.LogEntryConfig) { } // Fetch the compiled binary logging log entry - if ml.wrappedMethodLogger == nil { + if ml.childMethodLogger == nil { logger.Info("No wrapped method logger found") return } var binlogEntry *binlogpb.GrpcLogEntry - o, ok := ml.wrappedMethodLogger.(interface { + o, ok := ml.childMethodLogger.(interface { Build(iblog.LogEntryConfig) *binlogpb.GrpcLogEntry }) if !ok { @@ -229,7 +229,7 @@ func (l *binaryLogger) GetMethodLogger(methodName string) iblog.MethodLogger { return &binaryMethodLogger{ originalMethodLogger: ol, - wrappedMethodLogger: ml, + childMethodLogger: ml, rpcID: uuid.NewString(), exporter: exporter, } @@ -258,8 +258,8 @@ func validateExistingMethodLoggerConfig(existing *iblog.MethodLoggerConfig, filt return existing == nil } -func createBinaryLoggerConfig(filters []*configpb.ObservabilityConfig_LogFilter) *iblog.LoggerConfig { - config := &iblog.LoggerConfig{ +func createBinaryLoggerConfig(filters []*configpb.ObservabilityConfig_LogFilter) iblog.LoggerConfig { + config := iblog.LoggerConfig{ Services: make(map[string]*iblog.MethodLoggerConfig), Methods: make(map[string]*iblog.MethodLoggerConfig), } From 8ab5e4439d291c2763ace497c3ab1756d520aba4 Mon Sep 17 00:00:00 2001 From: Lidi Zheng Date: Mon, 4 Apr 2022 16:11:21 -0700 Subject: [PATCH 17/23] Try to combine 2 errors if needed --- observability/exporting.go | 30 ++++++++++++++---------------- 1 file changed, 14 insertions(+), 16 deletions(-) diff --git a/observability/exporting.go b/observability/exporting.go index 9ebc88f2241..898f35963ee 100644 --- a/observability/exporting.go +++ b/observability/exporting.go @@ -105,26 +105,24 @@ func (cle *cloudLoggingExporter) EmitGrpcLogRecord(l *grpclogrecordpb.GrpcLogRec } func (cle *cloudLoggingExporter) Close() error { + var errFlush, errClose error if cle.logger != nil { - if err := cle.logger.Flush(); err != nil { - // Try to close the client regardless the Flush is successful or not. - if cle.client != nil { - if err := cle.client.Close(); err != nil { - logger.Infof("Close CloudLogging client failed: %v", err) - } else { - cle.client = nil - } - } - return err - } - cle.logger = nil + errFlush = cle.logger.Flush() } if cle.client != nil { - if err := cle.client.Close(); err != nil { - return err - } - cle.client = nil + errClose = cle.client.Close() } + if errFlush != nil && errClose != nil { + return fmt.Errorf("failed to close exporter. Flush failed: %v; Close failed: %v", errFlush, errClose) + } + if errFlush != nil { + return errFlush + } + if errClose != nil { + return errClose + } + cle.logger = nil + cle.client = nil logger.Infof("Closed CloudLogging exporter") return nil } From a7ea8138f3a43928f09a91dd2b8294eca4c84ce3 Mon Sep 17 00:00:00 2001 From: Lidi Zheng Date: Tue, 5 Apr 2022 10:07:35 -0700 Subject: [PATCH 18/23] Move observability to gcp/observability --- {observability => gcp/observability}/config.go | 0 {observability => gcp/observability}/exporting.go | 0 {observability => gcp/observability}/go.mod | 0 {observability => gcp/observability}/go.sum | 0 {observability => gcp/observability}/internal/config/config.pb.go | 0 {observability => gcp/observability}/internal/config/config.proto | 0 .../observability}/internal/logging/logging.pb.go | 0 .../observability}/internal/logging/logging.proto | 0 {observability => gcp/observability}/logging.go | 0 {observability => gcp/observability}/observability.go | 0 {observability => gcp/observability}/observability_test.go | 0 {observability => gcp/observability}/tags.go | 0 {observability => gcp/observability}/tags_test.go | 0 13 files changed, 0 insertions(+), 0 deletions(-) rename {observability => gcp/observability}/config.go (100%) rename {observability => gcp/observability}/exporting.go (100%) rename {observability => gcp/observability}/go.mod (100%) rename {observability => gcp/observability}/go.sum (100%) rename {observability => gcp/observability}/internal/config/config.pb.go (100%) rename {observability => gcp/observability}/internal/config/config.proto (100%) rename {observability => gcp/observability}/internal/logging/logging.pb.go (100%) rename {observability => gcp/observability}/internal/logging/logging.proto (100%) rename {observability => gcp/observability}/logging.go (100%) rename {observability => gcp/observability}/observability.go (100%) rename {observability => gcp/observability}/observability_test.go (100%) rename {observability => gcp/observability}/tags.go (100%) rename {observability => gcp/observability}/tags_test.go (100%) diff --git a/observability/config.go b/gcp/observability/config.go similarity index 100% rename from observability/config.go rename to gcp/observability/config.go diff --git a/observability/exporting.go b/gcp/observability/exporting.go similarity index 100% rename from observability/exporting.go rename to gcp/observability/exporting.go diff --git a/observability/go.mod b/gcp/observability/go.mod similarity index 100% rename from observability/go.mod rename to gcp/observability/go.mod diff --git a/observability/go.sum b/gcp/observability/go.sum similarity index 100% rename from observability/go.sum rename to gcp/observability/go.sum diff --git a/observability/internal/config/config.pb.go b/gcp/observability/internal/config/config.pb.go similarity index 100% rename from observability/internal/config/config.pb.go rename to gcp/observability/internal/config/config.pb.go diff --git a/observability/internal/config/config.proto b/gcp/observability/internal/config/config.proto similarity index 100% rename from observability/internal/config/config.proto rename to gcp/observability/internal/config/config.proto diff --git a/observability/internal/logging/logging.pb.go b/gcp/observability/internal/logging/logging.pb.go similarity index 100% rename from observability/internal/logging/logging.pb.go rename to gcp/observability/internal/logging/logging.pb.go diff --git a/observability/internal/logging/logging.proto b/gcp/observability/internal/logging/logging.proto similarity index 100% rename from observability/internal/logging/logging.proto rename to gcp/observability/internal/logging/logging.proto diff --git a/observability/logging.go b/gcp/observability/logging.go similarity index 100% rename from observability/logging.go rename to gcp/observability/logging.go diff --git a/observability/observability.go b/gcp/observability/observability.go similarity index 100% rename from observability/observability.go rename to gcp/observability/observability.go diff --git a/observability/observability_test.go b/gcp/observability/observability_test.go similarity index 100% rename from observability/observability_test.go rename to gcp/observability/observability_test.go diff --git a/observability/tags.go b/gcp/observability/tags.go similarity index 100% rename from observability/tags.go rename to gcp/observability/tags.go diff --git a/observability/tags_test.go b/gcp/observability/tags_test.go similarity index 100% rename from observability/tags_test.go rename to gcp/observability/tags_test.go From c9205b9f02b4dc7595f67edbe30a9cfacecaf0b0 Mon Sep 17 00:00:00 2001 From: Lidi Zheng Date: Tue, 5 Apr 2022 10:15:19 -0700 Subject: [PATCH 19/23] Update the go_package for proto files --- gcp/observability/internal/config/config.proto | 2 +- gcp/observability/internal/logging/logging.proto | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/gcp/observability/internal/config/config.proto b/gcp/observability/internal/config/config.proto index 883d1984e18..116300dcd25 100644 --- a/gcp/observability/internal/config/config.proto +++ b/gcp/observability/internal/config/config.proto @@ -27,7 +27,7 @@ package grpc.observability.config.v1alpha; option java_package = "io.grpc.observability.config"; option java_multiple_files = true; option java_outer_classname = "ObservabilityConfigProto"; -option go_package = "google.golang.org/grpc/observability/internal/config"; +option go_package = "google.golang.org/grpc/gcp/observability/internal/config"; // Configuration for observability behaviors. By default, no configuration is // required for tracing/metrics/logging to function. This config captures the diff --git a/gcp/observability/internal/logging/logging.proto b/gcp/observability/internal/logging/logging.proto index 5c6f645be3d..206d953a9ca 100644 --- a/gcp/observability/internal/logging/logging.proto +++ b/gcp/observability/internal/logging/logging.proto @@ -22,7 +22,7 @@ import "google/protobuf/timestamp.proto"; option java_package = "io.grpc.observability.logging"; option java_multiple_files = true; option java_outer_classname = "ObservabilityLoggingProto"; -option go_package = "google.golang.org/grpc/observability/internal/logging"; +option go_package = "google.golang.org/grpc/gcp/observability/internal/logging"; message GrpcLogRecord { // List of event types From 7d58525d719719845bc6cf81c384bdabf00ba30d Mon Sep 17 00:00:00 2001 From: Lidi Zheng Date: Tue, 5 Apr 2022 10:16:57 -0700 Subject: [PATCH 20/23] Update go.mod for path change --- gcp/observability/go.mod | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcp/observability/go.mod b/gcp/observability/go.mod index d2233a27dbd..d622a879e36 100644 --- a/gcp/observability/go.mod +++ b/gcp/observability/go.mod @@ -11,4 +11,4 @@ require ( google.golang.org/protobuf v1.27.1 ) -replace google.golang.org/grpc => ../ +replace google.golang.org/grpc => ../../ From b2a40750ef0cd23f050abeecb816f39df683872c Mon Sep 17 00:00:00 2001 From: Lidi Zheng Date: Tue, 5 Apr 2022 10:21:47 -0700 Subject: [PATCH 21/23] Make proto (I thought vet.sh will run it for me) --- .../internal/config/config.pb.go | 131 +++---- .../internal/logging/logging.pb.go | 356 +++++++++--------- 2 files changed, 244 insertions(+), 243 deletions(-) diff --git a/gcp/observability/internal/config/config.pb.go b/gcp/observability/internal/config/config.pb.go index 61b1093e757..f41ddbf24db 100644 --- a/gcp/observability/internal/config/config.pb.go +++ b/gcp/observability/internal/config/config.pb.go @@ -24,7 +24,7 @@ // versions: // protoc-gen-go v1.25.0 // protoc v3.14.0 -// source: observability/internal/config/config.proto +// source: gcp/observability/internal/config/config.proto package config @@ -73,7 +73,7 @@ type ObservabilityConfig struct { func (x *ObservabilityConfig) Reset() { *x = ObservabilityConfig{} if protoimpl.UnsafeEnabled { - mi := &file_observability_internal_config_config_proto_msgTypes[0] + mi := &file_gcp_observability_internal_config_config_proto_msgTypes[0] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -86,7 +86,7 @@ func (x *ObservabilityConfig) String() string { func (*ObservabilityConfig) ProtoMessage() {} func (x *ObservabilityConfig) ProtoReflect() protoreflect.Message { - mi := &file_observability_internal_config_config_proto_msgTypes[0] + mi := &file_gcp_observability_internal_config_config_proto_msgTypes[0] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -99,7 +99,7 @@ func (x *ObservabilityConfig) ProtoReflect() protoreflect.Message { // Deprecated: Use ObservabilityConfig.ProtoReflect.Descriptor instead. func (*ObservabilityConfig) Descriptor() ([]byte, []int) { - return file_observability_internal_config_config_proto_rawDescGZIP(), []int{0} + return file_gcp_observability_internal_config_config_proto_rawDescGZIP(), []int{0} } func (x *ObservabilityConfig) GetEnableCloudLogging() bool { @@ -157,7 +157,7 @@ type ObservabilityConfig_LogFilter struct { func (x *ObservabilityConfig_LogFilter) Reset() { *x = ObservabilityConfig_LogFilter{} if protoimpl.UnsafeEnabled { - mi := &file_observability_internal_config_config_proto_msgTypes[1] + mi := &file_gcp_observability_internal_config_config_proto_msgTypes[1] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -170,7 +170,7 @@ func (x *ObservabilityConfig_LogFilter) String() string { func (*ObservabilityConfig_LogFilter) ProtoMessage() {} func (x *ObservabilityConfig_LogFilter) ProtoReflect() protoreflect.Message { - mi := &file_observability_internal_config_config_proto_msgTypes[1] + mi := &file_gcp_observability_internal_config_config_proto_msgTypes[1] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -183,7 +183,7 @@ func (x *ObservabilityConfig_LogFilter) ProtoReflect() protoreflect.Message { // Deprecated: Use ObservabilityConfig_LogFilter.ProtoReflect.Descriptor instead. func (*ObservabilityConfig_LogFilter) Descriptor() ([]byte, []int) { - return file_observability_internal_config_config_proto_rawDescGZIP(), []int{0, 0} + return file_gcp_observability_internal_config_config_proto_rawDescGZIP(), []int{0, 0} } func (x *ObservabilityConfig_LogFilter) GetPattern() string { @@ -207,63 +207,64 @@ func (x *ObservabilityConfig_LogFilter) GetMessageBytes() int32 { return 0 } -var File_observability_internal_config_config_proto protoreflect.FileDescriptor - -var file_observability_internal_config_config_proto_rawDesc = []byte{ - 0x0a, 0x2a, 0x6f, 0x62, 0x73, 0x65, 0x72, 0x76, 0x61, 0x62, 0x69, 0x6c, 0x69, 0x74, 0x79, 0x2f, - 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2f, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2f, - 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x21, 0x67, 0x72, - 0x70, 0x63, 0x2e, 0x6f, 0x62, 0x73, 0x65, 0x72, 0x76, 0x61, 0x62, 0x69, 0x6c, 0x69, 0x74, 0x79, - 0x2e, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x22, - 0xcf, 0x02, 0x0a, 0x13, 0x4f, 0x62, 0x73, 0x65, 0x72, 0x76, 0x61, 0x62, 0x69, 0x6c, 0x69, 0x74, - 0x79, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x12, 0x30, 0x0a, 0x14, 0x65, 0x6e, 0x61, 0x62, 0x6c, - 0x65, 0x5f, 0x63, 0x6c, 0x6f, 0x75, 0x64, 0x5f, 0x6c, 0x6f, 0x67, 0x67, 0x69, 0x6e, 0x67, 0x18, - 0x01, 0x20, 0x01, 0x28, 0x08, 0x52, 0x12, 0x65, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x43, 0x6c, 0x6f, - 0x75, 0x64, 0x4c, 0x6f, 0x67, 0x67, 0x69, 0x6e, 0x67, 0x12, 0x34, 0x0a, 0x16, 0x64, 0x65, 0x73, - 0x74, 0x69, 0x6e, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x70, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, - 0x5f, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x14, 0x64, 0x65, 0x73, 0x74, 0x69, - 0x6e, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x50, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x49, 0x64, 0x12, - 0x61, 0x0a, 0x0b, 0x6c, 0x6f, 0x67, 0x5f, 0x66, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x73, 0x18, 0x03, - 0x20, 0x03, 0x28, 0x0b, 0x32, 0x40, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x6f, 0x62, 0x73, 0x65, - 0x72, 0x76, 0x61, 0x62, 0x69, 0x6c, 0x69, 0x74, 0x79, 0x2e, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, - 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x2e, 0x4f, 0x62, 0x73, 0x65, 0x72, 0x76, 0x61, - 0x62, 0x69, 0x6c, 0x69, 0x74, 0x79, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2e, 0x4c, 0x6f, 0x67, - 0x46, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x52, 0x0a, 0x6c, 0x6f, 0x67, 0x46, 0x69, 0x6c, 0x74, 0x65, - 0x72, 0x73, 0x1a, 0x6d, 0x0a, 0x09, 0x4c, 0x6f, 0x67, 0x46, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x12, - 0x18, 0x0a, 0x07, 0x70, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, - 0x52, 0x07, 0x70, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x12, 0x21, 0x0a, 0x0c, 0x68, 0x65, 0x61, - 0x64, 0x65, 0x72, 0x5f, 0x62, 0x79, 0x74, 0x65, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, - 0x0b, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x42, 0x79, 0x74, 0x65, 0x73, 0x12, 0x23, 0x0a, 0x0d, - 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x5f, 0x62, 0x79, 0x74, 0x65, 0x73, 0x18, 0x03, 0x20, - 0x01, 0x28, 0x05, 0x52, 0x0c, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x42, 0x79, 0x74, 0x65, - 0x73, 0x42, 0x70, 0x0a, 0x1c, 0x69, 0x6f, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x6f, 0x62, 0x73, - 0x65, 0x72, 0x76, 0x61, 0x62, 0x69, 0x6c, 0x69, 0x74, 0x79, 0x2e, 0x63, 0x6f, 0x6e, 0x66, 0x69, - 0x67, 0x42, 0x18, 0x4f, 0x62, 0x73, 0x65, 0x72, 0x76, 0x61, 0x62, 0x69, 0x6c, 0x69, 0x74, 0x79, - 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x34, 0x67, - 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x67, 0x6f, 0x6c, 0x61, 0x6e, 0x67, 0x2e, 0x6f, 0x72, 0x67, - 0x2f, 0x67, 0x72, 0x70, 0x63, 0x2f, 0x6f, 0x62, 0x73, 0x65, 0x72, 0x76, 0x61, 0x62, 0x69, 0x6c, +var File_gcp_observability_internal_config_config_proto protoreflect.FileDescriptor + +var file_gcp_observability_internal_config_config_proto_rawDesc = []byte{ + 0x0a, 0x2e, 0x67, 0x63, 0x70, 0x2f, 0x6f, 0x62, 0x73, 0x65, 0x72, 0x76, 0x61, 0x62, 0x69, 0x6c, 0x69, 0x74, 0x79, 0x2f, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2f, 0x63, 0x6f, 0x6e, - 0x66, 0x69, 0x67, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x66, 0x69, 0x67, 0x2f, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x12, 0x21, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x6f, 0x62, 0x73, 0x65, 0x72, 0x76, 0x61, 0x62, 0x69, + 0x6c, 0x69, 0x74, 0x79, 0x2e, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2e, 0x76, 0x31, 0x61, 0x6c, + 0x70, 0x68, 0x61, 0x22, 0xcf, 0x02, 0x0a, 0x13, 0x4f, 0x62, 0x73, 0x65, 0x72, 0x76, 0x61, 0x62, + 0x69, 0x6c, 0x69, 0x74, 0x79, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x12, 0x30, 0x0a, 0x14, 0x65, + 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x5f, 0x63, 0x6c, 0x6f, 0x75, 0x64, 0x5f, 0x6c, 0x6f, 0x67, 0x67, + 0x69, 0x6e, 0x67, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 0x52, 0x12, 0x65, 0x6e, 0x61, 0x62, 0x6c, + 0x65, 0x43, 0x6c, 0x6f, 0x75, 0x64, 0x4c, 0x6f, 0x67, 0x67, 0x69, 0x6e, 0x67, 0x12, 0x34, 0x0a, + 0x16, 0x64, 0x65, 0x73, 0x74, 0x69, 0x6e, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x70, 0x72, 0x6f, + 0x6a, 0x65, 0x63, 0x74, 0x5f, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x14, 0x64, + 0x65, 0x73, 0x74, 0x69, 0x6e, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x50, 0x72, 0x6f, 0x6a, 0x65, 0x63, + 0x74, 0x49, 0x64, 0x12, 0x61, 0x0a, 0x0b, 0x6c, 0x6f, 0x67, 0x5f, 0x66, 0x69, 0x6c, 0x74, 0x65, + 0x72, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x40, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, + 0x6f, 0x62, 0x73, 0x65, 0x72, 0x76, 0x61, 0x62, 0x69, 0x6c, 0x69, 0x74, 0x79, 0x2e, 0x63, 0x6f, + 0x6e, 0x66, 0x69, 0x67, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x2e, 0x4f, 0x62, 0x73, + 0x65, 0x72, 0x76, 0x61, 0x62, 0x69, 0x6c, 0x69, 0x74, 0x79, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, + 0x2e, 0x4c, 0x6f, 0x67, 0x46, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x52, 0x0a, 0x6c, 0x6f, 0x67, 0x46, + 0x69, 0x6c, 0x74, 0x65, 0x72, 0x73, 0x1a, 0x6d, 0x0a, 0x09, 0x4c, 0x6f, 0x67, 0x46, 0x69, 0x6c, + 0x74, 0x65, 0x72, 0x12, 0x18, 0x0a, 0x07, 0x70, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x18, 0x01, + 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x70, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x12, 0x21, 0x0a, + 0x0c, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x5f, 0x62, 0x79, 0x74, 0x65, 0x73, 0x18, 0x02, 0x20, + 0x01, 0x28, 0x05, 0x52, 0x0b, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x42, 0x79, 0x74, 0x65, 0x73, + 0x12, 0x23, 0x0a, 0x0d, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x5f, 0x62, 0x79, 0x74, 0x65, + 0x73, 0x18, 0x03, 0x20, 0x01, 0x28, 0x05, 0x52, 0x0c, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, + 0x42, 0x79, 0x74, 0x65, 0x73, 0x42, 0x74, 0x0a, 0x1c, 0x69, 0x6f, 0x2e, 0x67, 0x72, 0x70, 0x63, + 0x2e, 0x6f, 0x62, 0x73, 0x65, 0x72, 0x76, 0x61, 0x62, 0x69, 0x6c, 0x69, 0x74, 0x79, 0x2e, 0x63, + 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x42, 0x18, 0x4f, 0x62, 0x73, 0x65, 0x72, 0x76, 0x61, 0x62, 0x69, + 0x6c, 0x69, 0x74, 0x79, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, + 0x01, 0x5a, 0x38, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x67, 0x6f, 0x6c, 0x61, 0x6e, 0x67, + 0x2e, 0x6f, 0x72, 0x67, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x2f, 0x67, 0x63, 0x70, 0x2f, 0x6f, 0x62, + 0x73, 0x65, 0x72, 0x76, 0x61, 0x62, 0x69, 0x6c, 0x69, 0x74, 0x79, 0x2f, 0x69, 0x6e, 0x74, 0x65, + 0x72, 0x6e, 0x61, 0x6c, 0x2f, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x62, 0x06, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x33, } var ( - file_observability_internal_config_config_proto_rawDescOnce sync.Once - file_observability_internal_config_config_proto_rawDescData = file_observability_internal_config_config_proto_rawDesc + file_gcp_observability_internal_config_config_proto_rawDescOnce sync.Once + file_gcp_observability_internal_config_config_proto_rawDescData = file_gcp_observability_internal_config_config_proto_rawDesc ) -func file_observability_internal_config_config_proto_rawDescGZIP() []byte { - file_observability_internal_config_config_proto_rawDescOnce.Do(func() { - file_observability_internal_config_config_proto_rawDescData = protoimpl.X.CompressGZIP(file_observability_internal_config_config_proto_rawDescData) +func file_gcp_observability_internal_config_config_proto_rawDescGZIP() []byte { + file_gcp_observability_internal_config_config_proto_rawDescOnce.Do(func() { + file_gcp_observability_internal_config_config_proto_rawDescData = protoimpl.X.CompressGZIP(file_gcp_observability_internal_config_config_proto_rawDescData) }) - return file_observability_internal_config_config_proto_rawDescData + return file_gcp_observability_internal_config_config_proto_rawDescData } -var file_observability_internal_config_config_proto_msgTypes = make([]protoimpl.MessageInfo, 2) -var file_observability_internal_config_config_proto_goTypes = []interface{}{ +var file_gcp_observability_internal_config_config_proto_msgTypes = make([]protoimpl.MessageInfo, 2) +var file_gcp_observability_internal_config_config_proto_goTypes = []interface{}{ (*ObservabilityConfig)(nil), // 0: grpc.observability.config.v1alpha.ObservabilityConfig (*ObservabilityConfig_LogFilter)(nil), // 1: grpc.observability.config.v1alpha.ObservabilityConfig.LogFilter } -var file_observability_internal_config_config_proto_depIdxs = []int32{ +var file_gcp_observability_internal_config_config_proto_depIdxs = []int32{ 1, // 0: grpc.observability.config.v1alpha.ObservabilityConfig.log_filters:type_name -> grpc.observability.config.v1alpha.ObservabilityConfig.LogFilter 1, // [1:1] is the sub-list for method output_type 1, // [1:1] is the sub-list for method input_type @@ -272,13 +273,13 @@ var file_observability_internal_config_config_proto_depIdxs = []int32{ 0, // [0:1] is the sub-list for field type_name } -func init() { file_observability_internal_config_config_proto_init() } -func file_observability_internal_config_config_proto_init() { - if File_observability_internal_config_config_proto != nil { +func init() { file_gcp_observability_internal_config_config_proto_init() } +func file_gcp_observability_internal_config_config_proto_init() { + if File_gcp_observability_internal_config_config_proto != nil { return } if !protoimpl.UnsafeEnabled { - file_observability_internal_config_config_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + file_gcp_observability_internal_config_config_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*ObservabilityConfig); i { case 0: return &v.state @@ -290,7 +291,7 @@ func file_observability_internal_config_config_proto_init() { return nil } } - file_observability_internal_config_config_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + file_gcp_observability_internal_config_config_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*ObservabilityConfig_LogFilter); i { case 0: return &v.state @@ -307,18 +308,18 @@ func file_observability_internal_config_config_proto_init() { out := protoimpl.TypeBuilder{ File: protoimpl.DescBuilder{ GoPackagePath: reflect.TypeOf(x{}).PkgPath(), - RawDescriptor: file_observability_internal_config_config_proto_rawDesc, + RawDescriptor: file_gcp_observability_internal_config_config_proto_rawDesc, NumEnums: 0, NumMessages: 2, NumExtensions: 0, NumServices: 0, }, - GoTypes: file_observability_internal_config_config_proto_goTypes, - DependencyIndexes: file_observability_internal_config_config_proto_depIdxs, - MessageInfos: file_observability_internal_config_config_proto_msgTypes, + GoTypes: file_gcp_observability_internal_config_config_proto_goTypes, + DependencyIndexes: file_gcp_observability_internal_config_config_proto_depIdxs, + MessageInfos: file_gcp_observability_internal_config_config_proto_msgTypes, }.Build() - File_observability_internal_config_config_proto = out.File - file_observability_internal_config_config_proto_rawDesc = nil - file_observability_internal_config_config_proto_goTypes = nil - file_observability_internal_config_config_proto_depIdxs = nil + File_gcp_observability_internal_config_config_proto = out.File + file_gcp_observability_internal_config_config_proto_rawDesc = nil + file_gcp_observability_internal_config_config_proto_goTypes = nil + file_gcp_observability_internal_config_config_proto_depIdxs = nil } diff --git a/gcp/observability/internal/logging/logging.pb.go b/gcp/observability/internal/logging/logging.pb.go index 69a8e4790e4..a47c405759b 100644 --- a/gcp/observability/internal/logging/logging.pb.go +++ b/gcp/observability/internal/logging/logging.pb.go @@ -16,7 +16,7 @@ // versions: // protoc-gen-go v1.25.0 // protoc v3.14.0 -// source: observability/internal/logging/logging.proto +// source: gcp/observability/internal/logging/logging.proto package logging @@ -98,11 +98,11 @@ func (x GrpcLogRecord_EventType) String() string { } func (GrpcLogRecord_EventType) Descriptor() protoreflect.EnumDescriptor { - return file_observability_internal_logging_logging_proto_enumTypes[0].Descriptor() + return file_gcp_observability_internal_logging_logging_proto_enumTypes[0].Descriptor() } func (GrpcLogRecord_EventType) Type() protoreflect.EnumType { - return &file_observability_internal_logging_logging_proto_enumTypes[0] + return &file_gcp_observability_internal_logging_logging_proto_enumTypes[0] } func (x GrpcLogRecord_EventType) Number() protoreflect.EnumNumber { @@ -111,7 +111,7 @@ func (x GrpcLogRecord_EventType) Number() protoreflect.EnumNumber { // Deprecated: Use GrpcLogRecord_EventType.Descriptor instead. func (GrpcLogRecord_EventType) EnumDescriptor() ([]byte, []int) { - return file_observability_internal_logging_logging_proto_rawDescGZIP(), []int{0, 0} + return file_gcp_observability_internal_logging_logging_proto_rawDescGZIP(), []int{0, 0} } // The entity that generates the log entry @@ -148,11 +148,11 @@ func (x GrpcLogRecord_EventLogger) String() string { } func (GrpcLogRecord_EventLogger) Descriptor() protoreflect.EnumDescriptor { - return file_observability_internal_logging_logging_proto_enumTypes[1].Descriptor() + return file_gcp_observability_internal_logging_logging_proto_enumTypes[1].Descriptor() } func (GrpcLogRecord_EventLogger) Type() protoreflect.EnumType { - return &file_observability_internal_logging_logging_proto_enumTypes[1] + return &file_gcp_observability_internal_logging_logging_proto_enumTypes[1] } func (x GrpcLogRecord_EventLogger) Number() protoreflect.EnumNumber { @@ -161,7 +161,7 @@ func (x GrpcLogRecord_EventLogger) Number() protoreflect.EnumNumber { // Deprecated: Use GrpcLogRecord_EventLogger.Descriptor instead. func (GrpcLogRecord_EventLogger) EnumDescriptor() ([]byte, []int) { - return file_observability_internal_logging_logging_proto_rawDescGZIP(), []int{0, 1} + return file_gcp_observability_internal_logging_logging_proto_rawDescGZIP(), []int{0, 1} } // The log severity level of the log entry @@ -210,11 +210,11 @@ func (x GrpcLogRecord_LogLevel) String() string { } func (GrpcLogRecord_LogLevel) Descriptor() protoreflect.EnumDescriptor { - return file_observability_internal_logging_logging_proto_enumTypes[2].Descriptor() + return file_gcp_observability_internal_logging_logging_proto_enumTypes[2].Descriptor() } func (GrpcLogRecord_LogLevel) Type() protoreflect.EnumType { - return &file_observability_internal_logging_logging_proto_enumTypes[2] + return &file_gcp_observability_internal_logging_logging_proto_enumTypes[2] } func (x GrpcLogRecord_LogLevel) Number() protoreflect.EnumNumber { @@ -223,7 +223,7 @@ func (x GrpcLogRecord_LogLevel) Number() protoreflect.EnumNumber { // Deprecated: Use GrpcLogRecord_LogLevel.Descriptor instead. func (GrpcLogRecord_LogLevel) EnumDescriptor() ([]byte, []int) { - return file_observability_internal_logging_logging_proto_rawDescGZIP(), []int{0, 2} + return file_gcp_observability_internal_logging_logging_proto_rawDescGZIP(), []int{0, 2} } type GrpcLogRecord_Address_Type int32 @@ -262,11 +262,11 @@ func (x GrpcLogRecord_Address_Type) String() string { } func (GrpcLogRecord_Address_Type) Descriptor() protoreflect.EnumDescriptor { - return file_observability_internal_logging_logging_proto_enumTypes[3].Descriptor() + return file_gcp_observability_internal_logging_logging_proto_enumTypes[3].Descriptor() } func (GrpcLogRecord_Address_Type) Type() protoreflect.EnumType { - return &file_observability_internal_logging_logging_proto_enumTypes[3] + return &file_gcp_observability_internal_logging_logging_proto_enumTypes[3] } func (x GrpcLogRecord_Address_Type) Number() protoreflect.EnumNumber { @@ -275,7 +275,7 @@ func (x GrpcLogRecord_Address_Type) Number() protoreflect.EnumNumber { // Deprecated: Use GrpcLogRecord_Address_Type.Descriptor instead. func (GrpcLogRecord_Address_Type) EnumDescriptor() ([]byte, []int) { - return file_observability_internal_logging_logging_proto_rawDescGZIP(), []int{0, 2, 0} + return file_gcp_observability_internal_logging_logging_proto_rawDescGZIP(), []int{0, 2, 0} } type GrpcLogRecord struct { @@ -337,7 +337,7 @@ type GrpcLogRecord struct { func (x *GrpcLogRecord) Reset() { *x = GrpcLogRecord{} if protoimpl.UnsafeEnabled { - mi := &file_observability_internal_logging_logging_proto_msgTypes[0] + mi := &file_gcp_observability_internal_logging_logging_proto_msgTypes[0] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -350,7 +350,7 @@ func (x *GrpcLogRecord) String() string { func (*GrpcLogRecord) ProtoMessage() {} func (x *GrpcLogRecord) ProtoReflect() protoreflect.Message { - mi := &file_observability_internal_logging_logging_proto_msgTypes[0] + mi := &file_gcp_observability_internal_logging_logging_proto_msgTypes[0] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -363,7 +363,7 @@ func (x *GrpcLogRecord) ProtoReflect() protoreflect.Message { // Deprecated: Use GrpcLogRecord.ProtoReflect.Descriptor instead. func (*GrpcLogRecord) Descriptor() ([]byte, []int) { - return file_observability_internal_logging_logging_proto_rawDescGZIP(), []int{0} + return file_gcp_observability_internal_logging_logging_proto_rawDescGZIP(), []int{0} } func (x *GrpcLogRecord) GetTimestamp() *timestamppb.Timestamp { @@ -504,7 +504,7 @@ type GrpcLogRecord_Metadata struct { func (x *GrpcLogRecord_Metadata) Reset() { *x = GrpcLogRecord_Metadata{} if protoimpl.UnsafeEnabled { - mi := &file_observability_internal_logging_logging_proto_msgTypes[1] + mi := &file_gcp_observability_internal_logging_logging_proto_msgTypes[1] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -517,7 +517,7 @@ func (x *GrpcLogRecord_Metadata) String() string { func (*GrpcLogRecord_Metadata) ProtoMessage() {} func (x *GrpcLogRecord_Metadata) ProtoReflect() protoreflect.Message { - mi := &file_observability_internal_logging_logging_proto_msgTypes[1] + mi := &file_gcp_observability_internal_logging_logging_proto_msgTypes[1] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -530,7 +530,7 @@ func (x *GrpcLogRecord_Metadata) ProtoReflect() protoreflect.Message { // Deprecated: Use GrpcLogRecord_Metadata.ProtoReflect.Descriptor instead. func (*GrpcLogRecord_Metadata) Descriptor() ([]byte, []int) { - return file_observability_internal_logging_logging_proto_rawDescGZIP(), []int{0, 0} + return file_gcp_observability_internal_logging_logging_proto_rawDescGZIP(), []int{0, 0} } func (x *GrpcLogRecord_Metadata) GetEntry() []*GrpcLogRecord_MetadataEntry { @@ -553,7 +553,7 @@ type GrpcLogRecord_MetadataEntry struct { func (x *GrpcLogRecord_MetadataEntry) Reset() { *x = GrpcLogRecord_MetadataEntry{} if protoimpl.UnsafeEnabled { - mi := &file_observability_internal_logging_logging_proto_msgTypes[2] + mi := &file_gcp_observability_internal_logging_logging_proto_msgTypes[2] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -566,7 +566,7 @@ func (x *GrpcLogRecord_MetadataEntry) String() string { func (*GrpcLogRecord_MetadataEntry) ProtoMessage() {} func (x *GrpcLogRecord_MetadataEntry) ProtoReflect() protoreflect.Message { - mi := &file_observability_internal_logging_logging_proto_msgTypes[2] + mi := &file_gcp_observability_internal_logging_logging_proto_msgTypes[2] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -579,7 +579,7 @@ func (x *GrpcLogRecord_MetadataEntry) ProtoReflect() protoreflect.Message { // Deprecated: Use GrpcLogRecord_MetadataEntry.ProtoReflect.Descriptor instead. func (*GrpcLogRecord_MetadataEntry) Descriptor() ([]byte, []int) { - return file_observability_internal_logging_logging_proto_rawDescGZIP(), []int{0, 1} + return file_gcp_observability_internal_logging_logging_proto_rawDescGZIP(), []int{0, 1} } func (x *GrpcLogRecord_MetadataEntry) GetKey() string { @@ -611,7 +611,7 @@ type GrpcLogRecord_Address struct { func (x *GrpcLogRecord_Address) Reset() { *x = GrpcLogRecord_Address{} if protoimpl.UnsafeEnabled { - mi := &file_observability_internal_logging_logging_proto_msgTypes[3] + mi := &file_gcp_observability_internal_logging_logging_proto_msgTypes[3] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -624,7 +624,7 @@ func (x *GrpcLogRecord_Address) String() string { func (*GrpcLogRecord_Address) ProtoMessage() {} func (x *GrpcLogRecord_Address) ProtoReflect() protoreflect.Message { - mi := &file_observability_internal_logging_logging_proto_msgTypes[3] + mi := &file_gcp_observability_internal_logging_logging_proto_msgTypes[3] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -637,7 +637,7 @@ func (x *GrpcLogRecord_Address) ProtoReflect() protoreflect.Message { // Deprecated: Use GrpcLogRecord_Address.ProtoReflect.Descriptor instead. func (*GrpcLogRecord_Address) Descriptor() ([]byte, []int) { - return file_observability_internal_logging_logging_proto_rawDescGZIP(), []int{0, 2} + return file_gcp_observability_internal_logging_logging_proto_rawDescGZIP(), []int{0, 2} } func (x *GrpcLogRecord_Address) GetType() GrpcLogRecord_Address_Type { @@ -661,154 +661,154 @@ func (x *GrpcLogRecord_Address) GetIpPort() uint32 { return 0 } -var File_observability_internal_logging_logging_proto protoreflect.FileDescriptor - -var file_observability_internal_logging_logging_proto_rawDesc = []byte{ - 0x0a, 0x2c, 0x6f, 0x62, 0x73, 0x65, 0x72, 0x76, 0x61, 0x62, 0x69, 0x6c, 0x69, 0x74, 0x79, 0x2f, - 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2f, 0x6c, 0x6f, 0x67, 0x67, 0x69, 0x6e, 0x67, - 0x2f, 0x6c, 0x6f, 0x67, 0x67, 0x69, 0x6e, 0x67, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x1d, - 0x67, 0x72, 0x70, 0x63, 0x2e, 0x6f, 0x62, 0x73, 0x65, 0x72, 0x76, 0x61, 0x62, 0x69, 0x6c, 0x69, - 0x74, 0x79, 0x2e, 0x6c, 0x6f, 0x67, 0x67, 0x69, 0x6e, 0x67, 0x2e, 0x76, 0x31, 0x1a, 0x1e, 0x67, - 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x64, - 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1f, 0x67, - 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x74, - 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xe5, - 0x0d, 0x0a, 0x0d, 0x47, 0x72, 0x70, 0x63, 0x4c, 0x6f, 0x67, 0x52, 0x65, 0x63, 0x6f, 0x72, 0x64, - 0x12, 0x38, 0x0a, 0x09, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x18, 0x01, 0x20, - 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, - 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x52, - 0x09, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x12, 0x15, 0x0a, 0x06, 0x72, 0x70, - 0x63, 0x5f, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x72, 0x70, 0x63, 0x49, - 0x64, 0x12, 0x55, 0x0a, 0x0a, 0x65, 0x76, 0x65, 0x6e, 0x74, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x18, - 0x03, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x36, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x6f, 0x62, 0x73, +var File_gcp_observability_internal_logging_logging_proto protoreflect.FileDescriptor + +var file_gcp_observability_internal_logging_logging_proto_rawDesc = []byte{ + 0x0a, 0x30, 0x67, 0x63, 0x70, 0x2f, 0x6f, 0x62, 0x73, 0x65, 0x72, 0x76, 0x61, 0x62, 0x69, 0x6c, + 0x69, 0x74, 0x79, 0x2f, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2f, 0x6c, 0x6f, 0x67, + 0x67, 0x69, 0x6e, 0x67, 0x2f, 0x6c, 0x6f, 0x67, 0x67, 0x69, 0x6e, 0x67, 0x2e, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x12, 0x1d, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x6f, 0x62, 0x73, 0x65, 0x72, 0x76, 0x61, + 0x62, 0x69, 0x6c, 0x69, 0x74, 0x79, 0x2e, 0x6c, 0x6f, 0x67, 0x67, 0x69, 0x6e, 0x67, 0x2e, 0x76, + 0x31, 0x1a, 0x1e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, + 0x75, 0x66, 0x2f, 0x64, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x1a, 0x1f, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, + 0x75, 0x66, 0x2f, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x2e, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x22, 0xe5, 0x0d, 0x0a, 0x0d, 0x47, 0x72, 0x70, 0x63, 0x4c, 0x6f, 0x67, 0x52, 0x65, + 0x63, 0x6f, 0x72, 0x64, 0x12, 0x38, 0x0a, 0x09, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, + 0x70, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, + 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, + 0x61, 0x6d, 0x70, 0x52, 0x09, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x12, 0x15, + 0x0a, 0x06, 0x72, 0x70, 0x63, 0x5f, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, + 0x72, 0x70, 0x63, 0x49, 0x64, 0x12, 0x55, 0x0a, 0x0a, 0x65, 0x76, 0x65, 0x6e, 0x74, 0x5f, 0x74, + 0x79, 0x70, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x36, 0x2e, 0x67, 0x72, 0x70, 0x63, + 0x2e, 0x6f, 0x62, 0x73, 0x65, 0x72, 0x76, 0x61, 0x62, 0x69, 0x6c, 0x69, 0x74, 0x79, 0x2e, 0x6c, + 0x6f, 0x67, 0x67, 0x69, 0x6e, 0x67, 0x2e, 0x76, 0x31, 0x2e, 0x47, 0x72, 0x70, 0x63, 0x4c, 0x6f, + 0x67, 0x52, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x2e, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x54, 0x79, 0x70, + 0x65, 0x52, 0x09, 0x65, 0x76, 0x65, 0x6e, 0x74, 0x54, 0x79, 0x70, 0x65, 0x12, 0x5b, 0x0a, 0x0c, + 0x65, 0x76, 0x65, 0x6e, 0x74, 0x5f, 0x6c, 0x6f, 0x67, 0x67, 0x65, 0x72, 0x18, 0x04, 0x20, 0x01, + 0x28, 0x0e, 0x32, 0x38, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x6f, 0x62, 0x73, 0x65, 0x72, 0x76, + 0x61, 0x62, 0x69, 0x6c, 0x69, 0x74, 0x79, 0x2e, 0x6c, 0x6f, 0x67, 0x67, 0x69, 0x6e, 0x67, 0x2e, + 0x76, 0x31, 0x2e, 0x47, 0x72, 0x70, 0x63, 0x4c, 0x6f, 0x67, 0x52, 0x65, 0x63, 0x6f, 0x72, 0x64, + 0x2e, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x4c, 0x6f, 0x67, 0x67, 0x65, 0x72, 0x52, 0x0b, 0x65, 0x76, + 0x65, 0x6e, 0x74, 0x4c, 0x6f, 0x67, 0x67, 0x65, 0x72, 0x12, 0x21, 0x0a, 0x0c, 0x73, 0x65, 0x72, + 0x76, 0x69, 0x63, 0x65, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x0b, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x1f, 0x0a, 0x0b, + 0x6d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x06, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x0a, 0x6d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x52, 0x0a, + 0x09, 0x6c, 0x6f, 0x67, 0x5f, 0x6c, 0x65, 0x76, 0x65, 0x6c, 0x18, 0x07, 0x20, 0x01, 0x28, 0x0e, + 0x32, 0x35, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x6f, 0x62, 0x73, 0x65, 0x72, 0x76, 0x61, 0x62, + 0x69, 0x6c, 0x69, 0x74, 0x79, 0x2e, 0x6c, 0x6f, 0x67, 0x67, 0x69, 0x6e, 0x67, 0x2e, 0x76, 0x31, + 0x2e, 0x47, 0x72, 0x70, 0x63, 0x4c, 0x6f, 0x67, 0x52, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x2e, 0x4c, + 0x6f, 0x67, 0x4c, 0x65, 0x76, 0x65, 0x6c, 0x52, 0x08, 0x6c, 0x6f, 0x67, 0x4c, 0x65, 0x76, 0x65, + 0x6c, 0x12, 0x57, 0x0a, 0x0c, 0x70, 0x65, 0x65, 0x72, 0x5f, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, + 0x73, 0x18, 0x08, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x34, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x6f, + 0x62, 0x73, 0x65, 0x72, 0x76, 0x61, 0x62, 0x69, 0x6c, 0x69, 0x74, 0x79, 0x2e, 0x6c, 0x6f, 0x67, + 0x67, 0x69, 0x6e, 0x67, 0x2e, 0x76, 0x31, 0x2e, 0x47, 0x72, 0x70, 0x63, 0x4c, 0x6f, 0x67, 0x52, + 0x65, 0x63, 0x6f, 0x72, 0x64, 0x2e, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x52, 0x0b, 0x70, + 0x65, 0x65, 0x72, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x12, 0x33, 0x0a, 0x07, 0x74, 0x69, + 0x6d, 0x65, 0x6f, 0x75, 0x74, 0x18, 0x0b, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x67, 0x6f, + 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x44, 0x75, + 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x07, 0x74, 0x69, 0x6d, 0x65, 0x6f, 0x75, 0x74, 0x12, + 0x1c, 0x0a, 0x09, 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x74, 0x79, 0x18, 0x0c, 0x20, 0x01, + 0x28, 0x09, 0x52, 0x09, 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x74, 0x79, 0x12, 0x21, 0x0a, + 0x0c, 0x70, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x5f, 0x73, 0x69, 0x7a, 0x65, 0x18, 0x0d, 0x20, + 0x01, 0x28, 0x0d, 0x52, 0x0b, 0x70, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x53, 0x69, 0x7a, 0x65, + 0x12, 0x2b, 0x0a, 0x11, 0x70, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x5f, 0x74, 0x72, 0x75, 0x6e, + 0x63, 0x61, 0x74, 0x65, 0x64, 0x18, 0x0e, 0x20, 0x01, 0x28, 0x08, 0x52, 0x10, 0x70, 0x61, 0x79, + 0x6c, 0x6f, 0x61, 0x64, 0x54, 0x72, 0x75, 0x6e, 0x63, 0x61, 0x74, 0x65, 0x64, 0x12, 0x51, 0x0a, + 0x08, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x18, 0x0f, 0x20, 0x01, 0x28, 0x0b, 0x32, + 0x35, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x6f, 0x62, 0x73, 0x65, 0x72, 0x76, 0x61, 0x62, 0x69, + 0x6c, 0x69, 0x74, 0x79, 0x2e, 0x6c, 0x6f, 0x67, 0x67, 0x69, 0x6e, 0x67, 0x2e, 0x76, 0x31, 0x2e, + 0x47, 0x72, 0x70, 0x63, 0x4c, 0x6f, 0x67, 0x52, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x2e, 0x4d, 0x65, + 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x52, 0x08, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, + 0x12, 0x1f, 0x0a, 0x0b, 0x73, 0x65, 0x71, 0x75, 0x65, 0x6e, 0x63, 0x65, 0x5f, 0x69, 0x64, 0x18, + 0x10, 0x20, 0x01, 0x28, 0x04, 0x52, 0x0a, 0x73, 0x65, 0x71, 0x75, 0x65, 0x6e, 0x63, 0x65, 0x49, + 0x64, 0x12, 0x18, 0x0a, 0x07, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x18, 0x11, 0x20, 0x01, + 0x28, 0x0c, 0x52, 0x07, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x12, 0x1f, 0x0a, 0x0b, 0x73, + 0x74, 0x61, 0x74, 0x75, 0x73, 0x5f, 0x63, 0x6f, 0x64, 0x65, 0x18, 0x12, 0x20, 0x01, 0x28, 0x0d, + 0x52, 0x0a, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x43, 0x6f, 0x64, 0x65, 0x12, 0x25, 0x0a, 0x0e, + 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x5f, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x18, 0x13, + 0x20, 0x01, 0x28, 0x09, 0x52, 0x0d, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x4d, 0x65, 0x73, 0x73, + 0x61, 0x67, 0x65, 0x12, 0x25, 0x0a, 0x0e, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x5f, 0x64, 0x65, + 0x74, 0x61, 0x69, 0x6c, 0x73, 0x18, 0x14, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x0d, 0x73, 0x74, 0x61, + 0x74, 0x75, 0x73, 0x44, 0x65, 0x74, 0x61, 0x69, 0x6c, 0x73, 0x1a, 0x5c, 0x0a, 0x08, 0x4d, 0x65, + 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x12, 0x50, 0x0a, 0x05, 0x65, 0x6e, 0x74, 0x72, 0x79, 0x18, + 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x3a, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x6f, 0x62, 0x73, 0x65, 0x72, 0x76, 0x61, 0x62, 0x69, 0x6c, 0x69, 0x74, 0x79, 0x2e, 0x6c, 0x6f, 0x67, 0x67, 0x69, 0x6e, 0x67, 0x2e, 0x76, 0x31, 0x2e, 0x47, 0x72, 0x70, 0x63, 0x4c, 0x6f, 0x67, 0x52, 0x65, 0x63, - 0x6f, 0x72, 0x64, 0x2e, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x54, 0x79, 0x70, 0x65, 0x52, 0x09, 0x65, - 0x76, 0x65, 0x6e, 0x74, 0x54, 0x79, 0x70, 0x65, 0x12, 0x5b, 0x0a, 0x0c, 0x65, 0x76, 0x65, 0x6e, - 0x74, 0x5f, 0x6c, 0x6f, 0x67, 0x67, 0x65, 0x72, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x38, - 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x6f, 0x62, 0x73, 0x65, 0x72, 0x76, 0x61, 0x62, 0x69, 0x6c, - 0x69, 0x74, 0x79, 0x2e, 0x6c, 0x6f, 0x67, 0x67, 0x69, 0x6e, 0x67, 0x2e, 0x76, 0x31, 0x2e, 0x47, - 0x72, 0x70, 0x63, 0x4c, 0x6f, 0x67, 0x52, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x2e, 0x45, 0x76, 0x65, - 0x6e, 0x74, 0x4c, 0x6f, 0x67, 0x67, 0x65, 0x72, 0x52, 0x0b, 0x65, 0x76, 0x65, 0x6e, 0x74, 0x4c, - 0x6f, 0x67, 0x67, 0x65, 0x72, 0x12, 0x21, 0x0a, 0x0c, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, - 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x73, 0x65, 0x72, - 0x76, 0x69, 0x63, 0x65, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x1f, 0x0a, 0x0b, 0x6d, 0x65, 0x74, 0x68, - 0x6f, 0x64, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x6d, - 0x65, 0x74, 0x68, 0x6f, 0x64, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x52, 0x0a, 0x09, 0x6c, 0x6f, 0x67, - 0x5f, 0x6c, 0x65, 0x76, 0x65, 0x6c, 0x18, 0x07, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x35, 0x2e, 0x67, - 0x72, 0x70, 0x63, 0x2e, 0x6f, 0x62, 0x73, 0x65, 0x72, 0x76, 0x61, 0x62, 0x69, 0x6c, 0x69, 0x74, - 0x79, 0x2e, 0x6c, 0x6f, 0x67, 0x67, 0x69, 0x6e, 0x67, 0x2e, 0x76, 0x31, 0x2e, 0x47, 0x72, 0x70, - 0x63, 0x4c, 0x6f, 0x67, 0x52, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x2e, 0x4c, 0x6f, 0x67, 0x4c, 0x65, - 0x76, 0x65, 0x6c, 0x52, 0x08, 0x6c, 0x6f, 0x67, 0x4c, 0x65, 0x76, 0x65, 0x6c, 0x12, 0x57, 0x0a, - 0x0c, 0x70, 0x65, 0x65, 0x72, 0x5f, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x18, 0x08, 0x20, - 0x01, 0x28, 0x0b, 0x32, 0x34, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x6f, 0x62, 0x73, 0x65, 0x72, - 0x76, 0x61, 0x62, 0x69, 0x6c, 0x69, 0x74, 0x79, 0x2e, 0x6c, 0x6f, 0x67, 0x67, 0x69, 0x6e, 0x67, - 0x2e, 0x76, 0x31, 0x2e, 0x47, 0x72, 0x70, 0x63, 0x4c, 0x6f, 0x67, 0x52, 0x65, 0x63, 0x6f, 0x72, - 0x64, 0x2e, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x52, 0x0b, 0x70, 0x65, 0x65, 0x72, 0x41, - 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x12, 0x33, 0x0a, 0x07, 0x74, 0x69, 0x6d, 0x65, 0x6f, 0x75, - 0x74, 0x18, 0x0b, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, - 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x44, 0x75, 0x72, 0x61, 0x74, 0x69, - 0x6f, 0x6e, 0x52, 0x07, 0x74, 0x69, 0x6d, 0x65, 0x6f, 0x75, 0x74, 0x12, 0x1c, 0x0a, 0x09, 0x61, - 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x74, 0x79, 0x18, 0x0c, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, - 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x74, 0x79, 0x12, 0x21, 0x0a, 0x0c, 0x70, 0x61, 0x79, - 0x6c, 0x6f, 0x61, 0x64, 0x5f, 0x73, 0x69, 0x7a, 0x65, 0x18, 0x0d, 0x20, 0x01, 0x28, 0x0d, 0x52, - 0x0b, 0x70, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x53, 0x69, 0x7a, 0x65, 0x12, 0x2b, 0x0a, 0x11, - 0x70, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x5f, 0x74, 0x72, 0x75, 0x6e, 0x63, 0x61, 0x74, 0x65, - 0x64, 0x18, 0x0e, 0x20, 0x01, 0x28, 0x08, 0x52, 0x10, 0x70, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, - 0x54, 0x72, 0x75, 0x6e, 0x63, 0x61, 0x74, 0x65, 0x64, 0x12, 0x51, 0x0a, 0x08, 0x6d, 0x65, 0x74, - 0x61, 0x64, 0x61, 0x74, 0x61, 0x18, 0x0f, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x35, 0x2e, 0x67, 0x72, + 0x6f, 0x72, 0x64, 0x2e, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x45, 0x6e, 0x74, 0x72, + 0x79, 0x52, 0x05, 0x65, 0x6e, 0x74, 0x72, 0x79, 0x1a, 0x37, 0x0a, 0x0d, 0x4d, 0x65, 0x74, 0x61, + 0x64, 0x61, 0x74, 0x61, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, + 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x76, + 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, + 0x65, 0x1a, 0xd2, 0x01, 0x0a, 0x07, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x12, 0x4d, 0x0a, + 0x04, 0x74, 0x79, 0x70, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x39, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x6f, 0x62, 0x73, 0x65, 0x72, 0x76, 0x61, 0x62, 0x69, 0x6c, 0x69, 0x74, 0x79, 0x2e, 0x6c, 0x6f, 0x67, 0x67, 0x69, 0x6e, 0x67, 0x2e, 0x76, 0x31, 0x2e, 0x47, 0x72, 0x70, 0x63, - 0x4c, 0x6f, 0x67, 0x52, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x2e, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, - 0x74, 0x61, 0x52, 0x08, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x12, 0x1f, 0x0a, 0x0b, - 0x73, 0x65, 0x71, 0x75, 0x65, 0x6e, 0x63, 0x65, 0x5f, 0x69, 0x64, 0x18, 0x10, 0x20, 0x01, 0x28, - 0x04, 0x52, 0x0a, 0x73, 0x65, 0x71, 0x75, 0x65, 0x6e, 0x63, 0x65, 0x49, 0x64, 0x12, 0x18, 0x0a, - 0x07, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x18, 0x11, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x07, - 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x12, 0x1f, 0x0a, 0x0b, 0x73, 0x74, 0x61, 0x74, 0x75, - 0x73, 0x5f, 0x63, 0x6f, 0x64, 0x65, 0x18, 0x12, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x0a, 0x73, 0x74, - 0x61, 0x74, 0x75, 0x73, 0x43, 0x6f, 0x64, 0x65, 0x12, 0x25, 0x0a, 0x0e, 0x73, 0x74, 0x61, 0x74, - 0x75, 0x73, 0x5f, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x18, 0x13, 0x20, 0x01, 0x28, 0x09, - 0x52, 0x0d, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x12, - 0x25, 0x0a, 0x0e, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x5f, 0x64, 0x65, 0x74, 0x61, 0x69, 0x6c, - 0x73, 0x18, 0x14, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x0d, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x44, - 0x65, 0x74, 0x61, 0x69, 0x6c, 0x73, 0x1a, 0x5c, 0x0a, 0x08, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, - 0x74, 0x61, 0x12, 0x50, 0x0a, 0x05, 0x65, 0x6e, 0x74, 0x72, 0x79, 0x18, 0x01, 0x20, 0x03, 0x28, - 0x0b, 0x32, 0x3a, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x6f, 0x62, 0x73, 0x65, 0x72, 0x76, 0x61, - 0x62, 0x69, 0x6c, 0x69, 0x74, 0x79, 0x2e, 0x6c, 0x6f, 0x67, 0x67, 0x69, 0x6e, 0x67, 0x2e, 0x76, - 0x31, 0x2e, 0x47, 0x72, 0x70, 0x63, 0x4c, 0x6f, 0x67, 0x52, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x2e, - 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x05, 0x65, - 0x6e, 0x74, 0x72, 0x79, 0x1a, 0x37, 0x0a, 0x0d, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, - 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, - 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, - 0x18, 0x02, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x1a, 0xd2, 0x01, - 0x0a, 0x07, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x12, 0x4d, 0x0a, 0x04, 0x74, 0x79, 0x70, - 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x39, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x6f, - 0x62, 0x73, 0x65, 0x72, 0x76, 0x61, 0x62, 0x69, 0x6c, 0x69, 0x74, 0x79, 0x2e, 0x6c, 0x6f, 0x67, - 0x67, 0x69, 0x6e, 0x67, 0x2e, 0x76, 0x31, 0x2e, 0x47, 0x72, 0x70, 0x63, 0x4c, 0x6f, 0x67, 0x52, - 0x65, 0x63, 0x6f, 0x72, 0x64, 0x2e, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x2e, 0x54, 0x79, - 0x70, 0x65, 0x52, 0x04, 0x74, 0x79, 0x70, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x61, 0x64, 0x64, 0x72, - 0x65, 0x73, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, - 0x73, 0x73, 0x12, 0x17, 0x0a, 0x07, 0x69, 0x70, 0x5f, 0x70, 0x6f, 0x72, 0x74, 0x18, 0x03, 0x20, - 0x01, 0x28, 0x0d, 0x52, 0x06, 0x69, 0x70, 0x50, 0x6f, 0x72, 0x74, 0x22, 0x45, 0x0a, 0x04, 0x54, - 0x79, 0x70, 0x65, 0x12, 0x10, 0x0a, 0x0c, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x55, 0x4e, 0x4b, 0x4e, - 0x4f, 0x57, 0x4e, 0x10, 0x00, 0x12, 0x0d, 0x0a, 0x09, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x49, 0x50, - 0x56, 0x34, 0x10, 0x01, 0x12, 0x0d, 0x0a, 0x09, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x49, 0x50, 0x56, - 0x36, 0x10, 0x02, 0x12, 0x0d, 0x0a, 0x09, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x55, 0x4e, 0x49, 0x58, - 0x10, 0x03, 0x22, 0xe5, 0x01, 0x0a, 0x09, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x54, 0x79, 0x70, 0x65, - 0x12, 0x15, 0x0a, 0x11, 0x47, 0x52, 0x50, 0x43, 0x5f, 0x43, 0x41, 0x4c, 0x4c, 0x5f, 0x55, 0x4e, - 0x4b, 0x4e, 0x4f, 0x57, 0x4e, 0x10, 0x00, 0x12, 0x1c, 0x0a, 0x18, 0x47, 0x52, 0x50, 0x43, 0x5f, - 0x43, 0x41, 0x4c, 0x4c, 0x5f, 0x52, 0x45, 0x51, 0x55, 0x45, 0x53, 0x54, 0x5f, 0x48, 0x45, 0x41, - 0x44, 0x45, 0x52, 0x10, 0x01, 0x12, 0x1d, 0x0a, 0x19, 0x47, 0x52, 0x50, 0x43, 0x5f, 0x43, 0x41, - 0x4c, 0x4c, 0x5f, 0x52, 0x45, 0x53, 0x50, 0x4f, 0x4e, 0x53, 0x45, 0x5f, 0x48, 0x45, 0x41, 0x44, - 0x45, 0x52, 0x10, 0x02, 0x12, 0x1d, 0x0a, 0x19, 0x47, 0x52, 0x50, 0x43, 0x5f, 0x43, 0x41, 0x4c, - 0x4c, 0x5f, 0x52, 0x45, 0x51, 0x55, 0x45, 0x53, 0x54, 0x5f, 0x4d, 0x45, 0x53, 0x53, 0x41, 0x47, - 0x45, 0x10, 0x03, 0x12, 0x1e, 0x0a, 0x1a, 0x47, 0x52, 0x50, 0x43, 0x5f, 0x43, 0x41, 0x4c, 0x4c, - 0x5f, 0x52, 0x45, 0x53, 0x50, 0x4f, 0x4e, 0x53, 0x45, 0x5f, 0x4d, 0x45, 0x53, 0x53, 0x41, 0x47, - 0x45, 0x10, 0x04, 0x12, 0x15, 0x0a, 0x11, 0x47, 0x52, 0x50, 0x43, 0x5f, 0x43, 0x41, 0x4c, 0x4c, - 0x5f, 0x54, 0x52, 0x41, 0x49, 0x4c, 0x45, 0x52, 0x10, 0x05, 0x12, 0x18, 0x0a, 0x14, 0x47, 0x52, - 0x50, 0x43, 0x5f, 0x43, 0x41, 0x4c, 0x4c, 0x5f, 0x48, 0x41, 0x4c, 0x46, 0x5f, 0x43, 0x4c, 0x4f, - 0x53, 0x45, 0x10, 0x06, 0x12, 0x14, 0x0a, 0x10, 0x47, 0x52, 0x50, 0x43, 0x5f, 0x43, 0x41, 0x4c, - 0x4c, 0x5f, 0x43, 0x41, 0x4e, 0x43, 0x45, 0x4c, 0x10, 0x07, 0x22, 0x47, 0x0a, 0x0b, 0x45, 0x76, - 0x65, 0x6e, 0x74, 0x4c, 0x6f, 0x67, 0x67, 0x65, 0x72, 0x12, 0x12, 0x0a, 0x0e, 0x4c, 0x4f, 0x47, - 0x47, 0x45, 0x52, 0x5f, 0x55, 0x4e, 0x4b, 0x4e, 0x4f, 0x57, 0x4e, 0x10, 0x00, 0x12, 0x11, 0x0a, - 0x0d, 0x4c, 0x4f, 0x47, 0x47, 0x45, 0x52, 0x5f, 0x43, 0x4c, 0x49, 0x45, 0x4e, 0x54, 0x10, 0x01, - 0x12, 0x11, 0x0a, 0x0d, 0x4c, 0x4f, 0x47, 0x47, 0x45, 0x52, 0x5f, 0x53, 0x45, 0x52, 0x56, 0x45, - 0x52, 0x10, 0x02, 0x22, 0xa0, 0x01, 0x0a, 0x08, 0x4c, 0x6f, 0x67, 0x4c, 0x65, 0x76, 0x65, 0x6c, - 0x12, 0x15, 0x0a, 0x11, 0x4c, 0x4f, 0x47, 0x5f, 0x4c, 0x45, 0x56, 0x45, 0x4c, 0x5f, 0x55, 0x4e, - 0x4b, 0x4e, 0x4f, 0x57, 0x4e, 0x10, 0x00, 0x12, 0x13, 0x0a, 0x0f, 0x4c, 0x4f, 0x47, 0x5f, 0x4c, - 0x45, 0x56, 0x45, 0x4c, 0x5f, 0x54, 0x52, 0x41, 0x43, 0x45, 0x10, 0x01, 0x12, 0x13, 0x0a, 0x0f, - 0x4c, 0x4f, 0x47, 0x5f, 0x4c, 0x45, 0x56, 0x45, 0x4c, 0x5f, 0x44, 0x45, 0x42, 0x55, 0x47, 0x10, - 0x02, 0x12, 0x12, 0x0a, 0x0e, 0x4c, 0x4f, 0x47, 0x5f, 0x4c, 0x45, 0x56, 0x45, 0x4c, 0x5f, 0x49, - 0x4e, 0x46, 0x4f, 0x10, 0x03, 0x12, 0x12, 0x0a, 0x0e, 0x4c, 0x4f, 0x47, 0x5f, 0x4c, 0x45, 0x56, - 0x45, 0x4c, 0x5f, 0x57, 0x41, 0x52, 0x4e, 0x10, 0x04, 0x12, 0x13, 0x0a, 0x0f, 0x4c, 0x4f, 0x47, - 0x5f, 0x4c, 0x45, 0x56, 0x45, 0x4c, 0x5f, 0x45, 0x52, 0x52, 0x4f, 0x52, 0x10, 0x05, 0x12, 0x16, - 0x0a, 0x12, 0x4c, 0x4f, 0x47, 0x5f, 0x4c, 0x45, 0x56, 0x45, 0x4c, 0x5f, 0x43, 0x52, 0x49, 0x54, - 0x49, 0x43, 0x41, 0x4c, 0x10, 0x06, 0x42, 0x73, 0x0a, 0x1d, 0x69, 0x6f, 0x2e, 0x67, 0x72, 0x70, - 0x63, 0x2e, 0x6f, 0x62, 0x73, 0x65, 0x72, 0x76, 0x61, 0x62, 0x69, 0x6c, 0x69, 0x74, 0x79, 0x2e, - 0x6c, 0x6f, 0x67, 0x67, 0x69, 0x6e, 0x67, 0x42, 0x19, 0x4f, 0x62, 0x73, 0x65, 0x72, 0x76, 0x61, - 0x62, 0x69, 0x6c, 0x69, 0x74, 0x79, 0x4c, 0x6f, 0x67, 0x67, 0x69, 0x6e, 0x67, 0x50, 0x72, 0x6f, - 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x35, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x67, 0x6f, 0x6c, - 0x61, 0x6e, 0x67, 0x2e, 0x6f, 0x72, 0x67, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x2f, 0x6f, 0x62, 0x73, - 0x65, 0x72, 0x76, 0x61, 0x62, 0x69, 0x6c, 0x69, 0x74, 0x79, 0x2f, 0x69, 0x6e, 0x74, 0x65, 0x72, - 0x6e, 0x61, 0x6c, 0x2f, 0x6c, 0x6f, 0x67, 0x67, 0x69, 0x6e, 0x67, 0x62, 0x06, 0x70, 0x72, 0x6f, - 0x74, 0x6f, 0x33, + 0x4c, 0x6f, 0x67, 0x52, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x2e, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, + 0x73, 0x2e, 0x54, 0x79, 0x70, 0x65, 0x52, 0x04, 0x74, 0x79, 0x70, 0x65, 0x12, 0x18, 0x0a, 0x07, + 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x61, + 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x12, 0x17, 0x0a, 0x07, 0x69, 0x70, 0x5f, 0x70, 0x6f, 0x72, + 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x06, 0x69, 0x70, 0x50, 0x6f, 0x72, 0x74, 0x22, + 0x45, 0x0a, 0x04, 0x54, 0x79, 0x70, 0x65, 0x12, 0x10, 0x0a, 0x0c, 0x54, 0x59, 0x50, 0x45, 0x5f, + 0x55, 0x4e, 0x4b, 0x4e, 0x4f, 0x57, 0x4e, 0x10, 0x00, 0x12, 0x0d, 0x0a, 0x09, 0x54, 0x59, 0x50, + 0x45, 0x5f, 0x49, 0x50, 0x56, 0x34, 0x10, 0x01, 0x12, 0x0d, 0x0a, 0x09, 0x54, 0x59, 0x50, 0x45, + 0x5f, 0x49, 0x50, 0x56, 0x36, 0x10, 0x02, 0x12, 0x0d, 0x0a, 0x09, 0x54, 0x59, 0x50, 0x45, 0x5f, + 0x55, 0x4e, 0x49, 0x58, 0x10, 0x03, 0x22, 0xe5, 0x01, 0x0a, 0x09, 0x45, 0x76, 0x65, 0x6e, 0x74, + 0x54, 0x79, 0x70, 0x65, 0x12, 0x15, 0x0a, 0x11, 0x47, 0x52, 0x50, 0x43, 0x5f, 0x43, 0x41, 0x4c, + 0x4c, 0x5f, 0x55, 0x4e, 0x4b, 0x4e, 0x4f, 0x57, 0x4e, 0x10, 0x00, 0x12, 0x1c, 0x0a, 0x18, 0x47, + 0x52, 0x50, 0x43, 0x5f, 0x43, 0x41, 0x4c, 0x4c, 0x5f, 0x52, 0x45, 0x51, 0x55, 0x45, 0x53, 0x54, + 0x5f, 0x48, 0x45, 0x41, 0x44, 0x45, 0x52, 0x10, 0x01, 0x12, 0x1d, 0x0a, 0x19, 0x47, 0x52, 0x50, + 0x43, 0x5f, 0x43, 0x41, 0x4c, 0x4c, 0x5f, 0x52, 0x45, 0x53, 0x50, 0x4f, 0x4e, 0x53, 0x45, 0x5f, + 0x48, 0x45, 0x41, 0x44, 0x45, 0x52, 0x10, 0x02, 0x12, 0x1d, 0x0a, 0x19, 0x47, 0x52, 0x50, 0x43, + 0x5f, 0x43, 0x41, 0x4c, 0x4c, 0x5f, 0x52, 0x45, 0x51, 0x55, 0x45, 0x53, 0x54, 0x5f, 0x4d, 0x45, + 0x53, 0x53, 0x41, 0x47, 0x45, 0x10, 0x03, 0x12, 0x1e, 0x0a, 0x1a, 0x47, 0x52, 0x50, 0x43, 0x5f, + 0x43, 0x41, 0x4c, 0x4c, 0x5f, 0x52, 0x45, 0x53, 0x50, 0x4f, 0x4e, 0x53, 0x45, 0x5f, 0x4d, 0x45, + 0x53, 0x53, 0x41, 0x47, 0x45, 0x10, 0x04, 0x12, 0x15, 0x0a, 0x11, 0x47, 0x52, 0x50, 0x43, 0x5f, + 0x43, 0x41, 0x4c, 0x4c, 0x5f, 0x54, 0x52, 0x41, 0x49, 0x4c, 0x45, 0x52, 0x10, 0x05, 0x12, 0x18, + 0x0a, 0x14, 0x47, 0x52, 0x50, 0x43, 0x5f, 0x43, 0x41, 0x4c, 0x4c, 0x5f, 0x48, 0x41, 0x4c, 0x46, + 0x5f, 0x43, 0x4c, 0x4f, 0x53, 0x45, 0x10, 0x06, 0x12, 0x14, 0x0a, 0x10, 0x47, 0x52, 0x50, 0x43, + 0x5f, 0x43, 0x41, 0x4c, 0x4c, 0x5f, 0x43, 0x41, 0x4e, 0x43, 0x45, 0x4c, 0x10, 0x07, 0x22, 0x47, + 0x0a, 0x0b, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x4c, 0x6f, 0x67, 0x67, 0x65, 0x72, 0x12, 0x12, 0x0a, + 0x0e, 0x4c, 0x4f, 0x47, 0x47, 0x45, 0x52, 0x5f, 0x55, 0x4e, 0x4b, 0x4e, 0x4f, 0x57, 0x4e, 0x10, + 0x00, 0x12, 0x11, 0x0a, 0x0d, 0x4c, 0x4f, 0x47, 0x47, 0x45, 0x52, 0x5f, 0x43, 0x4c, 0x49, 0x45, + 0x4e, 0x54, 0x10, 0x01, 0x12, 0x11, 0x0a, 0x0d, 0x4c, 0x4f, 0x47, 0x47, 0x45, 0x52, 0x5f, 0x53, + 0x45, 0x52, 0x56, 0x45, 0x52, 0x10, 0x02, 0x22, 0xa0, 0x01, 0x0a, 0x08, 0x4c, 0x6f, 0x67, 0x4c, + 0x65, 0x76, 0x65, 0x6c, 0x12, 0x15, 0x0a, 0x11, 0x4c, 0x4f, 0x47, 0x5f, 0x4c, 0x45, 0x56, 0x45, + 0x4c, 0x5f, 0x55, 0x4e, 0x4b, 0x4e, 0x4f, 0x57, 0x4e, 0x10, 0x00, 0x12, 0x13, 0x0a, 0x0f, 0x4c, + 0x4f, 0x47, 0x5f, 0x4c, 0x45, 0x56, 0x45, 0x4c, 0x5f, 0x54, 0x52, 0x41, 0x43, 0x45, 0x10, 0x01, + 0x12, 0x13, 0x0a, 0x0f, 0x4c, 0x4f, 0x47, 0x5f, 0x4c, 0x45, 0x56, 0x45, 0x4c, 0x5f, 0x44, 0x45, + 0x42, 0x55, 0x47, 0x10, 0x02, 0x12, 0x12, 0x0a, 0x0e, 0x4c, 0x4f, 0x47, 0x5f, 0x4c, 0x45, 0x56, + 0x45, 0x4c, 0x5f, 0x49, 0x4e, 0x46, 0x4f, 0x10, 0x03, 0x12, 0x12, 0x0a, 0x0e, 0x4c, 0x4f, 0x47, + 0x5f, 0x4c, 0x45, 0x56, 0x45, 0x4c, 0x5f, 0x57, 0x41, 0x52, 0x4e, 0x10, 0x04, 0x12, 0x13, 0x0a, + 0x0f, 0x4c, 0x4f, 0x47, 0x5f, 0x4c, 0x45, 0x56, 0x45, 0x4c, 0x5f, 0x45, 0x52, 0x52, 0x4f, 0x52, + 0x10, 0x05, 0x12, 0x16, 0x0a, 0x12, 0x4c, 0x4f, 0x47, 0x5f, 0x4c, 0x45, 0x56, 0x45, 0x4c, 0x5f, + 0x43, 0x52, 0x49, 0x54, 0x49, 0x43, 0x41, 0x4c, 0x10, 0x06, 0x42, 0x77, 0x0a, 0x1d, 0x69, 0x6f, + 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x6f, 0x62, 0x73, 0x65, 0x72, 0x76, 0x61, 0x62, 0x69, 0x6c, + 0x69, 0x74, 0x79, 0x2e, 0x6c, 0x6f, 0x67, 0x67, 0x69, 0x6e, 0x67, 0x42, 0x19, 0x4f, 0x62, 0x73, + 0x65, 0x72, 0x76, 0x61, 0x62, 0x69, 0x6c, 0x69, 0x74, 0x79, 0x4c, 0x6f, 0x67, 0x67, 0x69, 0x6e, + 0x67, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x39, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, + 0x2e, 0x67, 0x6f, 0x6c, 0x61, 0x6e, 0x67, 0x2e, 0x6f, 0x72, 0x67, 0x2f, 0x67, 0x72, 0x70, 0x63, + 0x2f, 0x67, 0x63, 0x70, 0x2f, 0x6f, 0x62, 0x73, 0x65, 0x72, 0x76, 0x61, 0x62, 0x69, 0x6c, 0x69, + 0x74, 0x79, 0x2f, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2f, 0x6c, 0x6f, 0x67, 0x67, + 0x69, 0x6e, 0x67, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( - file_observability_internal_logging_logging_proto_rawDescOnce sync.Once - file_observability_internal_logging_logging_proto_rawDescData = file_observability_internal_logging_logging_proto_rawDesc + file_gcp_observability_internal_logging_logging_proto_rawDescOnce sync.Once + file_gcp_observability_internal_logging_logging_proto_rawDescData = file_gcp_observability_internal_logging_logging_proto_rawDesc ) -func file_observability_internal_logging_logging_proto_rawDescGZIP() []byte { - file_observability_internal_logging_logging_proto_rawDescOnce.Do(func() { - file_observability_internal_logging_logging_proto_rawDescData = protoimpl.X.CompressGZIP(file_observability_internal_logging_logging_proto_rawDescData) +func file_gcp_observability_internal_logging_logging_proto_rawDescGZIP() []byte { + file_gcp_observability_internal_logging_logging_proto_rawDescOnce.Do(func() { + file_gcp_observability_internal_logging_logging_proto_rawDescData = protoimpl.X.CompressGZIP(file_gcp_observability_internal_logging_logging_proto_rawDescData) }) - return file_observability_internal_logging_logging_proto_rawDescData + return file_gcp_observability_internal_logging_logging_proto_rawDescData } -var file_observability_internal_logging_logging_proto_enumTypes = make([]protoimpl.EnumInfo, 4) -var file_observability_internal_logging_logging_proto_msgTypes = make([]protoimpl.MessageInfo, 4) -var file_observability_internal_logging_logging_proto_goTypes = []interface{}{ +var file_gcp_observability_internal_logging_logging_proto_enumTypes = make([]protoimpl.EnumInfo, 4) +var file_gcp_observability_internal_logging_logging_proto_msgTypes = make([]protoimpl.MessageInfo, 4) +var file_gcp_observability_internal_logging_logging_proto_goTypes = []interface{}{ (GrpcLogRecord_EventType)(0), // 0: grpc.observability.logging.v1.GrpcLogRecord.EventType (GrpcLogRecord_EventLogger)(0), // 1: grpc.observability.logging.v1.GrpcLogRecord.EventLogger (GrpcLogRecord_LogLevel)(0), // 2: grpc.observability.logging.v1.GrpcLogRecord.LogLevel @@ -820,7 +820,7 @@ var file_observability_internal_logging_logging_proto_goTypes = []interface{}{ (*timestamppb.Timestamp)(nil), // 8: google.protobuf.Timestamp (*durationpb.Duration)(nil), // 9: google.protobuf.Duration } -var file_observability_internal_logging_logging_proto_depIdxs = []int32{ +var file_gcp_observability_internal_logging_logging_proto_depIdxs = []int32{ 8, // 0: grpc.observability.logging.v1.GrpcLogRecord.timestamp:type_name -> google.protobuf.Timestamp 0, // 1: grpc.observability.logging.v1.GrpcLogRecord.event_type:type_name -> grpc.observability.logging.v1.GrpcLogRecord.EventType 1, // 2: grpc.observability.logging.v1.GrpcLogRecord.event_logger:type_name -> grpc.observability.logging.v1.GrpcLogRecord.EventLogger @@ -837,13 +837,13 @@ var file_observability_internal_logging_logging_proto_depIdxs = []int32{ 0, // [0:9] is the sub-list for field type_name } -func init() { file_observability_internal_logging_logging_proto_init() } -func file_observability_internal_logging_logging_proto_init() { - if File_observability_internal_logging_logging_proto != nil { +func init() { file_gcp_observability_internal_logging_logging_proto_init() } +func file_gcp_observability_internal_logging_logging_proto_init() { + if File_gcp_observability_internal_logging_logging_proto != nil { return } if !protoimpl.UnsafeEnabled { - file_observability_internal_logging_logging_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + file_gcp_observability_internal_logging_logging_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*GrpcLogRecord); i { case 0: return &v.state @@ -855,7 +855,7 @@ func file_observability_internal_logging_logging_proto_init() { return nil } } - file_observability_internal_logging_logging_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + file_gcp_observability_internal_logging_logging_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*GrpcLogRecord_Metadata); i { case 0: return &v.state @@ -867,7 +867,7 @@ func file_observability_internal_logging_logging_proto_init() { return nil } } - file_observability_internal_logging_logging_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { + file_gcp_observability_internal_logging_logging_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*GrpcLogRecord_MetadataEntry); i { case 0: return &v.state @@ -879,7 +879,7 @@ func file_observability_internal_logging_logging_proto_init() { return nil } } - file_observability_internal_logging_logging_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { + file_gcp_observability_internal_logging_logging_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*GrpcLogRecord_Address); i { case 0: return &v.state @@ -896,19 +896,19 @@ func file_observability_internal_logging_logging_proto_init() { out := protoimpl.TypeBuilder{ File: protoimpl.DescBuilder{ GoPackagePath: reflect.TypeOf(x{}).PkgPath(), - RawDescriptor: file_observability_internal_logging_logging_proto_rawDesc, + RawDescriptor: file_gcp_observability_internal_logging_logging_proto_rawDesc, NumEnums: 4, NumMessages: 4, NumExtensions: 0, NumServices: 0, }, - GoTypes: file_observability_internal_logging_logging_proto_goTypes, - DependencyIndexes: file_observability_internal_logging_logging_proto_depIdxs, - EnumInfos: file_observability_internal_logging_logging_proto_enumTypes, - MessageInfos: file_observability_internal_logging_logging_proto_msgTypes, + GoTypes: file_gcp_observability_internal_logging_logging_proto_goTypes, + DependencyIndexes: file_gcp_observability_internal_logging_logging_proto_depIdxs, + EnumInfos: file_gcp_observability_internal_logging_logging_proto_enumTypes, + MessageInfos: file_gcp_observability_internal_logging_logging_proto_msgTypes, }.Build() - File_observability_internal_logging_logging_proto = out.File - file_observability_internal_logging_logging_proto_rawDesc = nil - file_observability_internal_logging_logging_proto_goTypes = nil - file_observability_internal_logging_logging_proto_depIdxs = nil + File_gcp_observability_internal_logging_logging_proto = out.File + file_gcp_observability_internal_logging_logging_proto_rawDesc = nil + file_gcp_observability_internal_logging_logging_proto_goTypes = nil + file_gcp_observability_internal_logging_logging_proto_depIdxs = nil } From 00cda05e2f11056e744bcb2bc2a1d40b40a3f501 Mon Sep 17 00:00:00 2001 From: Lidi Zheng Date: Tue, 5 Apr 2022 15:35:59 -0700 Subject: [PATCH 22/23] retrigger checks From f87acae7b1233f2bd68d7a931926ea3c1da3b4fb Mon Sep 17 00:00:00 2001 From: Lidi Zheng Date: Tue, 5 Apr 2022 15:50:26 -0700 Subject: [PATCH 23/23] the 1.18 test is flaky