Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[core] Add metrics for object size distribution in object store #37005

Merged
merged 2 commits into from
Jul 5, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion src/ray/object_manager/plasma/stats_collector.cc
Original file line number Diff line number Diff line change
Expand Up @@ -35,15 +35,23 @@ void ObjectStatsCollector::OnObjectCreated(const LocalObject &obj) {
if (kSource == plasma::flatbuf::ObjectSource::CreatedByWorker) {
num_objects_created_by_worker_++;
num_bytes_created_by_worker_ += kObjectSize;
ray::stats::STATS_object_store_dist.Record(
kObjectSize, {{ray::stats::SourceKey, "CreatedByWorker"}});
} else if (kSource == plasma::flatbuf::ObjectSource::RestoredFromStorage) {
num_objects_restored_++;
num_bytes_restored_ += kObjectSize;
ray::stats::STATS_object_store_dist.Record(
kObjectSize, {{ray::stats::SourceKey, "RestoredFromStorage"}});
} else if (kSource == plasma::flatbuf::ObjectSource::ReceivedFromRemoteRaylet) {
num_objects_received_++;
num_bytes_received_ += kObjectSize;
ray::stats::STATS_object_store_dist.Record(
kObjectSize, {{ray::stats::SourceKey, "ReceivedFromRemoteRaylet"}});
} else if (kSource == plasma::flatbuf::ObjectSource::ErrorStoredByRaylet) {
num_objects_errored_++;
num_bytes_errored_ += kObjectSize;
ray::stats::STATS_object_store_dist.Record(
kObjectSize, {{ray::stats::SourceKey, "ErrorStoredByRaylet"}});
}

RAY_CHECK(!obj.Sealed());
Expand Down Expand Up @@ -246,4 +254,4 @@ int64_t ObjectStatsCollector::GetNumObjectsUnsealed() const {
return num_objects_unsealed_;
}

} // namespace plasma
} // namespace plasma
19 changes: 19 additions & 0 deletions src/ray/stats/metric_defs.cc
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,25 @@ DEFINE_stats(
(),
ray::stats::GAUGE);

double operator""_MB(unsigned long long int x) {
return static_cast<double>(1024L * 1024L * x);
}

DEFINE_stats(object_store_dist,
"The distribution of object size in bytes",
("Source"),
({32_MB,
64_MB,
128_MB,
256_MB,
512_MB,
1024_MB,
2048_MB,
4096_MB,
8192_MB,
16384_MB}),
ray::stats::HISTOGRAM);

/// Placement group metrics from the GCS.
DEFINE_stats(placement_groups,
"Number of placement groups broken down by state.",
Expand Down
1 change: 1 addition & 0 deletions src/ray/stats/metric_defs.h
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@ DECLARE_stats(gcs_task_manager_task_events_reported);

/// Object Store
DECLARE_stats(object_store_memory);
DECLARE_stats(object_store_dist);

/// Placement Group
DECLARE_stats(gcs_placement_group_creation_latency_ms);
Expand Down
2 changes: 2 additions & 0 deletions src/ray/stats/tag_defs.cc
Original file line number Diff line number Diff line change
Expand Up @@ -47,5 +47,7 @@ const TagKeyType NameKey = TagKeyType::Register("Name");
const TagKeyType LocationKey = TagKeyType::Register("Location");

const TagKeyType ObjectStateKey = TagKeyType::Register("ObjectState");

const TagKeyType SourceKey = TagKeyType::Register("Source");
} // namespace stats
} // namespace ray
2 changes: 2 additions & 0 deletions src/ray/stats/tag_defs.h
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,8 @@ extern const TagKeyType SessionNameKey;

extern const TagKeyType NameKey;

extern const TagKeyType SourceKey;

// Object store memory location tag constants
extern const TagKeyType LocationKey;
constexpr char kObjectLocMmapShm[] = "MMAP_SHM";
Expand Down