Skip to content

Commit c04c65a

Browse files
domwstSammyVimes
authored andcommitted
Removed aborts in service initialization (#1652)
1 parent 0f2e484 commit c04c65a

File tree

3 files changed

+25
-7
lines changed

3 files changed

+25
-7
lines changed

ydb/core/driver_lib/run/kikimr_services_initializers.cpp

+9-3
Original file line numberDiff line numberDiff line change
@@ -832,13 +832,19 @@ void TBasicServicesInitializer::InitializeServices(NActors::TActorSystemSetup* s
832832
std::unique_ptr<NWilson::IGrpcSigner> grpcSigner;
833833
if (tracing_backend.HasAuthConfig() && Factories && Factories->WilsonGrpcSignerFactory) {
834834
grpcSigner = Factories->WilsonGrpcSignerFactory(tracing_backend.GetAuthConfig());
835+
if (!grpcSigner) {
836+
Cerr << "Failed to initialize wilson grpc signer due to misconfiguration. Config provided: "
837+
<< tracing_backend.GetAuthConfig().DebugString() << Endl;
838+
}
835839
}
836840
NActors::IActor* wilsonUploader = nullptr;
837841
switch (tracing_backend.GetBackendCase()) {
838842
case NKikimrConfig::TTracingConfig::TBackendConfig::BackendCase::kOpentelemetry: {
839843
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");
844+
if (!(opentelemetry.HasCollectorUrl() && opentelemetry.HasServiceName())) {
845+
Cerr << "Both collector_url and service_name should be present in opentelemetry backend config" << Endl;
846+
break;
847+
}
842848
wilsonUploader = NWilson::WilsonUploaderParams {
843849
.CollectorUrl = opentelemetry.GetCollectorUrl(),
844850
.ServiceName = opentelemetry.GetServiceName(),
@@ -848,7 +854,7 @@ void TBasicServicesInitializer::InitializeServices(NActors::TActorSystemSetup* s
848854
}
849855

850856
case NKikimrConfig::TTracingConfig::TBackendConfig::BackendCase::BACKEND_NOT_SET: {
851-
Y_ABORT_UNLESS(false, "No backend option was provided in backend config");
857+
Cerr << "No backend option was provided in tracing config" << Endl;
852858
break;
853859
}
854860
}

ydb/core/tx/datashard/export_common.h

+1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
#include "datashard_user_table.h"
44

55
#include <ydb/core/protos/flat_scheme_op.pb.h>
6+
#include <ydb/library/actors/core/log.h>
67

78
#include <util/generic/map.h>
89
#include <util/generic/maybe.h>

ydb/library/actors/wilson/wilson_uploader.cpp

+15-4
Original file line numberDiff line numberDiff line change
@@ -65,13 +65,20 @@ namespace NWilson {
6565
static constexpr char ActorName[] = "WILSON_UPLOADER_ACTOR";
6666

6767
void Bootstrap() {
68-
Become(&TThis::StateFunc);
68+
Become(&TThis::StateWork);
6969

7070
TStringBuf scheme;
7171
TStringBuf host;
7272
ui16 port;
73-
GetSchemeHostAndPort(CollectorUrl, scheme, host, port);
74-
Y_ABORT_UNLESS(scheme == "grpc://" || scheme == "grpcs://", "Only grpc and grpcs schemes are supported for traces collector");
73+
if (!TryGetSchemeHostAndPort(CollectorUrl, scheme, host, port)) {
74+
LOG_ERROR_S(*TlsActivationContext, WILSON_SERVICE_ID, "Failed to parse collector url (" << CollectorUrl << " was provided). Wilson wouldn't work");
75+
Become(&TThis::StateBroken);
76+
return;
77+
} else if (scheme != "grpc://" && scheme != "grpcs://") {
78+
LOG_ERROR_S(*TlsActivationContext, WILSON_SERVICE_ID, "Wrong scheme provided: " << scheme << " (only grpc:// and grpcs:// are supported). Wilson wouldn't work");
79+
Become(&TThis::StateBroken);
80+
return;
81+
}
7582
Channel = grpc::CreateChannel(TStringBuilder() << host << ":" << port,
7683
scheme == "grpcs://" ? grpc::SslCredentials({}) : grpc::InsecureChannelCredentials());
7784
Stub = NServiceProto::TraceService::NewStub(Channel);
@@ -189,10 +196,14 @@ namespace NWilson {
189196
TryToSend();
190197
}
191198

192-
STRICT_STFUNC(StateFunc,
199+
STRICT_STFUNC(StateWork,
193200
hFunc(TEvWilson, Handle);
194201
cFunc(TEvents::TSystem::Wakeup, HandleWakeup);
195202
);
203+
204+
STRICT_STFUNC(StateBroken,
205+
IgnoreFunc(TEvWilson);
206+
);
196207
};
197208

198209
} // anonymous

0 commit comments

Comments
 (0)