Pull request 1947: AG-24320 home: pprof conf
Squashed commit of the following:
commit bc0facffe41e140fab00edeeeca3b69306cf2ceb
Merge: 71e0806ba c0691cab6
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Wed Aug 2 17:34:15 2023 +0300
Merge branch 'master' into pprof-conf
commit 71e0806bac52412cae7cad2748216ece7fbed36f
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Wed Aug 2 08:37:51 2023 +0300
all: docs
commit 6ebb6f9a5f4dbeb753dd470879f2e5ff556ee5f1
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Tue Aug 1 15:56:45 2023 +0300
home: imp code
commit ca084011cddc20f5c0b770ee38f9ac55d62bff24
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Tue Aug 1 13:57:53 2023 +0300
all: docs
commit 1b498a84d6cb8207d350fceb4db64d45dc2aa46d
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Tue Aug 1 13:46:13 2023 +0300
all: docs
commit 0cd76c057e0f3e9e62e5bf38f95080afa830f4ff
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date: Tue Aug 1 13:00:43 2023 +0300
home: pprof conf
This commit is contained in:
committed by
Ainar Garipov
parent
c0691cab6a
commit
5eb3cd0f92
@@ -23,7 +23,7 @@ import (
|
||||
)
|
||||
|
||||
// currentSchemaVersion is the current schema version.
|
||||
const currentSchemaVersion = 24
|
||||
const currentSchemaVersion = 25
|
||||
|
||||
// These aliases are provided for convenience.
|
||||
type (
|
||||
@@ -99,6 +99,7 @@ func upgradeConfigSchema(oldVersion int, diskConf yobj) (err error) {
|
||||
upgradeSchema21to22,
|
||||
upgradeSchema22to23,
|
||||
upgradeSchema23to24,
|
||||
upgradeSchema24to25,
|
||||
}
|
||||
|
||||
n := 0
|
||||
@@ -1380,6 +1381,50 @@ func upgradeSchema23to24(diskConf yobj) (err error) {
|
||||
return nil
|
||||
}
|
||||
|
||||
// upgradeSchema24to25 performs the following changes:
|
||||
//
|
||||
// # BEFORE:
|
||||
// 'debug_pprof': true
|
||||
//
|
||||
// # AFTER:
|
||||
// 'http':
|
||||
// 'pprof':
|
||||
// 'enabled': true
|
||||
// 'port': 6060
|
||||
func upgradeSchema24to25(diskConf yobj) (err error) {
|
||||
log.Printf("Upgrade yaml: 24 to 25")
|
||||
diskConf["schema_version"] = 25
|
||||
|
||||
debugPprofVal, ok := diskConf["debug_pprof"]
|
||||
if !ok {
|
||||
return nil
|
||||
}
|
||||
|
||||
debugPprofEnabled, ok := debugPprofVal.(bool)
|
||||
if !ok {
|
||||
return fmt.Errorf("unexpected type of debug_pprof: %T", debugPprofVal)
|
||||
}
|
||||
|
||||
httpVal, ok := diskConf["http"]
|
||||
if !ok {
|
||||
return nil
|
||||
}
|
||||
|
||||
httpObj, ok := httpVal.(yobj)
|
||||
if !ok {
|
||||
return fmt.Errorf("unexpected type of dns: %T", httpVal)
|
||||
}
|
||||
|
||||
httpObj["pprof"] = yobj{
|
||||
"enabled": debugPprofEnabled,
|
||||
"port": 6060,
|
||||
}
|
||||
|
||||
delete(diskConf, "debug_pprof")
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// moveField gets field value for key from diskConf, and then set this value
|
||||
// in newConf for newKey.
|
||||
func moveField[T any](diskConf, newConf yobj, key, newKey string) (err error) {
|
||||
|
||||
Reference in New Issue
Block a user