snapshot of https://github.com/grpc/grpc-go.git (master, 2026-09-15; blobs > 131072B omitted)
Some checks failed
codecov / upload (push) Failing after 13m59s
CodeQL / Analyze (push) Failing after 1s
Testing / vet-proto (push) Failing after 1s
Testing / tests (arm, latest) (push) Waiting to run
Testing / extras (latest) (push) Failing after 1s
Testing / static checks (latest-1) (push) Failing after 1s
Testing / tests (-race, latest) (push) Failing after 1s
Testing / tests (i386, latest) (push) Failing after 1s
Testing / tests (latest) (push) Failing after 1s
Testing / tests (latest-1) (push) Failing after 1s
Lock Threads / lock (push) Failing after 1s
govulncheck / govulncheck (.) (push) Failing after 1s
govulncheck / govulncheck (./cmd/protoc-gen-go-grpc) (push) Failing after 1s
govulncheck / govulncheck (./gcp/observability) (push) Failing after 1s
govulncheck / govulncheck (./security/advancedtls) (push) Failing after 1s
govulncheck / govulncheck (./stats/opencensus) (push) Failing after 1s
Stale bot / stale (push) Failing after 1s

This commit is contained in:
upstream-mirror
2026-09-15 20:40:15 +05:00
commit e241b33f26
1365 changed files with 339570 additions and 0 deletions

View File

@@ -0,0 +1,53 @@
# 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.
#
# Stage 1: Build the interop test client and server
#
FROM golang:1.25-bullseye as build
WORKDIR /grpc-go
COPY . .
WORKDIR /grpc-go/interop/observability
RUN go build -o server/ server/server.go && \
go build -o client/ client/client.go
#
# Stage 2:
#
# - Copy only the necessary files to reduce Docker image size.
# - Have an ENTRYPOINT script which will launch the interop test client or server
# with the given parameters.
#
FROM golang:1.24-bullseye
ENV GRPC_GO_LOG_SEVERITY_LEVEL info
ENV GRPC_GO_LOG_VERBOSITY_LEVEL 2
WORKDIR /grpc-go/interop/observability/server
COPY --from=build /grpc-go/interop/observability/server/server .
WORKDIR /grpc-go/interop/observability/client
COPY --from=build /grpc-go/interop/observability/client/client .
WORKDIR /grpc-go/interop/observability
COPY --from=build /grpc-go/interop/observability/run.sh .
ENTRYPOINT ["/grpc-go/interop/observability/run.sh"]

View File

@@ -0,0 +1,26 @@
#!/bin/bash
# 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.
set -ex
cd "$(dirname "$0")"/../..
# Environment Variables:
#
# TAG_NAME: the docker image tag name
#
echo Building ${TAG_NAME}
docker build --no-cache -t ${TAG_NAME} -f ./interop/observability/Dockerfile .

View File

@@ -0,0 +1,84 @@
/*
*
* 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.
*
*/
// Binary client is an interop client for Observability.
//
// See interop test case descriptions [here].
//
// [here]: https://github.com/grpc/grpc/blob/master/doc/interop-test-descriptions.md
package main
import (
"context"
"flag"
"log"
"net"
"strconv"
"time"
"google.golang.org/grpc"
"google.golang.org/grpc/credentials/insecure"
"google.golang.org/grpc/gcp/observability"
"google.golang.org/grpc/interop"
testgrpc "google.golang.org/grpc/interop/grpc_testing"
)
var (
serverHost = flag.String("server_host", "localhost", "The server host name")
serverPort = flag.Int("server_port", 10000, "The server port number")
testCase = flag.String("test_case", "large_unary", "The action to perform")
numTimes = flag.Int("num_times", 1, "Number of times to run the test case")
)
func main() {
err := observability.Start(context.Background())
if err != nil {
log.Fatalf("observability start failed: %v", err)
}
defer observability.End()
flag.Parse()
serverAddr := *serverHost
if *serverPort != 0 {
serverAddr = net.JoinHostPort(*serverHost, strconv.Itoa(*serverPort))
}
conn, err := grpc.NewClient(serverAddr, grpc.WithTransportCredentials(insecure.NewCredentials()))
if err != nil {
log.Fatalf("grpc.NewClient(%q) = %v", serverAddr, err)
}
defer conn.Close()
tc := testgrpc.NewTestServiceClient(conn)
ctx := context.Background()
for i := 0; i < *numTimes; i++ {
if *testCase == "ping_pong" {
interop.DoPingPong(ctx, tc)
} else if *testCase == "large_unary" {
interop.DoLargeUnaryCall(ctx, tc)
} else if *testCase == "custom_metadata" {
interop.DoCustomMetadata(ctx, tc)
} else {
log.Fatalf("Invalid test case: %s", *testCase)
}
}
// TODO(stanleycheung): remove this once the observability exporter plugin is able to
// gracefully flush observability data to cloud at shutdown
// TODO(stanleycheung): see if we can reduce the number 65
const exporterSleepDuration = 65 * time.Second
log.Printf("Sleeping %v before closing...", exporterSleepDuration)
time.Sleep(exporterSleepDuration)
}

View File

