mirror of
https://github.com/zeromicro/go-zero.git
synced 2025-01-24 18:00:24 +08:00
10e7922597
* feat: opentelemetry integration, removed self designed tracing * feat: support zipkin on opentelemetry integration * feat: support zipkin on opentelemetry integration, enable it in conf * style: format code * fix: support logx without exporter configured * fix: check return values * refactor: simplify code * refactor: simplify opentelemetry integration * ci: fix staticcheck errors
33 lines
818 B
Go
33 lines
818 B
Go
package serverinterceptors
|
|
|
|
import (
|
|
"context"
|
|
"testing"
|
|
|
|
"github.com/stretchr/testify/assert"
|
|
"github.com/tal-tech/go-zero/core/prometheus"
|
|
"google.golang.org/grpc"
|
|
)
|
|
|
|
func TestUnaryPromMetricInterceptor_Disabled(t *testing.T) {
|
|
_, err := UnaryPrometheusInterceptor(context.Background(), nil, &grpc.UnaryServerInfo{
|
|
FullMethod: "/",
|
|
}, func(ctx context.Context, req interface{}) (interface{}, error) {
|
|
return nil, nil
|
|
})
|
|
assert.Nil(t, err)
|
|
}
|
|
|
|
func TestUnaryPromMetricInterceptor_Enabled(t *testing.T) {
|
|
prometheus.StartAgent(prometheus.Config{
|
|
Host: "localhost",
|
|
Path: "/",
|
|
})
|
|
_, err := UnaryPrometheusInterceptor(context.Background(), nil, &grpc.UnaryServerInfo{
|
|
FullMethod: "/",
|
|
}, func(ctx context.Context, req interface{}) (interface{}, error) {
|
|
return nil, nil
|
|
})
|
|
assert.Nil(t, err)
|
|
}
|