ResponseTimeBalancer

package module
v1.0.9 Latest Latest
Warning

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

Go to latest
Published: Aug 19, 2024 License: Apache-2.0 Imports: 7 Imported by: 0

README

Configuration examples

Local file provider

Static config
experimental:
  localPlugins:
    rtb_static:
      moduleName: "github.com/ArtemUgrimov/ResponseTimeBalancer"

Dynamic config
http:
  middlewares:
    rtb:
      plugin:
        rtb_static:
          cookiePodIdName: "pod-id"
          additionalCookie: "Path=/"
          responseTimeHeaderName: "Tm"
          responseTimeDiffMsToInvalidate: "30"
          logStart: true
          logCookieFound: false
          logCookieResetToBest: true
          logIdle: false
          logBestUpdate: true

K8s

Chart config
experimental:
  plugins:
    rtb_static:
        moduleName: "github.com/ArtemUgrimov/ResponseTimeBalancer"
        version: "v1.0.9"
Middleware
apiVersion: "traefik.io/v1alpha1"
kind: "Middleware"
metadata:
  name: "rtb"
spec:
  plugin:
    rtb_static:
      cookiePodIdName: "pod-id"
      additionalCookie: "; Path=/"
      responseTimeHeaderName: "Tm"
      responseTimeDiffMsToInvalidate: "30"
      logStart: true
      logCookieFound: false
      logCookieResetToBest: true
      logIdle: false
      logBestUpdate: true

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)

Types

type Config

type Config struct {
	CookiePodIdName        string `json:"cookiePodIdName"`
	AdditionalCookie       string `json:"additionalCookie"`
	ResponseTimeHeaderName string `json:"responseTimeHeaderName"`
	ResponseTimeDiffMs     string `json:"responseTimeDiffMsToInvalidate"`

	LogStart             bool `json:"logStart"`
	LogCookieFound       bool `json:"logCookieFound"`
	LogCookieResetToBest bool `json:"logCookieResetToBest"`
	LogIdle              bool `json:"logIdle"`
	LogBestUpdate        bool `json:"logBestUpdate"`
}

func CreateConfig

func CreateConfig() *Config

type CurrentBestPod added in v1.0.9

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

type Plugin added in v1.0.9

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

func (*Plugin) ServeHTTP added in v1.0.9

func (a *Plugin) 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