chore: refactor (#2388)

master
Kevin Wan 2 years ago committed by GitHub
parent 60160f56b8
commit e9650d547b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -3,7 +3,6 @@ package trace
import ( import (
"context" "context"
"fmt" "fmt"
"google.golang.org/grpc"
"sync" "sync"
"github.com/zeromicro/go-zero/core/lang" "github.com/zeromicro/go-zero/core/lang"
@ -15,6 +14,7 @@ import (
"go.opentelemetry.io/otel/sdk/resource" "go.opentelemetry.io/otel/sdk/resource"
sdktrace "go.opentelemetry.io/otel/sdk/trace" sdktrace "go.opentelemetry.io/otel/sdk/trace"
semconv "go.opentelemetry.io/otel/semconv/v1.4.0" semconv "go.opentelemetry.io/otel/semconv/v1.4.0"
"google.golang.org/grpc"
) )
const ( const (
@ -60,7 +60,11 @@ func createExporter(c Config) (sdktrace.SpanExporter, error) {
case kindZipkin: case kindZipkin:
return zipkin.New(c.Endpoint) return zipkin.New(c.Endpoint)
case kindGrpc: case kindGrpc:
return otlptracegrpc.NewUnstarted(otlptracegrpc.WithInsecure(), otlptracegrpc.WithEndpoint(c.Endpoint), otlptracegrpc.WithDialOption(grpc.WithBlock())), nil return otlptracegrpc.NewUnstarted(
otlptracegrpc.WithInsecure(),
otlptracegrpc.WithEndpoint(c.Endpoint),
otlptracegrpc.WithDialOption(grpc.WithBlock()),
), nil
default: default:
return nil, fmt.Errorf("unknown exporter: %s", c.Batcher) return nil, fmt.Errorf("unknown exporter: %s", c.Batcher)
} }

Loading…
Cancel
Save