trace

package
v4.21.0 Latest Latest
Warning

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

Go to latest
Published: Apr 26, 2024 License: Apache-2.0 Imports: 6 Imported by: 0

README

Trace

This package contains filter for generating traceID (X-Ab-TraceID header field) if there is no X-Ab-TraceID in request header.

Usage

Importing
import "github.com/AccelByte/go-restful-plugins/v4/pkg/trace"
Filter

Filter is restful.FilterFunction for generating traceID (X-Ab-TraceID header field) if there is no X-Ab-TraceID in request header.

Example usage of filter for all endpoints

Simple initialization:

ws := new(restful.WebService)
ws.Filter(trace.Filter())

With option initialization:

ws := new(restful.WebService)
ws.Filter(trace.FilterWithOption(trace.SimpleTraceID))

Supported TraceID Type:

  • SimpleTraceID = "uuid" format
  • TimeBasedTraceID (default) = "requestTime-uuid" format

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Filter

func Filter() restful.FilterFunction

func FilterWithOption added in v4.4.0

func FilterWithOption(traceIDType IDType) restful.FilterFunction

Types

type IDType added in v4.4.0

type IDType string

IDType is the type for trace_id

const (
	TraceIDKey = "X-Ab-TraceID"

	SimpleTraceID    IDType = "Simple"    // format: uuid
	TimeBasedTraceID IDType = "TimeBased" // format: requestTime-uuid
)

Jump to

Keyboard shortcuts

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