Skip to content

Commit 0f2e484

Browse files
domwstSammyVimes
authored andcommitted
Removed required fields from tracing configs (#1636)
* Removed required protobuf fields * Typo fix * Removed max_burst from required fields * Reverted changed to repeated fields
1 parent 53023f1 commit 0f2e484

File tree

5 files changed

+27
-24
lines changed

5 files changed

+27
-24
lines changed

ydb/core/cms/console/jaeger_tracing_configurator.cpp

+2-3
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ TJaegerTracingConfigurator::TJaegerTracingConfigurator(
3838
: TracingConfigurator(std::move(tracingConfigurator))
3939
{
4040
if (auto err = ApplyConfigs(cfg)) {
41-
Cerr << "Failed to apply initial tracing configs: " << *err << Endl;
41+
Y_ABORT_UNLESS(false, "Failed to apply initial tracing configs: %s", err->c_str());
4242
}
4343
}
4444

@@ -65,8 +65,7 @@ void TJaegerTracingConfigurator::Handle(TEvConsole::TEvConfigNotificationRequest
6565

6666
auto resp = MakeHolder<TEvConsole::TEvConfigNotificationResponse>(rec);
6767
LOG_TRACE_S(ctx, NKikimrServices::CMS_CONFIGS,
68-
"TJaegerTracingConfigurator: Send TEvConfigNotificationResponse: "
69-
<< resp->Record.ShortDebugString());
68+
"TJaegerTracingConfigurator: Send TEvConfigNotificationResponse");
7069
ctx.Send(ev->Sender, resp.Release(), 0, ev->Cookie);
7170
}
7271

ydb/core/driver_lib/run/kikimr_services_initializers.cpp

+3-1
Original file line numberDiff line numberDiff line change
@@ -837,6 +837,8 @@ void TBasicServicesInitializer::InitializeServices(NActors::TActorSystemSetup* s
837837
switch (tracing_backend.GetBackendCase()) {
838838
case NKikimrConfig::TTracingConfig::TBackendConfig::BackendCase::kOpentelemetry: {
839839
const auto& opentelemetry = tracing_backend.GetOpentelemetry();
840+
Y_ABORT_UNLESS(opentelemetry.HasCollectorUrl() && opentelemetry.HasServiceName(),
841+
"Both collector_url and service_name should be present in opentelemetry backedn config");
840842
wilsonUploader = NWilson::WilsonUploaderParams {
841843
.CollectorUrl = opentelemetry.GetCollectorUrl(),
842844
.ServiceName = opentelemetry.GetServiceName(),
@@ -846,7 +848,7 @@ void TBasicServicesInitializer::InitializeServices(NActors::TActorSystemSetup* s
846848
}
847849

848850
case NKikimrConfig::TTracingConfig::TBackendConfig::BackendCase::BACKEND_NOT_SET: {
849-
Y_DEBUG_ABORT_UNLESS(false, "No backend option was provided in backend config");
851+
Y_ABORT_UNLESS(false, "No backend option was provided in backend config");
850852
break;
851853
}
852854
}

ydb/core/jaeger_tracing/sampling_throttling_configurator.cpp

+5-5
Original file line numberDiff line numberDiff line change
@@ -27,13 +27,13 @@ TMaybe<TString> TSamplingThrottlingConfigurator::HandleConfigs(const NKikimrConf
2727

2828
if (config.SamplingSize() == 1) {
2929
const auto& samplingConfig = config.GetSampling(0);
30-
if (!(samplingConfig.HasFraction() && samplingConfig.HasLevel() && samplingConfig.HasMaxRatePerMinute() && samplingConfig.HasMaxBurst())) {
31-
return "At least one required field is missing in scope " + samplingConfig.ShortDebugString();
30+
if (!(samplingConfig.HasFraction() && samplingConfig.HasLevel() && samplingConfig.HasMaxRatePerMinute())) {
31+
return "At least one required field (fraction, level, max_rate_per_minute) is missing in scope " + samplingConfig.ShortDebugString();
3232
}
3333
const auto samplingFraction = samplingConfig.GetFraction();
3434

3535
if (samplingFraction < 0 || samplingFraction > 1) {
36-
return "Fraction violates range [0, 1] " + ToString(samplingFraction);
36+
return "Sampling fraction violates range [0, 1] " + ToString(samplingFraction);
3737
}
3838

3939
SamplingPPM.Set(samplingFraction * 1000000);
@@ -44,8 +44,8 @@ TMaybe<TString> TSamplingThrottlingConfigurator::HandleConfigs(const NKikimrConf
4444

4545
if (config.ExternalThrottlingSize()) {
4646
const auto& throttlingConfig = config.externalthrottling(0);
47-
if (!(throttlingConfig.HasMaxRatePerMinute() && throttlingConfig.HasMaxBurst())) {
48-
return "At least one required field is missing in scope " + throttlingConfig.ShortDebugString();
47+
if (!throttlingConfig.HasMaxRatePerMinute()) {
48+
return "max_rate_per_minute is missing in this scope: " + throttlingConfig.ShortDebugString();
4949
}
5050

5151
MaxExternalPerMinute.Set(throttlingConfig.GetMaxRatePerMinute());

ydb/core/protos/config.proto

+15-13
Original file line numberDiff line numberDiff line change
@@ -1610,8 +1610,8 @@ message TTracingConfig {
16101610
message TTvmAuth {
16111611
optional string Url = 1;
16121612

1613-
required uint32 SelfTvmId = 2;
1614-
required uint32 TracingTvmId = 3;
1613+
optional uint32 SelfTvmId = 2;
1614+
optional uint32 TracingTvmId = 3;
16151615

16161616
optional string DiskCacheDir = 4;
16171617

@@ -1628,8 +1628,8 @@ message TTracingConfig {
16281628
}
16291629

16301630
message TOpentelemetryBackend {
1631-
required string CollectorUrl = 1;
1632-
required string ServiceName = 2;
1631+
optional string CollectorUrl = 1;
1632+
optional string ServiceName = 2;
16331633
}
16341634

16351635

@@ -1645,21 +1645,23 @@ message TTracingConfig {
16451645

16461646
message TSamplingScope {
16471647
optional TSelectors Scope = 1;
1648-
required float Fraction = 2;
1649-
required uint32 Level = 3;
1650-
required uint32 MaxRatePerMinute = 4;
1651-
required uint32 MaxBurst = 5;
1648+
optional float Fraction = 2;
1649+
optional uint32 Level = 3;
1650+
optional uint32 MaxRatePerMinute = 4;
1651+
optional uint32 MaxBurst = 5;
16521652
}
16531653

16541654
message TExternalThrottlingScope {
16551655
optional TSelectors Scope = 1;
1656-
required uint32 MaxRatePerMinute = 2;
1657-
required uint32 MaxBurst = 3;
1656+
optional uint32 MaxRatePerMinute = 2;
1657+
optional uint32 MaxBurst = 3;
16581658
}
16591659

1660-
required TBackendConfig Backend = 1;
1661-
repeated TSamplingScope Sampling = 2;
1662-
repeated TExternalThrottlingScope ExternalThrottling = 3;
1660+
reserved 1 to 5;
1661+
1662+
optional TBackendConfig Backend = 6;
1663+
repeated TSamplingScope Sampling = 7;
1664+
repeated TExternalThrottlingScope ExternalThrottling = 8;
16631665
}
16641666

16651667
message TFailureInjectionConfig {

ydb/tools/cfg/validation.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,7 @@
180180
max_rate_per_minute=dict(type="integer", minimum=0),
181181
max_burst=dict(type="integer", minimum=0),
182182
),
183-
required=["fraction", "level", "max_rate_per_minute", "max_burst"],
183+
required=["fraction", "level", "max_rate_per_minute"],
184184
),
185185
),
186186
external_throttling=dict(
@@ -192,7 +192,7 @@
192192
max_rate_per_minute=dict(type="integer", minimum=0),
193193
max_burst=dict(type="integer", minimum=0),
194194
),
195-
required=["max_rate_per_minute", "max_burst"],
195+
required=["max_rate_per_minute"],
196196
),
197197
),
198198
),

0 commit comments

Comments
 (0)