signoz/pkg/apiserver/config.go
Nityananda Gohain b544a54c40
fix: logging middleware add excluded routes (#6917)
* fix: logging middleware add excluded routes

* fix: consistant name and update example

* fix: consistant name
2025-01-24 14:43:28 +05:30

54 lines
1.2 KiB
Go

package apiserver
import (
"time"
"go.signoz.io/signoz/pkg/factory"
)
// Config holds the configuration for config.
type Config struct {
Timeout Timeout `mapstructure:"timeout"`
Logging Logging `mapstructure:"logging"`
}
type Timeout struct {
// The default context timeout that can be overridden by the request
Default time.Duration `mapstructure:"default"`
// The maximum allowed context timeout
Max time.Duration `mapstructure:"max"`
// The list of routes that are excluded from the timeout
ExcludedRoutes []string `mapstructure:"excluded_routes"`
}
type Logging struct {
// The list of routes that are excluded from the logging
ExcludedRoutes []string `mapstructure:"excluded_routes"`
}
func NewConfigFactory() factory.ConfigFactory {
return factory.NewConfigFactory(factory.MustNewName("apiserver"), newConfig)
}
func newConfig() factory.Config {
return &Config{
Timeout: Timeout{
Default: 60 * time.Second,
Max: 600 * time.Second,
ExcludedRoutes: []string{
"/api/v1/logs/tail",
"/api/v3/logs/livetail",
},
},
Logging: Logging{
ExcludedRoutes: []string{
"/api/v1/health",
},
},
}
}
func (c Config) Validate() error {
return nil
}