Skip to content

Commit 39faf6e

Browse files
committed
Profile events for task distribution in ObjectStorageCluster requests
1 parent 923825b commit 39faf6e

File tree

3 files changed

+19
-0
lines changed

3 files changed

+19
-0
lines changed

src/Common/ProfileEvents.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1159,6 +1159,11 @@ The server successfully detected this situation and will download merged part fr
11591159
M(ObjectStorageListObjectsCachePrefixMatchHits, "Number of times object storage list objects operation miss the cache using prefix matching.", ValueType::Number) \
11601160
M(ParquetMetaDataCacheHits, "Number of times the read from filesystem cache hit the cache.", ValueType::Number) \
11611161
M(ParquetMetaDataCacheMisses, "Number of times the read from filesystem cache miss the cache.", ValueType::Number) \
1162+
\
1163+
M(ObjectStorageClusterSentToMatchedReplica, "Number of tasks in ObjectStorageCluster request sent on matched replica.", ValueType::Number) \
1164+
M(ObjectStorageClusterSentToNonMatchedReplica, "Number of tasks in ObjectStorageCluster request sent on non-matched replica.", ValueType::Number) \
1165+
M(ObjectStorageClusterProcessedTasks, "Number of processed tasks in ObjectStorageCluster request.", ValueType::Number) \
1166+
M(ObjectStorageClusterWaitingMicroseconds, "Time of waiting for tasks in ObjectStorageCluster request.", ValueType::Microseconds) \
11621167

11631168
#ifdef APPLY_FOR_EXTERNAL_EVENTS
11641169
#define APPLY_FOR_EVENTS(M) APPLY_FOR_BUILTIN_EVENTS(M) APPLY_FOR_EXTERNAL_EVENTS(M)

src/Storages/ObjectStorage/StorageObjectStorageSource.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,8 @@ namespace fs = std::filesystem;
4545
namespace ProfileEvents
4646
{
4747
extern const Event EngineFileLikeReadFiles;
48+
extern const Event ObjectStorageClusterProcessedTasks;
49+
extern const Event ObjectStorageClusterWaitingMicroseconds;
4850
}
4951

5052
namespace CurrentMetrics
@@ -507,6 +509,7 @@ StorageObjectStorageSource::ReaderHolder StorageObjectStorageSource::createReade
507509
/// TODO: Make asyncronous waiting without sleep in thread
508510
/// Now this sleep is on executor node in worker thread
509511
/// Does not block query initiator
512+
ProfileEvents::increment(ProfileEvents::ObjectStorageClusterWaitingMicroseconds, retry_after_us.value());
510513
sleepForMicroseconds(std::min(Poco::Timestamp::TimeDiff(100000ul), retry_after_us.value()));
511514
continue;
512515
}
@@ -519,6 +522,8 @@ StorageObjectStorageSource::ReaderHolder StorageObjectStorageSource::createReade
519522
}
520523
while (not_a_path || (query_settings.skip_empty_files && object_info->metadata->size_bytes == 0));
521524

525+
ProfileEvents::increment(ProfileEvents::ObjectStorageClusterProcessedTasks);
526+
522527
ObjectStoragePtr storage_to_use = object_info->getObjectStorage();
523528
if (!storage_to_use)
524529
storage_to_use = object_storage;

src/Storages/ObjectStorage/StorageObjectStorageStableTaskDistributor.cpp

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,12 @@
33
#include <consistent_hashing.h>
44
#include <optional>
55

6+
namespace ProfileEvents
7+
{
8+
extern const Event ObjectStorageClusterSentToMatchedReplica;
9+
extern const Event ObjectStorageClusterSentToNonMatchedReplica;
10+
};
11+
612
namespace DB
713
{
814

@@ -125,6 +131,7 @@ ObjectInfoPtr StorageObjectStorageStableTaskDistributor::getPreQueuedFile(size_t
125131
number_of_current_replica
126132
);
127133

134+
ProfileEvents::increment(ProfileEvents::ObjectStorageClusterSentToMatchedReplica);
128135
return next_file;
129136
}
130137

@@ -176,6 +183,7 @@ ObjectInfoPtr StorageObjectStorageStableTaskDistributor::getMatchingFileFromIter
176183
file_path, number_of_current_replica
177184
);
178185

186+
ProfileEvents::increment(ProfileEvents::ObjectStorageClusterSentToMatchedReplica);
179187
return object_info;
180188
}
181189
LOG_TEST(
@@ -229,6 +237,7 @@ ObjectInfoPtr StorageObjectStorageStableTaskDistributor::getAnyUnprocessedFile(s
229237
number_of_current_replica
230238
);
231239

240+
ProfileEvents::increment(ProfileEvents::ObjectStorageClusterSentToNonMatchedReplica);
232241
return next_file;
233242
}
234243

0 commit comments

Comments
 (0)