net/http.Server

HTTP server implementation.

Wrap http.Server.Handler

Join Point
All of
Advice
Replace the expression using the template:
// Using the following synthetic imports:
import (
	instrument "github.com/DataDog/orchestrion/instrument"
)
//dd:startwrap
instrument.WrapHandler({{.}})
//dd:endwrap

Wrap http.HandlerFunc

Join Point
All of
Advice
Replace the expression using the template:
// Using the following synthetic imports:
import (
	instrument "github.com/DataDog/orchestrion/instrument"
)
instrument.WrapHandlerFunc({{.}})

Report http.HandlerFunc calls

Join Point
All of
Advice
Prepend statements produced by the following template:
// Using the following synthetic imports:
import (
	event "github.com/DataDog/orchestrion/instrument/event"
	instrument "github.com/DataDog/orchestrion/instrument"
)
{{- $arg := .Function.Argument 1 -}}
{{- $name := .Function.Name -}}
{{$arg}} = {{$arg}}.WithContext(instrument.Report(
	{{$arg}}.Context(),
	event.EventStart,
	{{with $name}}"function-name", {{printf "%q" .}},{{end}}
	"span.kind", "server",
	"http.method", {{$arg}}.Method,
	"http.url", {{$arg}}.URL,
	"http.useragent", {{$arg}}.Header.Get("User-Agent"),
	{{ range .DirectiveArgs "dd:span" -}}{{printf "%q, %q,\n" .Key .Value}}{{ end }}
))
defer instrument.Report(
	{{$arg}}.Context(),
	event.EventEnd,
	{{with $name}}"function-name", {{printf "%q" .}},{{end}}
	"span.kind", "server",
	"http.method", {{$arg}}.Method,
	"http.url", {{$arg}}.URL,
	"http.useragent", {{$arg}}.Header.Get("User-Agent"),
	{{ range .DirectiveArgs "dd:span" -}}{{printf "%q, %q," .Key .Value}}{{- end }}
)