session

package
v0.0.0-...-3a545d7 Latest Latest
Warning

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

Go to latest
Published: Dec 21, 2022 License: AGPL-3.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Middleware

func Middleware(opts ...Option) mux.MiddlewareFunc

Middleware injects a JavaScript snippet that establishes a session with the server.

Types

type Config

type Config struct {
	Enable bool   `json:"enable" usage:"enables session tracking and script injection" default:"true"`
	Prefix string `json:"prefix" usage:"configure the prefix to use for recording sessions" default:"/_session" hidden:"true"`
}

Config encapsulates configuration for the session endpoints.

type Handle

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

func Handler

func Handler() *Handle

func (*Handle) ServeHTTP

func (h *Handle) ServeHTTP(w http.ResponseWriter, r *http.Request)

type Measurements

type Measurements struct {
	Timestamp uint64 // seconds
	Metrics   []Metric
}

type Metric

type Metric struct {
	Key   string
	Value any // float, bool, int, ...
}

type Option

type Option func(*opt)

Option provides a way to configure elements of the Middleware.

func Exclusions

func Exclusions(exclusions ...excludes.Exclusion) Option

Exclusions appends the provided rules to the excludes list. Any path that matches an exclusion will not be measured.

func JavaScriptPath

func JavaScriptPath(path string) Option

JavaScriptPath configures the URL for the JS snippet.

type Request

type Request struct {
	ID       string
	FullName string
	Data     []Measurements
}

Jump to

Keyboard shortcuts

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