Skip to content

Commit 06643c0

Browse files
Copilotrootfs
andcommitted
Fix OTLP exporter to connect asynchronously to prevent test panics
Co-authored-by: rootfs <[email protected]>
1 parent 9cde50a commit 06643c0

File tree

1 file changed

+3
-8
lines changed

1 file changed

+3
-8
lines changed

src/semantic-router/pkg/observability/tracing.go

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ import (
1414
sdktrace "go.opentelemetry.io/otel/sdk/trace"
1515
semconv "go.opentelemetry.io/otel/semconv/v1.4.0"
1616
"go.opentelemetry.io/otel/trace"
17-
"google.golang.org/grpc"
1817
"google.golang.org/grpc/credentials/insecure"
1918
)
2019

@@ -123,13 +122,9 @@ func createOTLPExporter(ctx context.Context, cfg TracingConfig) (sdktrace.SpanEx
123122
opts = append(opts, otlptracegrpc.WithTLSCredentials(insecure.NewCredentials()))
124123
}
125124

126-
// Add dial options with timeout
127-
opts = append(opts, otlptracegrpc.WithDialOption(
128-
grpc.WithBlock(),
129-
grpc.FailOnNonTempDialError(true),
130-
))
131-
132-
// Create exporter with timeout context
125+
// Create exporter with timeout context for initialization
126+
// Note: We don't use WithBlock() to allow the exporter to connect asynchronously
127+
// This prevents blocking on startup if the collector is temporarily unavailable
133128
ctxWithTimeout, cancel := context.WithTimeout(ctx, 5*time.Second)
134129
defer cancel()
135130

0 commit comments

Comments
 (0)