net/http.Server
HTTP server implementation.
Wrap http.Server.Handler
All of
- Configuration
- httpmode
wrap
- httpmode
- Struct literal
net/http
.Server - Including field
Handler
- Including field
- None of
- Import path
github.com/go-chi/chi/v5
- Import path
github.com/go-chi/chi/v5/middleware
- Import path
golang.org/x/net/http2
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
All of
- Configuration
- httpmode
wrap
- httpmode
- Function declaration
- Function literal expression
- Signature matches
- Arguments
- Return ValuesNone
- None of
- Import path
github.com/go-chi/chi/v5
- Import path
github.com/go-chi/chi/v5/middleware
- Import path
golang.org/x/net/http2
Replace the expression using the template:
// Using the following synthetic imports:
import (
instrument "github.com/datadog/orchestrion/instrument"
)
instrument.WrapHandlerFunc({{.}})
Report http.HandlerFunc calls
All of
- Configuration
- httpmode
report
- httpmode
- Function body
- Function declaration
- Signature matches
- Arguments
- Return ValuesNone
- None of
- Import path
github.com/go-chi/chi/v5
- Import path
github.com/go-chi/chi/v5/middleware
- Import path
golang.org/x/net/http2
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 }}
)