forked from TrueCloudLab/frostfs-s3-gw
[#549] Add tracing attributes
Signed-off-by: Roman Loginov <r.loginov@yadro.com>
This commit is contained in:
parent
31076796ce
commit
368c7d2acd
7 changed files with 75 additions and 13 deletions
|
@ -163,10 +163,11 @@ const ( // Settings.
|
|||
cfgPProfAddress = "pprof.address"
|
||||
|
||||
// Tracing.
|
||||
cfgTracingEnabled = "tracing.enabled"
|
||||
cfgTracingExporter = "tracing.exporter"
|
||||
cfgTracingEndpoint = "tracing.endpoint"
|
||||
cfgTracingTrustedCa = "tracing.trusted_ca"
|
||||
cfgTracingEnabled = "tracing.enabled"
|
||||
cfgTracingExporter = "tracing.exporter"
|
||||
cfgTracingEndpoint = "tracing.endpoint"
|
||||
cfgTracingTrustedCa = "tracing.trusted_ca"
|
||||
cfgTracingAttributes = "tracing.attributes"
|
||||
|
||||
cfgListenDomains = "listen_domains"
|
||||
|
||||
|
@ -779,6 +780,30 @@ func fetchMultinetConfig(v *viper.Viper, logger *zap.Logger) (cfg internalnet.Co
|
|||
return
|
||||
}
|
||||
|
||||
func fetchTracingAttributes(v *viper.Viper) (map[string]string, error) {
|
||||
attributes := make(map[string]string)
|
||||
for i := 0; ; i++ {
|
||||
key := cfgTracingAttributes + "." + strconv.Itoa(i) + "."
|
||||
attrKey := v.GetString(key + "key")
|
||||
attrValue := v.GetString(key + "value")
|
||||
if attrKey == "" {
|
||||
break
|
||||
}
|
||||
|
||||
if _, ok := attributes[attrKey]; ok {
|
||||
return nil, fmt.Errorf("tracing attribute key %s defined more than once", attrKey)
|
||||
}
|
||||
|
||||
if attrValue == "" {
|
||||
return nil, fmt.Errorf("empty tracing attribute value for key %s", attrKey)
|
||||
}
|
||||
|
||||
attributes[attrKey] = attrValue
|
||||
}
|
||||
|
||||
return attributes, nil
|
||||
}
|
||||
|
||||
func newSettings() *viper.Viper {
|
||||
v := viper.New()
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue