add the opentelemetry tracing (#908)
* add the opentelemetry tracing * fix the error sampler config * 添加stream的链路跟踪 * fix the error field name
This commit is contained in:
@@ -0,0 +1,27 @@
|
||||
package clientinterceptors
|
||||
|
||||
import (
|
||||
"context"
|
||||
"testing"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/tal-tech/go-zero/core/opentelemetry"
|
||||
"google.golang.org/grpc"
|
||||
)
|
||||
|
||||
func TestOpenTracingInterceptor(t *testing.T) {
|
||||
opentelemetry.StartAgent(opentelemetry.Config{
|
||||
Name: "go-zero-test",
|
||||
Endpoint: "http://localhost:14268/api/traces",
|
||||
Batcher: "jaeger",
|
||||
Sampler: 1.0,
|
||||
})
|
||||
|
||||
cc := new(grpc.ClientConn)
|
||||
err := OpenTracingInterceptor()(context.Background(), "/ListUser", nil, nil, cc,
|
||||
func(ctx context.Context, method string, req, reply interface{}, cc *grpc.ClientConn,
|
||||
opts ...grpc.CallOption) error {
|
||||
return nil
|
||||
})
|
||||
assert.Nil(t, err)
|
||||
}
|
||||
Reference in New Issue
Block a user