Compare commits

..

2 commits

Author SHA1 Message Date
nquidox
77c626a7c3 exclude metrics req from log
All checks were successful
/ Make image (push) Successful in 48s
2026-03-01 00:06:19 +03:00
nquidox
d90682e183 pprof env 2026-03-01 00:05:55 +03:00
4 changed files with 10 additions and 1 deletions

View file

@ -21,7 +21,7 @@ func main() {
logging.LogSetup(c.LogLevel)
if c.Metrics.GinMode != "release" {
if c.PprofEnabled {
go func() {
log.Println(http.ListenAndServe("localhost:6060", nil))
}()

View file

@ -2,6 +2,7 @@ APP_LOG_LEVEL=error
APP_NUMCPUS=-1
APP_CHECK_PERIOD=6
EXTERNAL_BROWSER=
PPROF_ENABLED=false
GRPC_SERVER_HOST=0.0.0.0
GRPC_SERVER_PORT=9060

View file

@ -7,6 +7,7 @@ import (
)
type Config struct {
PprofEnabled bool
LogLevel string
NumCPUs int
CheckPeriod int
@ -46,6 +47,7 @@ type MetricsConfig struct {
func NewConfig() *Config {
return &Config{
PprofEnabled: getEnvBool("PPROF_ENABLED", true),
LogLevel: getEnv("APP_LOG_LEVEL", "debug"),
NumCPUs: getEnvInt("APP_NUMCPUS", -1),
CheckPeriod: getEnvInt("APP_CHECK_PERIOD", 6),

View file

@ -37,6 +37,12 @@ func NewHandler(deps Deps) *Handler {
p := ginprometheus.NewPrometheus("gin")
p.Use(engine)
engine.Use(gin.LoggerWithConfig(gin.LoggerConfig{
Skip: func(c *gin.Context) bool {
return c.Request.URL.Path == "/metrics"
},
}))
srv := http.Server{
Addr: deps.Addr,
Handler: engine,