aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorOleg Shatov <olegsh@ydb.tech>2024-02-14 18:21:27 +0100
committerGitHub <noreply@github.com>2024-02-14 18:21:27 +0100
commitd309cdfea63f56d86a5f9548e7ae48b99f559a4b (patch)
tree82ae6f3f2fed3083163b8beb172fc7f818cd8dec
parentb4c4f2749c1a25508deec0a25a343ee434b649d0 (diff)
downloadydb-d309cdfea63f56d86a5f9548e7ae48b99f559a4b.tar.gz
Fixed several issues in tracing configuration in static.py (#1952)
-rw-r--r--ydb/tools/cfg/static.py14
1 files changed, 7 insertions, 7 deletions
diff --git a/ydb/tools/cfg/static.py b/ydb/tools/cfg/static.py
index b002866ebb1..3211d0beccf 100644
--- a/ydb/tools/cfg/static.py
+++ b/ydb/tools/cfg/static.py
@@ -114,8 +114,8 @@ class StaticConfigGenerator(object):
)
)
self._enable_cms_config_cache = template.get("enable_cms_config_cache", enable_cms_config_cache)
- if "tracing_config" in template:
- tracing = template["tracing_config"]
+ tracing = template.get("tracing_config")
+ if tracing is not None:
self.__tracing = (
tracing["backend"],
tracing.get("sampling", []),
@@ -1131,7 +1131,7 @@ class StaticConfigGenerator(object):
sampling_scope_pb.Fraction = sampling['fraction']
sampling_scope_pb.Level = sampling['level']
sampling_scope_pb.MaxRatePerMinute = sampling['max_rate_per_minute']
- sampling_scope_pb.MaxBurst = sampling['max_burst']
+ sampling_scope_pb.MaxBurst = sampling.get('max_burst', 0)
return sampling_scope_pb
def get_external_throttling(throttling):
@@ -1139,8 +1139,8 @@ class StaticConfigGenerator(object):
selectors = throttling.get("scope")
if selectors is not None:
throttling_scope_pb.Scope.CopyFrom(get_selectors(selectors))
- throttling_scope_pb.MaxRatePerMinute = throttling_scope_pb['max_rate_per_minute']
- throttling_scope_pb.MaxBurst = throttling_scope_pb['max_burst']
+ throttling_scope_pb.MaxRatePerMinute = throttling['max_rate_per_minute']
+ throttling_scope_pb.MaxBurst = throttling.get('max_burst', 0)
return throttling_scope_pb
def get_auth_config(auth):
@@ -1201,10 +1201,10 @@ class StaticConfigGenerator(object):
tracing_pb.Backend.CopyFrom(get_backend(backend))
for sampling_scope in sampling:
- tracing_pb.Sampling.Add().CopyFrom(get_sampling_scope(sampling))
+ tracing_pb.Sampling.append(get_sampling_scope(sampling_scope))
for throttling_scope in external_throttling:
- tracing_pb.ExternalThrottling.Add().CopyFrom(get_external_throttling(throttling_scope))
+ tracing_pb.ExternalThrottling.append(get_external_throttling(throttling_scope))
self.__proto_configs["tracing.txt"] = pb