@@ -38,8 +38,8 @@ using namespace NAuth;
38
38
39
39
// //////////////////////////////////////////////////////////////////////////////
40
40
41
- static const auto & Logger = JaegerLogger;
42
- static const auto & Profiler = TracingProfiler;
41
+ static constexpr auto & Logger = JaegerLogger;
42
+ static constexpr auto & Profiler = TracingProfiler;
43
43
44
44
// //////////////////////////////////////////////////////////////////////////////
45
45
@@ -50,7 +50,8 @@ static const TString TracingServiceAlias = "tracing";
50
50
51
51
void TJaegerTracerDynamicConfig::Register (TRegistrar registrar)
52
52
{
53
- registrar.Parameter (" collector_channel_config" , &TThis::CollectorChannelConfig)
53
+ registrar.Parameter (" collector_channel" , &TThis::CollectorChannel)
54
+ .Alias (" collector_channel_config" )
54
55
.Optional ();
55
56
registrar.Parameter (" max_request_size" , &TThis::MaxRequestSize)
56
57
.Default ();
@@ -110,8 +111,8 @@ TJaegerTracerConfigPtr TJaegerTracerConfig::ApplyDynamic(const TJaegerTracerDyna
110
111
{
111
112
auto config = New<TJaegerTracerConfig>();
112
113
config->CollectorChannelConfig = CollectorChannelConfig;
113
- if (dynamicConfig->CollectorChannelConfig ) {
114
- config->CollectorChannelConfig = dynamicConfig->CollectorChannelConfig ;
114
+ if (dynamicConfig->CollectorChannel ) {
115
+ config->CollectorChannelConfig = dynamicConfig->CollectorChannel ;
115
116
}
116
117
117
118
config->FlushPeriod = dynamicConfig->FlushPeriod .value_or (FlushPeriod);
@@ -231,9 +232,6 @@ std::vector<TK> ExtractKeys(THashMap<TK, TV> const& inputMap) {
231
232
232
233
// //////////////////////////////////////////////////////////////////////////////
233
234
234
- TBatchInfo::TBatchInfo ()
235
- { }
236
-
237
235
TBatchInfo::TBatchInfo (const TString& endpoint)
238
236
: TracesDequeued_(Profiler().WithTag(" endpoint" , endpoint).Counter(" /traces_dequeued" ))
239
237
, TracesDropped_(Profiler().WithTag(" endpoint" , endpoint).Counter(" /traces_dropped" ))
@@ -383,14 +381,14 @@ TInstant TJaegerChannelManager::GetReopenTime()
383
381
}
384
382
385
383
TJaegerTracer::TJaegerTracer (
386
- const TJaegerTracerConfigPtr& config)
384
+ TJaegerTracerConfigPtr config)
387
385
: ActionQueue_(New<TActionQueue>(" Jaeger" ))
388
386
, FlushExecutor_(New<TPeriodicExecutor>(
389
387
ActionQueue_->GetInvoker (),
390
- BIND(&TJaegerTracer::Flush , MakeStrong(this )),
388
+ BIND(&TJaegerTracer::DoFlush , MakeStrong(this )),
391
389
config->FlushPeriod))
392
- , Config_(config)
393
390
, TvmService_(config->TvmService ? CreateTvmService(config->TvmService) : nullptr)
391
+ , Config_(std::move(config))
394
392
{
395
393
Profiler ().AddFuncGauge (" /enabled" , MakeStrong (this ), [this ] {
396
394
return Config_.Acquire ()->IsEnabled ();
@@ -553,18 +551,19 @@ void TJaegerTracer::DropFullQueue()
553
551
}
554
552
}
555
553
556
- void TJaegerTracer::Flush ()
554
+ void TJaegerTracer::DoFlush ()
557
555
{
558
556
YT_LOG_DEBUG (" Started span flush" );
559
557
558
+
560
559
auto config = Config_.Acquire ();
561
560
562
561
auto flushStartTime = TInstant::Now ();
563
562
564
563
if (OpenChannelConfig_ != config->CollectorChannelConfig ) {
565
564
OpenChannelConfig_ = config->CollectorChannelConfig ;
566
565
for (auto & [endpoint, channel] : CollectorChannels_) {
567
- CollectorChannels_[endpoint]. ForceReset (flushStartTime);
566
+ CollectorChannels_[endpoint]-> ForceReset (flushStartTime);
568
567
}
569
568
}
570
569
@@ -582,20 +581,19 @@ void TJaegerTracer::Flush()
582
581
return ;
583
582
}
584
583
585
- std::stack<TString> toRemove;
586
584
auto keys = ExtractKeys (BatchInfo_);
587
-
588
585
if (keys.empty ()) {
589
586
YT_LOG_DEBUG (" Span batch info is empty" );
590
587
LastSuccessfulFlushTime_ = flushStartTime;
591
588
NotifyEmptyQueue ();
592
589
return ;
593
590
}
594
591
592
+ std::stack<TString> toRemove;
595
593
for (const auto & endpoint : keys) {
596
594
auto [batches, batchCount, spanCount] = PeekQueue (config, endpoint);
597
595
if (batchCount <= 0 ) {
598
- if (!CollectorChannels_.contains (endpoint) || flushStartTime > CollectorChannels_[endpoint]. GetReopenTime () + config->EndpointChannelTimeout ) {
596
+ if (!CollectorChannels_.contains (endpoint) || flushStartTime > CollectorChannels_[endpoint]-> GetReopenTime () + config->EndpointChannelTimeout ) {
599
597
toRemove.push (endpoint);
600
598
}
601
599
YT_LOG_DEBUG (" Span queue is empty (Endpoint: %v)" , endpoint);
@@ -614,16 +612,16 @@ void TJaegerTracer::Flush()
614
612
615
613
auto it = CollectorChannels_.find (endpoint);
616
614
if (it == CollectorChannels_.end ()) {
617
- it = CollectorChannels_.emplace (endpoint, TJaegerChannelManager (config, endpoint, TvmService_)).first ;
615
+ it = CollectorChannels_.emplace (endpoint, New< TJaegerChannelManager> (config, endpoint, TvmService_)).first ;
618
616
}
619
617
620
618
auto & channel = it->second ;
621
619
622
- if (channel. NeedsReopen (flushStartTime)) {
623
- channel = TJaegerChannelManager (config, endpoint, TvmService_);
620
+ if (channel-> NeedsReopen (flushStartTime)) {
621
+ channel = New< TJaegerChannelManager> (config, endpoint, TvmService_);
624
622
}
625
623
626
- if (channel. Push (batches, spanCount)) {
624
+ if (channel-> Push (batches, spanCount)) {
627
625
DropQueue (batchCount, endpoint);
628
626
YT_LOG_DEBUG (" Spans sent (Endpoint: %v)" , endpoint);
629
627
LastSuccessfulFlushTime_ = flushStartTime;
0 commit comments