traefik_trace_id

package module
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Aug 23, 2023 License: MIT Imports: 5 Imported by: 0

README

Fork from: https://github.com/trinnylondon/traefik-add-trace-id/

About

This plugin will append a custom header for tracing with a random value if one is not found already in the incoming request.

You can optionally customise this by specifying a custom header name that the plugin will look for in the incoming request (defaults to X-Trace-Id) and you can also specify a custom prefix to be added to that header (defaults to "").

Configuration

Enable the plugin in your Traefik configuration:

experimental:
  Plugins:
    traefik-add-trace-id:
      moduleName: "github.com/JoulK/traefik-trace-id"
      version: "v0.1.1"

Create a Middleware. Note that this plugin does not need any configuration, however, values must be passed in for it to be accepted within Traefik.

---
apiVersion: traefik.containo.us/v1alpha1
kind: Middleware
metadata:
  name: traceid
spec:
  plugin:
    traceid:
      headerPrefix: ''
      headerName: 'X-Trace-Id'

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func New

func New(ctx context.Context, next http.Handler, config *Config, name string) (http.Handler, error)

New created a new TraceIDHeader plugin.

Types

type Config

type Config struct {
	HeaderPrefix string `json:"headerPrefix"`
	HeaderName   string `json:"headerName"`
	Verbose      bool   `json:"verbose"`
}

Config the plugin configuration.

func CreateConfig

func CreateConfig() *Config

CreateConfig creates the default plugin configuration.

type TraceIDHeader

type TraceIDHeader struct {
	// contains filtered or unexported fields
}

TraceIDHeader header if it's missing

func (*TraceIDHeader) ServeHTTP

func (t *TraceIDHeader) ServeHTTP(rw http.ResponseWriter, req *http.Request)

Jump to

Keyboard shortcuts

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