mirror of
https://github.com/argoproj/argo-cd
synced 2026-05-24 09:50:08 +00:00
feat: support disabling grpc histogram (#4075)
This commit is contained in:
parent
c99ddc46bb
commit
cea3c19d62
1 changed files with 7 additions and 3 deletions
|
|
@ -101,6 +101,7 @@ import (
|
|||
|
||||
const maxConcurrentLoginRequestsCountEnv = "ARGOCD_MAX_CONCURRENT_LOGIN_REQUESTS_COUNT"
|
||||
const replicasCountEnv = "ARGOCD_API_SERVER_REPLICAS"
|
||||
const enableGRPCTimeHistogramEnv = "ARGOCD_ENABLE_GRPC_TIME_HISTOGRAM"
|
||||
|
||||
// ErrNoSession indicates no auth token was supplied as part of a request
|
||||
var ErrNoSession = status.Errorf(codes.Unauthenticated, "no session information")
|
||||
|
|
@ -124,8 +125,8 @@ var (
|
|||
baseHRefRegex = regexp.MustCompile(`<base href="(.*)">`)
|
||||
// limits number of concurrent login requests to prevent password brute forcing. If set to 0 then no limit is enforced.
|
||||
maxConcurrentLoginRequestsCount = 50
|
||||
|
||||
replicasCount = 1
|
||||
replicasCount = 1
|
||||
enableGRPCTimeHistogram = true
|
||||
)
|
||||
|
||||
func init() {
|
||||
|
|
@ -134,6 +135,7 @@ func init() {
|
|||
if replicasCount > 0 {
|
||||
maxConcurrentLoginRequestsCount = maxConcurrentLoginRequestsCount / replicasCount
|
||||
}
|
||||
enableGRPCTimeHistogram = os.Getenv(enableGRPCTimeHistogramEnv) != "false"
|
||||
}
|
||||
|
||||
// ArgoCDServer is the API server for Argo CD
|
||||
|
|
@ -454,7 +456,9 @@ func (a *ArgoCDServer) useTLS() bool {
|
|||
}
|
||||
|
||||
func (a *ArgoCDServer) newGRPCServer() *grpc.Server {
|
||||
grpc_prometheus.EnableHandlingTimeHistogram()
|
||||
if enableGRPCTimeHistogram {
|
||||
grpc_prometheus.EnableHandlingTimeHistogram()
|
||||
}
|
||||
|
||||
sOpts := []grpc.ServerOption{
|
||||
// Set the both send and receive the bytes limit to be 100MB
|
||||
|
|
|
|||
Loading…
Reference in a new issue