options

package
v1.0.21 Latest Latest
Warning

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

Go to latest
Published: Oct 2, 2023 License: MIT Imports: 2 Imported by: 3

Documentation

Index

Constants

View Source
const (
	DefaultSortOption      = "count"
	DefaultFormatOption    = "table"
	DefaultLimitOption     = 5000
	DefaultLocationOption  = "Local"
	DefaultOutputOption    = "all"
	DefaultPaginationLimit = 100
	// ltsv
	DefaultApptimeLabelOption = "apptime"
	DefaultReqtimeLabelOption = "reqtime"
	DefaultStatusLabelOption  = "status"
	DefaultSizeLabelOption    = "size"
	DefaultMethodLabelOption  = "method"
	DefaultUriLabelOption     = "uri"
	DefaultTimeLabelOption    = "time"
	// json
	DefaultUriKeyOption          = "uri"
	DefaultMethodKeyOption       = "method"
	DefaultTimeKeyOption         = "time"
	DefaultResponseTimeKeyOption = "response_time"
	DefaultRequestTimeKeyOption  = "request_time"
	DefaultBodyBytesKeyOption    = "body_bytes"
	DefaultStatusKeyOption       = "status"
	// regexp
	DefaultPatternOption = `^(\S+)\s` +
		`\S+\s+` +
		`(\S+\s+)+` +
		`\[(?P<time>[^]]+)\]\s` +
		`"(?P<method>\S*)\s?` +
		`(?P<uri>(?:[^"]*(?:\\")?)*)\s` +
		`([^"]*)"\s` +
		`(?P<status>\S+)\s` +
		`(?P<body_bytes>\S+)\s` +
		`"((?:[^"]*(?:\\")?)*)"\s` +
		`"(?:.+)"` +
		`\s(?P<response_time>\S+)(?:\s(?P<request_time>\S+))?$`
	DefaultUriSubexpOption          = "uri"
	DefaultMethodSubexpOption       = "method"
	DefaultTimeSubexpOption         = "time"
	DefaultResponseTimeSubexpOption = "response_time"
	DefaultRequestTimeSubexpOption  = "request_time"
	DefaultBodyBytesSubexpOption    = "body_bytes"
	DefaultStatusSubexpOption       = "status"
	// pcap
	DefaultPcapServerPortOption = 80
	// topN
	DefaultTopNSortOption = "restime"
)

Variables

View Source
var DefaultPcapServerIPsOption = getDefaultPcapServerIPsOption()
View Source
var DefaultPercentilesOption = []int{90, 95, 99}

Functions

This section is empty.

Types

type CountOptions added in v1.0.17

type CountOptions struct {
	Keys []string `mapstructure:"keys"`
}

type JSONOptions

type JSONOptions struct {
	UriKey          string `mapstructure:"uri_key"`
	MethodKey       string `mapstructure:"method_key"`
	TimeKey         string `mapstructure:"time_key"`
	ResponseTimeKey string `mapstructure:"response_time_key"`
	RequestTimeKey  string `mapstructure:"request_time_key"`
	BodyBytesKey    string `mapstructure:"body_bytes_key"`
	StatusKey       string `mapstructure:"status_key"`
}

type LTSVOptions

type LTSVOptions struct {
	ApptimeLabel string `mapstructure:"apptime_label"`
	ReqtimeLabel string `mapstructure:"reqtime_label"`
	StatusLabel  string `mapstructure:"status_label"`
	SizeLabel    string `mapstructure:"size_label"`
	MethodLabel  string `mapstructure:"method_label"`
	UriLabel     string `mapstructure:"uri_label"`
	TimeLabel    string `mapstructure:"time_label"`
}

type Option

type Option func(*Options)

func ApptimeLabel

func ApptimeLabel(s string) Option

ltsv

func BodyBytesKey

func BodyBytesKey(s string) Option

func BodyBytesSubexp

func BodyBytesSubexp(s string) Option

func CSVGroups

func CSVGroups(csv string) Option

func CountKeys added in v1.0.17

func CountKeys(ss []string) Option

count

func DecodeUri added in v1.0.6

func DecodeUri(b bool) Option

func Dump added in v1.0.13

func Dump(s string) Option

func File

func File(s string) Option

func Filters

func Filters(s string) Option

func Format

func Format(s string) Option

func Limit

func Limit(i int) Option

func Load added in v1.0.13

func Load(s string) Option

func Location

func Location(s string) Option

func MatchingGroups

func MatchingGroups(values []string) Option

func MethodKey

func MethodKey(s string) Option

func MethodLabel

func MethodLabel(s string) Option

func MethodSubexp

func MethodSubexp(s string) Option

func NoHeaders

func NoHeaders(b bool) Option

func NoSavePos

