echo

package
v2.19.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 16, 2025 License: MIT Imports: 3 Imported by: 0

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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL