Skip to content

Commit 5fc7a0e

Browse files
authored
[core] Add structured logging to experimental mutable object components (#52484)
## Why are these changes needed? To improve log parsing and filtering capabilities by adding structured context to log messages using `WithField()`. This PR addresses the following files in #52468: - src/ray/core_worker/experimental_mutable_object_manager.cc - src/ray/core_worker/experimental_mutable_object_provider.cc (No need to improve after checking) Before: <img width="1047" alt="截圖 2025-04-23 下午4 49 21" src="https://github.com/user-attachments/assets/fb7288a2-d657-482b-a05d-a7d0fe894596" /> After (using `.WithField()`): <img width="1052" alt="截圖 2025-04-23 下午4 38 25" src="https://github.com/user-attachments/assets/17dfa107-8384-4ba0-ae45-3b43b5937eca" /> ## Related issue number Close #52474 ## Checks - [x] I've signed off every commit(by using the -s flag, i.e., `git commit -s`) in this PR. - [x] I've run `scripts/format.sh` to lint the changes in this PR. - [ ] I've included any doc changes needed for https://docs.ray.io/en/master/. - [ ] I've added any new APIs to the API Reference. For example, if I added a method in Tune, I've added it in `doc/source/tune/api/` under the corresponding `.rst` file. - [ ] I've made sure the tests are passing. Note that there might be a few flaky tests, see the recent failures at https://flakey-tests.ray.io/ - Testing Strategy - [ ] Unit tests - [ ] Release tests - [ ] This PR is not tested :( --------- Signed-off-by: chuang0221 <chuangellow@gmail.com>
1 parent 39d3cf7 commit 5fc7a0e

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

src/ray/core_worker/experimental_mutable_object_manager.cc

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,7 @@ void MutableObjectManager::OpenSemaphores(const ObjectID &object_id,
180180
}
181181

182182
void MutableObjectManager::DestroySemaphores(const ObjectID &object_id) {
183-
RAY_LOG(DEBUG) << "Destroy " << object_id;
183+
RAY_LOG(DEBUG).WithField(object_id) << "Destroy";
184184
PlasmaObjectHeader::Semaphores sem{};
185185
if (!GetSemaphores(object_id, sem)) {
186186
return;
@@ -215,7 +215,7 @@ Status MutableObjectManager::WriteAcquire(const ObjectID &object_id,
215215
int64_t num_readers,
216216
std::shared_ptr<Buffer> &data,
217217
int64_t timeout_ms) {
218-
RAY_LOG(DEBUG) << "WriteAcquire " << object_id;
218+
RAY_LOG(DEBUG).WithField(object_id) << "WriteAcquire";
219219
absl::ReaderMutexLock guard(&destructor_lock_);
220220

221221
Channel *channel = GetChannel(object_id);
@@ -261,7 +261,7 @@ Status MutableObjectManager::GetObjectBackingStore(const ObjectID &object_id,
261261
int64_t data_size,
262262
int64_t metadata_size,
263263
std::shared_ptr<Buffer> &data) {
264-
RAY_LOG(DEBUG) << "WriteGetObjectBackingStore " << object_id;
264+
RAY_LOG(DEBUG).WithField(object_id) << "GetObjectBackingStore";
265265
absl::ReaderMutexLock guard(&destructor_lock_);
266266

267267
Channel *channel = GetChannel(object_id);
@@ -277,7 +277,7 @@ Status MutableObjectManager::GetObjectBackingStore(const ObjectID &object_id,
277277
}
278278

279279
Status MutableObjectManager::WriteRelease(const ObjectID &object_id) {
280-
RAY_LOG(DEBUG) << "WriteRelease " << object_id;
280+
RAY_LOG(DEBUG).WithField(object_id) << "WriteRelease";
281281
absl::ReaderMutexLock guard(&destructor_lock_);
282282

283283
Channel *channel = GetChannel(object_id);
@@ -305,7 +305,7 @@ Status MutableObjectManager::ReadAcquire(const ObjectID &object_id,
305305
std::shared_ptr<RayObject> &result,
306306
int64_t timeout_ms)
307307
ABSL_NO_THREAD_SAFETY_ANALYSIS {
308-
RAY_LOG(DEBUG) << "ReadAcquire " << object_id;
308+
RAY_LOG(DEBUG).WithField(object_id) << "ReadAcquire";
309309
absl::ReaderMutexLock guard(&destructor_lock_);
310310

311311
Channel *channel = GetChannel(object_id);
@@ -356,7 +356,7 @@ Status MutableObjectManager::ReadAcquire(const ObjectID &object_id,
356356
check_signals_,
357357
timeout_point);
358358
if (!s.ok()) {
359-
RAY_LOG(DEBUG) << "ReadAcquire error was set, returning " << object_id;
359+
RAY_LOG(DEBUG).WithField(object_id) << "ReadAcquire error was set, returning";
360360
// Failed because the error bit was set on the mutable object.
361361
channel->reading = false;
362362
channel->lock->unlock();
@@ -401,13 +401,13 @@ Status MutableObjectManager::ReadAcquire(const ObjectID &object_id,
401401
std::move(metadata_copy),
402402
std::vector<rpc::ObjectReference>());
403403
}
404-
RAY_LOG(DEBUG) << "ReadAcquire returning buffer " << object_id;
404+
RAY_LOG(DEBUG).WithField(object_id) << "ReadAcquire returning buffer";
405405
return Status::OK();
406406
}
407407

408408
Status MutableObjectManager::ReadRelease(const ObjectID &object_id)
409409
ABSL_NO_THREAD_SAFETY_ANALYSIS {
410-
RAY_LOG(DEBUG) << "ReadRelease " << object_id;
410+
RAY_LOG(DEBUG).WithField(object_id) << "ReadRelease";
411411
absl::ReaderMutexLock guard(&destructor_lock_);
412412

413413
Channel *channel = GetChannel(object_id);
@@ -431,7 +431,7 @@ Status MutableObjectManager::ReadRelease(const ObjectID &object_id)
431431

432432
Status s = object->header->ReadRelease(sem, channel->next_version_to_read);
433433
if (!s.ok()) {
434-
RAY_LOG(DEBUG) << "ReadRelease error was set, returning: " << object_id;
434+
RAY_LOG(DEBUG).WithField(object_id) << "ReadRelease error was set, returning";
435435
// Failed because the error bit was set on the mutable object.
436436
channel->reading = false;
437437
channel->lock->unlock();
@@ -448,7 +448,7 @@ Status MutableObjectManager::ReadRelease(const ObjectID &object_id)
448448
}
449449

450450
Status MutableObjectManager::SetError(const ObjectID &object_id) {
451-
RAY_LOG(DEBUG) << "SetError " << object_id;
451+
RAY_LOG(DEBUG).WithField(object_id) << "SetError";
452452
absl::ReaderMutexLock guard(&destructor_lock_);
453453
if (auto *channel = GetChannel(object_id)) {
454454
return SetErrorInternal(object_id, *channel);

0 commit comments

Comments
 (0)