mirror of https://github.com/status-im/consul.git
fix rate limiting mapping to be the same between api and struct packages (#17599)
This commit is contained in:
parent
a35cafa728
commit
39d4aaf224
|
@ -119,15 +119,15 @@ const (
|
||||||
OperationCategoryKV OperationCategory = "KV"
|
OperationCategoryKV OperationCategory = "KV"
|
||||||
OperationCategoryPreparedQuery OperationCategory = "PreparedQuery"
|
OperationCategoryPreparedQuery OperationCategory = "PreparedQuery"
|
||||||
OperationCategorySession OperationCategory = "Session"
|
OperationCategorySession OperationCategory = "Session"
|
||||||
OperationCategoryStatus OperationCategory = "Status"
|
OperationCategoryStatus OperationCategory = "Status" // not limited
|
||||||
OperationCategoryTxn OperationCategory = "Txn"
|
OperationCategoryTxn OperationCategory = "Txn"
|
||||||
OperationCategoryAutoConfig OperationCategory = "AutoConfig"
|
OperationCategoryAutoConfig OperationCategory = "AutoConfig"
|
||||||
OperationCategoryFederationState OperationCategory = "FederationState"
|
OperationCategoryFederationState OperationCategory = "FederationState"
|
||||||
OperationCategoryInternal OperationCategory = "Internal"
|
OperationCategoryInternal OperationCategory = "Internal"
|
||||||
OperationCategoryOperator OperationCategory = "Operator"
|
OperationCategoryOperator OperationCategory = "Operator" // not limited
|
||||||
OperationCategoryPeerStream OperationCategory = "PeerStream"
|
OperationCategoryPeerStream OperationCategory = "PeerStream"
|
||||||
OperationCategoryPeering OperationCategory = "Peering"
|
OperationCategoryPeering OperationCategory = "Peering"
|
||||||
OperationCategoryPartition OperationCategory = "Partition"
|
OperationCategoryPartition OperationCategory = "Tenancy"
|
||||||
OperationCategoryDataPlane OperationCategory = "DataPlane"
|
OperationCategoryDataPlane OperationCategory = "DataPlane"
|
||||||
OperationCategoryDNS OperationCategory = "DNS"
|
OperationCategoryDNS OperationCategory = "DNS"
|
||||||
OperationCategorySubscribe OperationCategory = "Subscribe"
|
OperationCategorySubscribe OperationCategory = "Subscribe"
|
||||||
|
|
|
@ -144,4 +144,9 @@ var rpcRateLimitSpecs = map[string]rate.OperationSpec{
|
||||||
|
|
||||||
"Txn.Apply": {Type: rate.OperationTypeWrite, Category: rate.OperationCategoryTxn},
|
"Txn.Apply": {Type: rate.OperationTypeWrite, Category: rate.OperationCategoryTxn},
|
||||||
"Txn.Read": {Type: rate.OperationTypeRead, Category: rate.OperationCategoryTxn},
|
"Txn.Read": {Type: rate.OperationTypeRead, Category: rate.OperationCategoryTxn},
|
||||||
|
|
||||||
|
"Namespace.Write": {Type: rate.OperationTypeWrite, Category: rate.OperationCategoryPartition},
|
||||||
|
"Namespace.Delete": {Type: rate.OperationTypeWrite, Category: rate.OperationCategoryPartition},
|
||||||
|
"Namespace.List": {Type: rate.OperationTypeRead, Category: rate.OperationCategoryPartition},
|
||||||
|
"Namespace.Read": {Type: rate.OperationTypeRead, Category: rate.OperationCategoryPartition},
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,19 +20,29 @@ type RateLimitIPConfigEntry struct {
|
||||||
WriteRate float64
|
WriteRate float64
|
||||||
|
|
||||||
//limits specific to a type of call
|
//limits specific to a type of call
|
||||||
ACL *ReadWriteRatesConfig `json:",omitempty"`
|
ACL *ReadWriteRatesConfig `json:",omitempty"` // OperationCategoryACL OperationCategory = "ACL"
|
||||||
Catalog *ReadWriteRatesConfig `json:",omitempty"`
|
Catalog *ReadWriteRatesConfig `json:",omitempty"` // OperationCategoryCatalog OperationCategory = "Catalog"
|
||||||
ConfigEntry *ReadWriteRatesConfig `json:",omitempty"`
|
ConfigEntry *ReadWriteRatesConfig `json:",omitempty"` // OperationCategoryConfigEntry OperationCategory = "ConfigEntry"
|
||||||
ConnectCA *ReadWriteRatesConfig `json:",omitempty"`
|
ConnectCA *ReadWriteRatesConfig `json:",omitempty"` // OperationCategoryConnectCA OperationCategory = "ConnectCA"
|
||||||
Coordinate *ReadWriteRatesConfig `json:",omitempty"`
|
Coordinate *ReadWriteRatesConfig `json:",omitempty"` // OperationCategoryCoordinate OperationCategory = "Coordinate"
|
||||||
DiscoveryChain *ReadWriteRatesConfig `json:",omitempty"`
|
DiscoveryChain *ReadWriteRatesConfig `json:",omitempty"` // OperationCategoryDiscoveryChain OperationCategory = "DiscoveryChain"
|
||||||
Health *ReadWriteRatesConfig `json:",omitempty"`
|
ServerDiscovery *ReadWriteRatesConfig `json:",omitempty"` // OperationCategoryServerDiscovery OperationCategory = "ServerDiscovery"
|
||||||
Intention *ReadWriteRatesConfig `json:",omitempty"`
|
Health *ReadWriteRatesConfig `json:",omitempty"` // OperationCategoryHealth OperationCategory = "Health"
|
||||||
KV *ReadWriteRatesConfig `json:",omitempty"`
|
Intention *ReadWriteRatesConfig `json:",omitempty"` // OperationCategoryIntention OperationCategory = "Intention"
|
||||||
Tenancy *ReadWriteRatesConfig `json:",omitempty"`
|
KV *ReadWriteRatesConfig `json:",omitempty"` // OperationCategoryKV OperationCategory = "KV"
|
||||||
PreparedQuery *ReadWriteRatesConfig `json:",omitempty"`
|
Tenancy *ReadWriteRatesConfig `json:",omitempty"` // OperationCategoryPartition OperationCategory = "Tenancy"
|
||||||
Session *ReadWriteRatesConfig `json:",omitempty"`
|
PreparedQuery *ReadWriteRatesConfig `json:",omitempty"` // OperationCategoryPreparedQuery OperationCategory = "PreparedQuery"
|
||||||
Txn *ReadWriteRatesConfig `json:",omitempty"`
|
Session *ReadWriteRatesConfig `json:",omitempty"` // OperationCategorySession OperationCategory = "Session"
|
||||||
|
Txn *ReadWriteRatesConfig `json:",omitempty"` // OperationCategoryTxn OperationCategory = "Txn"
|
||||||
|
AutoConfig *ReadWriteRatesConfig `json:",omitempty"` // OperationCategoryAutoConfig OperationCategory = "AutoConfig"
|
||||||
|
FederationState *ReadWriteRatesConfig `json:",omitempty"` // OperationCategoryFederationState OperationCategory = "FederationState"
|
||||||
|
Internal *ReadWriteRatesConfig `json:",omitempty"` // OperationCategoryInternal OperationCategory = "Internal"
|
||||||
|
PeerStream *ReadWriteRatesConfig `json:",omitempty"` // OperationCategoryPeerStream OperationCategory = "PeerStream"
|
||||||
|
Peering *ReadWriteRatesConfig `json:",omitempty"` // OperationCategoryPeering OperationCategory = "Peering"
|
||||||
|
DataPlane *ReadWriteRatesConfig `json:",omitempty"` // OperationCategoryDataPlane OperationCategory = "DataPlane"
|
||||||
|
DNS *ReadWriteRatesConfig `json:",omitempty"` // OperationCategoryDNS OperationCategory = "DNS"
|
||||||
|
Subscribe *ReadWriteRatesConfig `json:",omitempty"` // OperationCategorySubscribe OperationCategory = "Subscribe"
|
||||||
|
Resource *ReadWriteRatesConfig `json:",omitempty"` // OperationCategoryResource OperationCategory = "Resource"
|
||||||
|
|
||||||
// Partition is the partition the config entry is associated with.
|
// Partition is the partition the config entry is associated with.
|
||||||
// Partitioning is a Consul Enterprise feature.
|
// Partitioning is a Consul Enterprise feature.
|
||||||
|
|
Loading…
Reference in New Issue