@@ -0,0 +1,73 @@
module google.golang.org/grpc/interop/observability
go 1.25.0
require (
google.golang.org/grpc v1.83.0
google.golang.org/grpc/gcp/observability v1.0.1
)
require (
cloud.google.com/go v0.123.0 // indirect
cloud.google.com/go/auth v0.23.1 // indirect
cloud.google.com/go/auth/oauth2adapt v0.2.8 // indirect
cloud.google.com/go/compute/metadata v0.9.0 // indirect
cloud.google.com/go/logging v1.19.1 // indirect
cloud.google.com/go/longrunning v1.2.0 // indirect
cloud.google.com/go/monitoring v1.30.0 // indirect
cloud.google.com/go/trace v1.16.0 // indirect
contrib.go.opencensus.io/exporter/stackdriver v0.13.15-0.20230702191903-2de6d2748484 // indirect
github.com/aws/aws-sdk-go-v2 v1.43.6 // indirect
github.com/aws/aws-sdk-go-v2/config v1.32.37 // indirect
github.com/aws/aws-sdk-go-v2/credentials v1.19.36 // indirect
github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.18.37 // indirect
github.com/aws/aws-sdk-go-v2/internal/configsources v1.4.37 // indirect
github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.7.37 // indirect
github.com/aws/aws-sdk-go-v2/internal/v4a v1.4.38 // indirect
github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.13.17 // indirect
github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.13.37 // indirect
github.com/aws/aws-sdk-go-v2/service/signin v1.5.6 // indirect
github.com/aws/aws-sdk-go-v2/service/sso v1.33.6 // indirect
github.com/aws/aws-sdk-go-v2/service/ssooidc v1.38.6 // indirect
github.com/aws/aws-sdk-go-v2/service/sts v1.45.6 // indirect
github.com/aws/smithy-go v1.27.8 // indirect
github.com/census-instrumentation/opencensus-proto v0.4.1 // indirect
github.com/cespare/xxhash/v2 v2.3.0 // indirect
github.com/cncf/xds/go v0.0.0-20260202195803-dba9d589def2 // indirect
github.com/envoyproxy/protoc-gen-validate v1.3.3 // indirect
github.com/felixge/httpsnoop v1.1.0 // indirect
github.com/go-logr/logr v1.4.4 // indirect
github.com/go-logr/stdr v1.2.2 // indirect
github.com/golang/groupcache v0.0.0-20241129210726-2c02b8208cf8 // indirect
github.com/golang/protobuf v1.5.4 // indirect
github.com/google/s2a-go v0.1.9 // indirect
github.com/google/uuid v1.6.0 // indirect
github.com/googleapis/enterprise-certificate-proxy v0.3.21 // indirect
github.com/googleapis/gax-go/v2 v2.23.0 // indirect
go.opencensus.io v0.24.0 // indirect
go.opentelemetry.io/auto/sdk v1.2.1 // indirect
go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.70.0 // indirect
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.70.0 // indirect
go.opentelemetry.io/otel v1.45.0 // indirect
go.opentelemetry.io/otel/metric v1.45.0 // indirect
go.opentelemetry.io/otel/trace v1.45.0 // indirect
golang.org/x/crypto v0.55.0 // indirect
golang.org/x/net v0.58.0 // indirect
golang.org/x/oauth2 v0.36.0 // indirect
golang.org/x/sync v0.22.0 // indirect
golang.org/x/sys v0.47.0 // indirect
golang.org/x/text v0.41.0 // indirect
golang.org/x/time v0.15.0 // indirect
google.golang.org/api v0.293.0 // indirect
google.golang.org/genproto v0.0.0-20260817212433-ac3dfec99bb1 // indirect
google.golang.org/genproto/googleapis/api v0.0.0-20260817212433-ac3dfec99bb1 // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20260817212433-ac3dfec99bb1 // indirect
google.golang.org/grpc/stats/opencensus v1.0.0 // indirect
google.golang.org/protobuf v1.36.12 // indirect
)
replace google.golang.org/grpc => ../..
replace google.golang.org/grpc/gcp/observability => ../../gcp/observability
replace google.golang.org/grpc/stats/opencensus => ../../stats/opencensus

29
interop/observability/run.sh Executable file
View File

@@ -0,0 +1,29 @@
#!/bin/bash
# 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.
set -ex
cd "$(dirname "$0")"/../..
if [ "$1" = "server" ] ; then
/grpc-go/interop/observability/server/server "${@:2}"
elif [ "$1" = "client" ] ; then
/grpc-go/interop/observability/client/client "${@:2}"
else
echo "Invalid action: $1. Usage:"
echo " $ .../run.sh [server|client] --server_host=<hostname> --server_port=<port> ..."
exit 1
fi

View File

@@ -0,0 +1,60 @@
/*
*
* 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.
*
*/
// Binary server is an interop server for Observability.
//
// See interop test case descriptions [here].
//
// [here]: https://github.com/grpc/grpc/blob/master/doc/interop-test-descriptions.md
package main
import (
"context"
"flag"
"fmt"
"log"
"net"
"google.golang.org/grpc"
"google.golang.org/grpc/gcp/observability"
"google.golang.org/grpc/interop"
testgrpc "google.golang.org/grpc/interop/grpc_testing"
)
var (
port = flag.Int("port", 10000, "The server port")
)
func main() {
err := observability.Start(context.Background())
if err != nil {
log.Fatalf("observability start failed: %v", err)
}
defer observability.End()
flag.Parse()
lis, err := net.Listen("tcp", fmt.Sprintf(":%d", *port))
if err != nil {
log.Fatalf("failed to listen: %v", err)
}
server := grpc.NewServer()
defer server.Stop()
testgrpc.RegisterTestServiceServer(server, interop.NewTestServer())
log.Printf("Observability interop server listening on %v", lis.Addr())
server.Serve(lis)
}