fix(controlplane): restore OTel server spans for gRPC and HTTP

Draft
JA
1mo ago
+237-10

Closes #3448

With OpenTelemetry tracing enabled, control plane traces rooted at application middleware spans instead of at a transport-level server span, for both entrypoints.

gRPC: the OTel stats handler was silently dropped whenever server.grpc.max_recv_msg_size was configured. Kratos' grpc.Options assigns its option slice rather than appending to it, so the second call overwrote the first. Both raw options now travel in a single grpc.Options call. This also covers grpc-web, which re-dispatches through grpc.Server.ServeHTTP.

HTTP: the transport had no instrumentation at all, so transcoded requests produced no server span and no traceparent extraction. Kratos' tracing.Server() middleware now heads the HTTP-only middleware chain. It is deliberately not added to the shared chain, which would duplicate the gRPC stats-handler span.

The tracer provider is now passed explicitly through the server Opts instead of being picked up from the OTel global.

AI disclosure: this change was produced with the assistance of Claude Code.