Skip to content

Commit 4b4639b

Browse files
committed
Removed required fields from tracing configs (ydb-platform#1636)
* Removed required protobuf fields * Typo fix * Removed max_burst from required fields * Reverted changed to repeated fields
1 parent 9cb0690 commit 4b4639b

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
@@ -1561,8 +1561,8 @@ message TTracingConfig {
15611561
message TTvmAuth {
15621562
optional string Url = 1;
15631563

1564-
required uint32 SelfTvmId = 2;
1565-
required uint32 TracingTvmId = 3;
1564+
optional uint32 SelfTvmId = 2;
1565+
optional uint32 TracingTvmId = 3;
15661566

15671567
optional string DiskCacheDir = 4;
15681568

@@ -1579,8 +1579,8 @@ message TTracingConfig {
15791579
}
15801580

15811581
message TOpentelemetryBackend {
1582-
required string CollectorUrl = 1;
1583-
required string ServiceName = 2;
1582+
optional string CollectorUrl = 1;
1583+
optional string ServiceName = 2;
15841584
}
15851585

15861586

@@ -1596,21 +1596,23 @@ message TTracingConfig {
15961596

15971597
message TSamplingScope {
15981598
optional TSelectors Scope = 1;
1599-
required float Fraction = 2;
1600-
required uint32 Level = 3;
1601-
required uint32 MaxRatePerMinute = 4;
1602-
required uint32 MaxBurst = 5;
1599+
optional float Fraction = 2;
1600+
optional uint32 Level = 3;
1601+
optional uint32 MaxRatePerMinute = 4;
1602+
optional uint32 MaxBurst = 5;
16031603
}
16041604

16051605
message TExternalThrottlingScope {
16061606
optional TSelectors Scope = 1;
1607-
required uint32 MaxRatePerMinute = 2;
1608-
required uint32 MaxBurst = 3;
1607+
optional uint32 MaxRatePerMinute = 2;
1608+
optional uint32 MaxBurst = 3;
16091609
}
16101610

1611-
required TBackendConfig Backend = 1;
1612-
repeated TSamplingScope Sampling = 2;
1613-
repeated TExternalThrottlingScope ExternalThrottling = 3;
1611+
reserved 1 to 5;
1612+
1613+
optional TBackendConfig Backend = 6;
1614+
repeated TSamplingScope Sampling = 7;
1615+
repeated TExternalThrottlingScope ExternalThrottling = 8;
16141616
}
16151617

16161618
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)