mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-19 19:30:44 +00:00
fix issue with endpoint configuration
This commit is contained in:
parent
d9c9243251
commit
135f0fbfb1
1 changed files with 4 additions and 3 deletions
|
|
@ -60,12 +60,10 @@ func SetupOTEL(ctx *cli.Context) (*otelService, error) {
|
|||
if !ctx.Bool(OTELEnabledFlag.Name) {
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
endpoint := ctx.String(OTELEndpointFlag.Name)
|
||||
if endpoint == "" {
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
serviceName := ctx.String(OTELServiceNameFlag.Name)
|
||||
setupCtx := ctx.Context
|
||||
if setupCtx == nil {
|
||||
|
|
@ -82,11 +80,14 @@ func SetupOTEL(ctx *cli.Context) (*otelService, error) {
|
|||
switch u.Scheme {
|
||||
case "http", "https":
|
||||
opts := []otlptracehttp.Option{
|
||||
otlptracehttp.WithEndpoint(endpoint),
|
||||
otlptracehttp.WithEndpoint(u.Host),
|
||||
}
|
||||
if u.Scheme == "http" {
|
||||
opts = append(opts, otlptracehttp.WithInsecure())
|
||||
}
|
||||
if u.Path != "" && u.Path != "/" {
|
||||
opts = append(opts, otlptracehttp.WithURLPath(u.Path))
|
||||
}
|
||||
exporter, err = otlptracehttp.New(setupCtx, opts...)
|
||||
default:
|
||||
return nil, fmt.Errorf("unsupported otel url scheme: %s", u.Scheme)
|
||||
|
|
|
|||
Loading…
Reference in a new issue