Documentation ¶
Index ¶
- Constants
- Variables
- func GetMetricsPath(route string) string
- func GetOptimisticBucketPath(url string, method string) string
- func GetSnowflakeCreatedAt(snowflake string) (time.Time, error)
- func HashCRC64(data string) uint64
- func IsNumericInput(str string) bool
- func IsSnowflake(str string) bool
- func SetLogger(l *logrus.Logger)
- func StartMetrics()
- type QueueChannel
- type QueueItem
- type RequestQueue
Constants ¶
View Source
const ( MajorUnknown = "unk" MajorChannels = "channels" MajorGuilds = "guilds" MajorWebhooks = "webhooks" MajorInvites = "invites" MajorInteractions = "interactions" )
View Source
const EpochDiscord = 1420070400000
View Source
const QueueChannelBufferSize = 200
QueueChannelBufferSize Defines the size of the request channel buffer for each bucket Realistically, this should be as high as possible to prevent blocking sends While blocking sends aren't a problem in itself, they are unordered, meaning in a high load situation, if this number is too low, it would cause requests to fight to send, which messes up the ordering of requests.
Variables ¶
View Source
var ( ErrorCounter = promauto.NewCounter(prometheus.CounterOpts{ Name: "nirn_proxy_error", Help: "The total number of errors when processing requests", }) RequestSummary = prometheus.NewSummaryVec(prometheus.SummaryOpts{ Name: "nirn_proxy_requests", Help: "Request histogram", Objectives: map[float64]float64{0.5: 0.05, 0.9: 0.01, 0.99: 0.001}, }, []string{"method", "status", "route", "clientId"}) )
Functions ¶
func GetMetricsPath ¶
func GetOptimisticBucketPath ¶
func IsNumericInput ¶
func IsSnowflake ¶
func StartMetrics ¶
func StartMetrics()
Types ¶
type QueueChannel ¶
type QueueChannel struct {
// contains filtered or unexported fields
}
type QueueItem ¶
type QueueItem struct { Req *http.Request Res *http.ResponseWriter // contains filtered or unexported fields }
type RequestQueue ¶
func NewRequestQueue ¶
func NewRequestQueue(processor func(item *QueueItem) *http.Response, globalLimit uint) *RequestQueue
Click to show internal directories.
Click to hide internal directories.