MCPcopy Index your code
hub / github.com/docker/docker-agent / Serve

Method Serve

pkg/server/server.go:106–124  ·  view source on GitHub ↗
(ctx context.Context, ln net.Listener)

Source from the content-addressed store, hash-verified

104}
105
106func (s *Server) Serve(ctx context.Context, ln net.Listener) error {
107 // Wrap the Echo handler with otelhttp so the configured W3C
108 // propagator extracts `traceparent` / `tracestate` / `baggage`
109 // from incoming API requests. Without this the API server's
110 // runtime spans (already wired via `WithTracer` in the session
111 // manager) start fresh trace ids per request rather than
112 // chaining onto the calling client's trace.
113 srv := http.Server{
114 Handler: otelhttp.NewHandler(s.e, "agent-api"),
115 ReadHeaderTimeout: 10 * time.Second,
116 }
117
118 if err := srv.Serve(ln); err != nil && ctx.Err() == nil {
119 slog.ErrorContext(ctx, "Failed to start server", "error", err)
120 return err
121 }
122
123 return nil
124}
125
126const maxAPITimeout = 5 * time.Minute
127

Callers 15

StartPprofServerFunction · 0.95
StartHTTPServerFunction · 0.95
TestListen_UnixFunction · 0.95
StartMethod · 0.80
serveFunction · 0.80
RunFunction · 0.80
startServerFunction · 0.80
startServerWithStoreFunction · 0.80
startServerBareFunction · 0.80

Calls 1

ErrMethod · 0.65