forked from mtusi2026/mtusi2026lab6
23 lines
744 B
Go
23 lines
744 B
Go
package fiber
|
|
|
|
import (
|
|
"context"
|
|
"time"
|
|
)
|
|
|
|
// HTTPObserver consumes only safe transport metadata and W3C context.
|
|
type HTTPObserver interface {
|
|
// Start begins a server operation and returns its completion callback.
|
|
Start(context.Context, string, string) (context.Context, func(error))
|
|
// Extract restores the upstream W3C parent without baggage.
|
|
Extract(context.Context, string, string) context.Context
|
|
// HTTP observes the completed response using a route template.
|
|
HTTP(context.Context, string, string, int, time.Duration, string)
|
|
}
|
|
|
|
// WithObserver installs optional instrumentation before the HTTP listener starts.
|
|
func (ctrl *Controller) WithObserver(observer HTTPObserver) *Controller {
|
|
ctrl.observer = observer
|
|
return ctrl
|
|
}
|