@@ -359,15 +359,17 @@ class TPendingFetcher : public NActors::TActorBootstrapped<TPendingFetcher> {
359
359
const TString cloudId = task.sensor_labels ().at (" cloud_id" );
360
360
const TString queryId = task.query_id ().value ();
361
361
const bool isStreaming = task.query_type () == FederatedQuery::QueryContent::STREAMING;
362
- TString queryIdLabel = queryId;
362
+ TString queryIdLabel;
363
+ TString queryNameLabel;
363
364
if (task.automatic ()) {
364
- queryIdLabel = isStreaming ? " streaming" : " automatic " ;
365
+ queryIdLabel = isStreaming ? " streaming" : " analytics " ;
365
366
} else {
366
- if (!isStreaming) {
367
- queryIdLabel = " analytics" ;
368
- } else if (task.query_name ()) {
367
+ if (isStreaming) {
369
368
// todo: sanitize query name
370
- queryIdLabel = task.query_name ();
369
+ queryNameLabel = task.query_name ();
370
+ queryIdLabel = queryId;
371
+ } else {
372
+ queryIdLabel = " manual" ;
371
373
}
372
374
}
373
375
@@ -377,15 +379,31 @@ class TPendingFetcher : public NActors::TActorBootstrapped<TPendingFetcher> {
377
379
if (cloudId && folderId) {
378
380
publicCountersParent = publicCountersParent->GetSubgroup (" cloud_id" , cloudId)->GetSubgroup (" folder_id" , folderId);
379
381
}
380
- queryCounters.PublicCounters = publicCountersParent->GetSubgroup (" query_id" , queryIdLabel);
382
+
383
+ if (queryIdLabel) {
384
+ publicCountersParent = publicCountersParent->GetSubgroup (" query_id" , queryIdLabel);
385
+ }
386
+
387
+ if (queryNameLabel) {
388
+ publicCountersParent = publicCountersParent->GetSubgroup (" query_name" , queryNameLabel);
389
+ }
390
+ queryCounters.PublicCounters = publicCountersParent;
381
391
382
392
auto rootCountersParent = ServiceCounters.RootCounters ;
383
393
std::set<std::pair<TString, TString>> sensorLabels (task.sensor_labels ().begin (), task.sensor_labels ().end ());
384
394
for (const auto & [label, item]: sensorLabels) {
385
395
rootCountersParent = rootCountersParent->GetSubgroup (label, item);
386
396
}
387
397
388
- queryCounters.RootCounters = rootCountersParent->GetSubgroup (" query_id" , queryIdLabel);
398
+ if (queryIdLabel) {
399
+ rootCountersParent = rootCountersParent->GetSubgroup (" query_id" , queryIdLabel);
400
+ }
401
+
402
+ if (queryNameLabel) {
403
+ rootCountersParent = rootCountersParent->GetSubgroup (" query_name" , queryNameLabel);
404
+ }
405
+
406
+ queryCounters.RootCounters = rootCountersParent;
389
407
queryCounters.Counters = queryCounters.RootCounters ;
390
408
391
409
queryCounters.InitUptimeCounter ();
0 commit comments