util

package
v4.29.0 Latest Latest
Warning

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

Go to latest
Published: Nov 13, 2026 License: Apache-2.0 Imports: 7 Imported by: 0

README

Util

This package utils in go-restful apps.

Usage

Importing
import "github.com/AccelByte/go-restful-plugins/v4/pkg/util"
ExtractDefault

ExtractDefault is default function for extracting attribute for filter event logger. It returns the actor from the IAM JWT claims, the session and flight IDs from the X-Ab-SessionID and x-flight-id headers, and the request's OpenTelemetry trace ID, the same value the access log writes as trace_id. The trace ID is empty when the request has no span and arrived without trace headers; it is never X-Ab-TraceID.

Example event log all endpoints with ExtractDefault
ws := new(restful.WebService)
ws.Filter(event.Log("realm", "serviceName", util.ExtractDefault))

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ExtractDefault

func ExtractDefault(req *restful.Request) (userID string, clientID []string,
	namespace string, traceID string, sessionID string, flightID string,
)

ExtractDefault is default function for extracting attribute for filter event logger. The trace ID is the request's OpenTelemetry trace ID, as in the access log, or "" when there is none.

func MinifyJSON added in v4.4.0

func MinifyJSON(jsonBytes []byte) (string, error)

MinifyJSON is used to compact the json bytes (e.g. removing whitespaces and new lines character)

Types

This section is empty.

Jump to

Keyboard shortcuts

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