-
Notifications
You must be signed in to change notification settings - Fork 8.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add OpenTelemetry interceptors to capture traces from gRPC communicat…
…ions Signed-off-by: Antoine Toulme <antoine@lunar-ocean.com>
- Loading branch information
Showing
165 changed files
with
24,552 additions
and
595 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
/* | ||
Copyright IBM Corp. All Rights Reserved. | ||
SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
package grpctracing_test | ||
|
||
import ( | ||
"testing" | ||
|
||
"github.com/hyperledger/fabric/common/grpctracing/testpb" | ||
. "github.com/onsi/ginkgo" | ||
. "github.com/onsi/gomega" | ||
) | ||
|
||
//go:generate protoc --proto_path=testpb --go_out=plugins=grpc,paths=source_relative:testpb testpb/echo.proto | ||
|
||
func TestGrpctracing(t *testing.T) { | ||
RegisterFailHandler(Fail) | ||
RunSpecs(t, "Grpctracing Suite") | ||
} | ||
|
||
//go:generate counterfeiter -o fakes/echo_service.go --fake-name EchoServiceServer . echoServiceServer | ||
|
||
type echoServiceServer interface { | ||
testpb.EchoServiceServer | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
/* | ||
Copyright IBM Corp. All Rights Reserved. | ||
SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
package grpctracing | ||
|
||
import ( | ||
"go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc" | ||
"google.golang.org/grpc" | ||
) | ||
|
||
func UnaryServerInterceptor() grpc.UnaryServerInterceptor { | ||
return otelgrpc.UnaryServerInterceptor() | ||
} | ||
|
||
func StreamServerInterceptor() grpc.StreamServerInterceptor { | ||
return otelgrpc.StreamServerInterceptor() | ||
} |
Oops, something went wrong.