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) {
|
if !ctx.Bool(OTELEnabledFlag.Name) {
|
||||||
return nil, nil
|
return nil, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
endpoint := ctx.String(OTELEndpointFlag.Name)
|
endpoint := ctx.String(OTELEndpointFlag.Name)
|
||||||
if endpoint == "" {
|
if endpoint == "" {
|
||||||
return nil, nil
|
return nil, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
serviceName := ctx.String(OTELServiceNameFlag.Name)
|
serviceName := ctx.String(OTELServiceNameFlag.Name)
|
||||||
setupCtx := ctx.Context
|
setupCtx := ctx.Context
|
||||||
if setupCtx == nil {
|
if setupCtx == nil {
|
||||||
|
|
@ -82,11 +80,14 @@ func SetupOTEL(ctx *cli.Context) (*otelService, error) {
|
||||||
switch u.Scheme {
|
switch u.Scheme {
|
||||||
case "http", "https":
|
case "http", "https":
|
||||||
opts := []otlptracehttp.Option{
|
opts := []otlptracehttp.Option{
|
||||||
otlptracehttp.WithEndpoint(endpoint),
|
otlptracehttp.WithEndpoint(u.Host),
|
||||||
}
|
}
|
||||||
if u.Scheme == "http" {
|
if u.Scheme == "http" {
|
||||||
opts = append(opts, otlptracehttp.WithInsecure())
|
opts = append(opts, otlptracehttp.WithInsecure())
|
||||||
}
|
}
|
||||||
|
if u.Path != "" && u.Path != "/" {
|
||||||
|
opts = append(opts, otlptracehttp.WithURLPath(u.Path))
|
||||||
|
}
|
||||||
exporter, err = otlptracehttp.New(setupCtx, opts...)
|
exporter, err = otlptracehttp.New(setupCtx, opts...)
|
||||||
default:
|
default:
|
||||||
return nil, fmt.Errorf("unsupported otel url scheme: %s", u.Scheme)
|
return nil, fmt.Errorf("unsupported otel url scheme: %s", u.Scheme)
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue