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

[observability] [export-api] Fix Ray Events to support writing events of multiple source types to different files #47143

Merged

Conversation

nikitavemuri
Copy link
Contributor

@nikitavemuri nikitavemuri commented Aug 14, 2024

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 writes CORE_WORKER events but will also write EXPORT_TASK events). Events of different source types should be written to separate files.

Changes in this PR:

  • Update RayEventInit to take a list of source types instead of a single one. This was preferred instead of calling RayEventInit multiple times because this function can only be called once (in main thread) due to absl::call_once.
    • Initialize a LogEventReporter for each source type
  • Update LogEventReporter::Report and LogEventReporter::ReportExportEvent to only write an event to file if the source type matches that of the LogEventReporter

Related issue number

Checks

  • I've signed off every commit(by using the -s flag, i.e., git commit -s) in this PR.
  • 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 :(

Nikita Vemuri added 5 commits August 14, 2024 14:29
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]>
@nikitavemuri nikitavemuri added the go add ONLY when ready to merge, run all tests label Aug 14, 2024
@nikitavemuri nikitavemuri marked this pull request as ready for review August 14, 2024 22:37
@nikitavemuri nikitavemuri requested a review from a team as a code owner August 14, 2024 22:37
Signed-off-by: Nikita Vemuri <[email protected]>
}
auto event_dir =
std::filesystem::path(log_dir) / std::filesystem::path("events");
ray::EventManager::Instance().AddReporter(
Copy link
Contributor

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

Copy link
Contributor Author

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());
Copy link
Contributor

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?

Copy link
Contributor Author

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

Copy link
Contributor

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]>
@rkooo567 rkooo567 merged commit 2a7efc0 into ray-project:master Aug 16, 2024
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
go add ONLY when ready to merge, run all tests
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants