Documentation
¶
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func TraceServerMiddleware ¶
func TraceServerMiddleware() echo.MiddlewareFunc
TraceServerMiddleware for Datadog Log Integration, middleware will create span that can be used from context
Example ¶
`go-datadog-lib` provides middleware for the Echo framework for tracing inbound request.
package main
import (
"context"
coopdatadog "github.com/coopnorge/go-datadog-lib/v2"
coopEchoDatadog "github.com/coopnorge/go-datadog-lib/v2/middleware/echo"
"github.com/labstack/echo/v4"
)
// `go-datadog-lib` provides middleware for the Echo framework for tracing
// inbound request.
func main() {
err := run()
if err != nil {
panic(err)
}
}
func run() error {
stop, err := coopdatadog.Start(context.Background())
if err != nil {
panic(err)
}
defer func() {
err := stop()
if err != nil {
panic(err)
}
}()
// ...
echoServer := echo.New()
// Some other configuration
// ...
// Add middleware to extend context for better traceability
echoServer.Use(coopEchoDatadog.TraceServerMiddleware())
return nil
}
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.