func NoSavePos(b bool) Option

func Output

func Output(s string) Option

func PaginationLimit added in v1.0.11

func PaginationLimit(i int) Option

func Pattern

func Pattern(s string) Option

regexp

func PcapServerIPs added in v1.0.6

func PcapServerIPs(ss []string) Option

pcap

func PcapServerPort added in v1.0.6

func PcapServerPort(n uint16) Option

func Percentiles added in v1.0.4

func Percentiles(i []int) Option

func PosFile

func PosFile(s string) Option

func QueryString

func QueryString(b bool) Option

func QueryStringIgnoreValues added in v1.0.5

func QueryStringIgnoreValues(b bool) Option

func ReqtimeLabel added in v1.0.1

func ReqtimeLabel(s string) Option

func RequestTimeKey added in v1.0.1

func RequestTimeKey(s string) Option

func RequestTimeSubexp added in v1.0.1

func RequestTimeSubexp(s string) Option

func ResponseTimeKey

func ResponseTimeKey(s string) Option

func ResponseTimeSubexp

func ResponseTimeSubexp(s string) Option

func Reverse

func Reverse(b bool) Option

func ShowFooters

func ShowFooters(b bool) Option

func SizeLabel

func SizeLabel(s string) Option

func Sort

func Sort(s string) Option

func StatusKey

func StatusKey(s string) Option

func StatusLabel

func StatusLabel(s string) Option

func StatusSubexp

func StatusSubexp(s string) Option

func TimeKey

func TimeKey(s string) Option

func TimeLabel

func TimeLabel(s string) Option

func TimeSubexp

func TimeSubexp(s string) Option

func TopNReverse added in v1.0.19

func TopNReverse(b bool) Option

func TopNSort added in v1.0.19

func TopNSort(s string) Option

topN

func UriKey

func UriKey(s string) Option

json

func UriLabel

func UriLabel(s string) Option

func UriSubexp

func UriSubexp(s string) Option

type Options

type Options struct {
	File                    string         `mapstructure:"file"`
	Dump                    string         `mapstructure:"dump"`
	Load                    string         `mapstructure:"load"`
	Sort                    string         `mapstructure:"sort"`
	Reverse                 bool           `mapstructure:"reverse"`
	QueryString             bool           `mapstructure:"query_string"`
	QueryStringIgnoreValues bool           `mapstructure:"query_string_ignore_values"`
	DecodeUri               bool           `mapstructure:"decode_uri"`
	Format                  string         `mapstructure:"format"`
	NoHeaders               bool           `mapstructure:"noheaders"`
	ShowFooters             bool           `mapstructure:"show_footers"`
	Limit                   int            `mapstructure:"limit"`
	MatchingGroups          []string       `mapstructure:"matching_groups"`
	Filters                 string         `mapstructure:"filters"`
	PosFile                 string         `mapstructure:"pos_file"`
	NoSavePos               bool           `mapstructure:"nosave_pos"`
	Location                string         `mapstructure:"location"`
	Output                  string         `mapstructure:"output"`
	Percentiles             []int          `mapstructure:"percentiles"`
	PaginationLimit         int            `mapstructure:"pagination_limit"`
	LTSV                    *LTSVOptions   `mapstructure:"ltsv"`
	Regexp                  *RegexpOptions `mapstructure:"regexp"`
	JSON                    *JSONOptions   `mapstructure:"json"`
	Pcap                    *PcapOptions   `mapstructure:"pcap"`
	Count                   *CountOptions  `mapstructure:"count"`
	TopN                    *TopNOptions   `mapstructure:"topN"`
}

func NewOptions

func NewOptions(opt ...Option) *Options

func SetOptions

func SetOptions(options *Options, opt ...Option) *Options

type PcapOptions added in v1.0.6

type PcapOptions struct {
	ServerIPs  []string `mapstructure:"server_ips"`
	ServerPort uint16   `mapstructure:"server_port"`
}

type RegexpOptions

type RegexpOptions struct {
	Pattern            string `mapstructure:"pattern"`
	UriSubexp          string `mapstructure:"uri_subexp"`
	MethodSubexp       string `mapstructure:"method_subexp"`
	TimeSubexp         string `mapstructure:"time_subexp"`
	ResponseTimeSubexp string `mapstructure:"response_time_subexp"`
	RequestTimeSubexp  string `mapstructure:"request_time_subexp"`
	BodyBytesSubexp    string `mapstructure:"body_bytes_subexp"`
	StatusSubexp       string `mapstructure:"status_subexp"`
}

type TopNOptions added in v1.0.19

type TopNOptions struct {
	Sort    string `mapstructure:"sort"`
	Reverse bool   `mapstructure:"reverse"`
}

Jump to

Keyboard shortcuts

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