-
Notifications
You must be signed in to change notification settings - Fork 5.8k
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
[observability] [export-api] Fix Ray Events to support writing events of multiple source types to different files #47143
[observability] [export-api] Fix Ray Events to support writing events of multiple source types to different files #47143
Conversation
Signed-off-by: Nikita Vemuri <[email protected]>
Signed-off-by: Nikita Vemuri <[email protected]>
Signed-off-by: Nikita Vemuri <[email protected]>
Signed-off-by: Nikita Vemuri <[email protected]>
Signed-off-by: Nikita Vemuri <[email protected]>
Signed-off-by: Nikita Vemuri <[email protected]>
src/ray/util/event.cc
Outdated
} | ||
auto event_dir = | ||
std::filesystem::path(log_dir) / std::filesystem::path("events"); | ||
ray::EventManager::Instance().AddReporter( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd like to suggest to have a separate map of reporters for export and non-export case instead of adding if statement to ReportExportEvent
and Report
API
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sounds good, updated
Signed-off-by: Nikita Vemuri <[email protected]>
@@ -189,16 +189,25 @@ void EventManager::Publish(const rpc::Event &event, const json &custom_fields) { | |||
} | |||
|
|||
void EventManager::PublishExportEvent(const rpc::ExportEvent &export_event) { | |||
for (const auto &element : reporter_map_) { | |||
(element.second)->ReportExportEvent(export_event); | |||
auto element = export_log_reporter_map_.find(export_event.source_type()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can you assert this always exist? or is there a case it doesn't?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes, the reporter should always exist in the map
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
btw you can do
RAY_CHECK(export_log_reporter_map_ != export_log_reporter_map_.end());
(element->second)->ReportExportEvent(export_event);
can you handle this in your next PR?
Signed-off-by: Nikita Vemuri <[email protected]>
Why are these changes needed?
Context: Export API events will be written from the same process that could be writing a non export event (eg:
core_worker_process
currently only writesCORE_WORKER
events but will also writeEXPORT_TASK
events). Events of different source types should be written to separate files.Changes in this PR:
RayEventInit
to take a list of source types instead of a single one. This was preferred instead of callingRayEventInit
multiple times because this function can only be called once (in main thread) due toabsl::call_once
.LogEventReporter
for each source typeLogEventReporter::Report
andLogEventReporter::ReportExportEvent
to only write an event to file if the source type matches that of theLogEventReporter
Related issue number
Checks
git commit -s
) in this PR.scripts/format.sh
to lint the changes in this PR.method in Tune, I've added it in
doc/source/tune/api/
under thecorresponding
.rst
file.