Skip to content

[core] Cleanup metrics stuff + fix gcc >10 build#56514

Merged
edoakes merged 7 commits intoray-project:masterfrom
dayshah:fix-build+metrics
Sep 18, 2025
Merged

[core] Cleanup metrics stuff + fix gcc >10 build#56514
edoakes merged 7 commits intoray-project:masterfrom
dayshah:fix-build+metrics

Conversation

@dayshah
Copy link
Copy Markdown
Contributor

@dayshah dayshah commented Sep 14, 2025

Why are these changes needed?

Fixing the build for my gcc devbox, was struggling to disambiguate between map with string_view vs. map with string. Changed Record to always take string_view. The string overload is only used in Cython so just have a separate RecordForCython that's not part of the MetricInterface. We can't use string_view in Cython because our Cython version isn't new enough.

Also killing tag_defs.cc, it just had one line tag registrations that could go in the headers. There were some tags that were unused so killed them.
There were also some string constants that could just be put in the one spot they were used so the files that use it don't need the dependency.

The biggest change is changing the record to take a vector of pairs instead of an unordered map. We didn't use the map aspect of it, so a vector is more efficient.

Record was also taking by const ref before and then trying to move, so the move wasn't actually happening. Taking by value now so that it actually moves.

Signed-off-by: dayshah <dhyey2019@gmail.com>
@dayshah dayshah added the go add ONLY when ready to merge, run all tests label Sep 14, 2025
Signed-off-by: dayshah <dhyey2019@gmail.com>
@dayshah dayshah marked this pull request as ready for review September 14, 2025 18:14
@dayshah dayshah requested review from a team, SongGuyang, kfstorm and raulchen as code owners September 14, 2025 18:14
@ray-gardener ray-gardener bot added the core Issues that should be addressed in Ray Core label Sep 14, 2025
Signed-off-by: dayshah <dhyey2019@gmail.com>
Signed-off-by: dayshah <dhyey2019@gmail.com>
@edoakes
Copy link
Copy Markdown
Collaborator

edoakes commented Sep 15, 2025

@can-anyscale PTAL

@can-anyscale can-anyscale self-requested a review September 15, 2025 20:16
Copy link
Copy Markdown
Contributor

@can-anyscale can-anyscale left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm; just a question on the c++ apis

/// \param[in] value The value that we record.
/// \param[in] tags The map tag values that we want to record
void Observe(double value, const std::unordered_map<std::string, std::string> &Tags);
void Observe(double value,
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oh i actually wasn't aware of these APIs; are they our internal API or user facing APIs? If the later can we actually change the signatures?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ya I was wondering this too, it looks user facing @jjyao on if we can change?

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think these are technically public APIs

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

kk, I guess we can remove the changes of cpp/include in this PR, or communicate the deprecation plan publicly etc. then it is good to merge

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

updated to just revert the cpp api back, just turning into a string vector at the end before calling into core. We're killing a copy on the core side so even though we're adding a cheaper copy (bc string_views), it's still an improvement.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sg that's what I would've suggested

const std::vector<std::string> &tag_keys = {});

virtual ~Metric();
~Metric() override;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

qq, that is the effect of this change?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No functional change but only the base class needs the destructor to be virtual and the base class is MetricInterface now, everything else is overriding

Signed-off-by: dayshah <dhyey2019@gmail.com>
Signed-off-by: dayshah <dhyey2019@gmail.com>
Signed-off-by: dayshah <dhyey2019@gmail.com>
@edoakes edoakes merged commit 2330b62 into ray-project:master Sep 18, 2025
5 checks passed
@dayshah dayshah deleted the fix-build+metrics branch September 18, 2025 15:45
israbbani added a commit that referenced this pull request Sep 23, 2025
zma2 pushed a commit to zma2/ray that referenced this pull request Sep 23, 2025
## Why are these changes needed?
Fixing the build for my gcc devbox, was struggling to disambiguate
between map with string_view vs. map with string. Changed Record to
always take string_view. The string overload is only used in Cython so
just have a separate RecordForCython that's not part of the
MetricInterface. We can't use string_view in Cython because our Cython
version isn't new enough.

Also killing tag_defs.cc, it just had one line tag registrations that
could go in the headers. There were some tags that were unused so killed
them.
There were also some string constants that could just be put in the one
spot they were used so the files that use it don't need the dependency.

The biggest change is changing the record to take a vector of pairs
instead of an unordered map. We didn't use the map aspect of it, so a
vector is more efficient.

Record was also taking by const ref before and then trying to move, so
the move wasn't actually happening. Taking by value now so that it
actually moves.

---------

Signed-off-by: dayshah <dhyey2019@gmail.com>
Signed-off-by: Zhiqiang Ma <zhiqiang.ma@intel.com>
ZacAttack pushed a commit to ZacAttack/ray that referenced this pull request Sep 24, 2025
## Why are these changes needed?
Fixing the build for my gcc devbox, was struggling to disambiguate
between map with string_view vs. map with string. Changed Record to
always take string_view. The string overload is only used in Cython so
just have a separate RecordForCython that's not part of the
MetricInterface. We can't use string_view in Cython because our Cython
version isn't new enough.

Also killing tag_defs.cc, it just had one line tag registrations that
could go in the headers. There were some tags that were unused so killed
them.
There were also some string constants that could just be put in the one
spot they were used so the files that use it don't need the dependency.

The biggest change is changing the record to take a vector of pairs
instead of an unordered map. We didn't use the map aspect of it, so a
vector is more efficient.

Record was also taking by const ref before and then trying to move, so
the move wasn't actually happening. Taking by value now so that it
actually moves.

---------

Signed-off-by: dayshah <dhyey2019@gmail.com>
Signed-off-by: zac <zac@anyscale.com>
elliot-barn pushed a commit that referenced this pull request Sep 24, 2025
## Why are these changes needed?
Fixing the build for my gcc devbox, was struggling to disambiguate
between map with string_view vs. map with string. Changed Record to
always take string_view. The string overload is only used in Cython so
just have a separate RecordForCython that's not part of the
MetricInterface. We can't use string_view in Cython because our Cython
version isn't new enough.

Also killing tag_defs.cc, it just had one line tag registrations that
could go in the headers. There were some tags that were unused so killed
them.
There were also some string constants that could just be put in the one
spot they were used so the files that use it don't need the dependency.

The biggest change is changing the record to take a vector of pairs
instead of an unordered map. We didn't use the map aspect of it, so a
vector is more efficient.

Record was also taking by const ref before and then trying to move, so
the move wasn't actually happening. Taking by value now so that it
actually moves.

---------

Signed-off-by: dayshah <dhyey2019@gmail.com>
Signed-off-by: elliot-barn <elliot.barnwell@anyscale.com>
marcostephan pushed a commit to marcostephan/ray that referenced this pull request Sep 24, 2025
## Why are these changes needed?
Fixing the build for my gcc devbox, was struggling to disambiguate
between map with string_view vs. map with string. Changed Record to
always take string_view. The string overload is only used in Cython so
just have a separate RecordForCython that's not part of the
MetricInterface. We can't use string_view in Cython because our Cython
version isn't new enough.

Also killing tag_defs.cc, it just had one line tag registrations that
could go in the headers. There were some tags that were unused so killed
them.
There were also some string constants that could just be put in the one
spot they were used so the files that use it don't need the dependency.

The biggest change is changing the record to take a vector of pairs
instead of an unordered map. We didn't use the map aspect of it, so a
vector is more efficient.

Record was also taking by const ref before and then trying to move, so
the move wasn't actually happening. Taking by value now so that it
actually moves.

---------

Signed-off-by: dayshah <dhyey2019@gmail.com>
Signed-off-by: Marco Stephan <marco@magic.dev>
dayshah added a commit to dayshah/ray that referenced this pull request Sep 25, 2025
Signed-off-by: dayshah <dhyey2019@gmail.com>
elliot-barn pushed a commit that referenced this pull request Sep 27, 2025
## Why are these changes needed?
Fixing the build for my gcc devbox, was struggling to disambiguate
between map with string_view vs. map with string. Changed Record to
always take string_view. The string overload is only used in Cython so
just have a separate RecordForCython that's not part of the
MetricInterface. We can't use string_view in Cython because our Cython
version isn't new enough.

Also killing tag_defs.cc, it just had one line tag registrations that
could go in the headers. There were some tags that were unused so killed
them.
There were also some string constants that could just be put in the one
spot they were used so the files that use it don't need the dependency.

The biggest change is changing the record to take a vector of pairs
instead of an unordered map. We didn't use the map aspect of it, so a
vector is more efficient.

Record was also taking by const ref before and then trying to move, so
the move wasn't actually happening. Taking by value now so that it
actually moves.

---------

Signed-off-by: dayshah <dhyey2019@gmail.com>
Signed-off-by: elliot-barn <elliot.barnwell@anyscale.com>
edoakes pushed a commit that referenced this pull request Sep 29, 2025
https://buildkite.com/ray-project/postmerge-macos/builds/8257#01997de0-1e13-4954-a370-6255f650ca17
mac c++ / java tests broke after #56514.

Fixing by reverting to have tag_defs.cc define the vars in a separate
file and not just in the header.

Why does this fix it - I have no idea... for some reason the c++ api
dynamic linking madness doesn't like the inlined vars on the mac build
specifically???

---------

Signed-off-by: dayshah <dhyey2019@gmail.com>
dstrodtman pushed a commit that referenced this pull request Oct 6, 2025
## Why are these changes needed?
Fixing the build for my gcc devbox, was struggling to disambiguate
between map with string_view vs. map with string. Changed Record to
always take string_view. The string overload is only used in Cython so
just have a separate RecordForCython that's not part of the
MetricInterface. We can't use string_view in Cython because our Cython
version isn't new enough.

Also killing tag_defs.cc, it just had one line tag registrations that
could go in the headers. There were some tags that were unused so killed
them.
There were also some string constants that could just be put in the one
spot they were used so the files that use it don't need the dependency.

The biggest change is changing the record to take a vector of pairs
instead of an unordered map. We didn't use the map aspect of it, so a
vector is more efficient.

Record was also taking by const ref before and then trying to move, so
the move wasn't actually happening. Taking by value now so that it
actually moves.

---------

Signed-off-by: dayshah <dhyey2019@gmail.com>
Signed-off-by: Douglas Strodtman <douglas@anyscale.com>
dstrodtman pushed a commit that referenced this pull request Oct 6, 2025
https://buildkite.com/ray-project/postmerge-macos/builds/8257#01997de0-1e13-4954-a370-6255f650ca17
mac c++ / java tests broke after #56514.

Fixing by reverting to have tag_defs.cc define the vars in a separate
file and not just in the header.

Why does this fix it - I have no idea... for some reason the c++ api
dynamic linking madness doesn't like the inlined vars on the mac build
specifically???

---------

Signed-off-by: dayshah <dhyey2019@gmail.com>
Signed-off-by: Douglas Strodtman <douglas@anyscale.com>
joshkodi pushed a commit to joshkodi/ray that referenced this pull request Oct 13, 2025
…6915)

https://buildkite.com/ray-project/postmerge-macos/builds/8257#01997de0-1e13-4954-a370-6255f650ca17
mac c++ / java tests broke after ray-project#56514.

Fixing by reverting to have tag_defs.cc define the vars in a separate
file and not just in the header.

Why does this fix it - I have no idea... for some reason the c++ api
dynamic linking madness doesn't like the inlined vars on the mac build
specifically???

---------

Signed-off-by: dayshah <dhyey2019@gmail.com>
Signed-off-by: Josh Kodi <joshkodi@gmail.com>
justinyeh1995 pushed a commit to justinyeh1995/ray that referenced this pull request Oct 20, 2025
## Why are these changes needed?
Fixing the build for my gcc devbox, was struggling to disambiguate
between map with string_view vs. map with string. Changed Record to
always take string_view. The string overload is only used in Cython so
just have a separate RecordForCython that's not part of the
MetricInterface. We can't use string_view in Cython because our Cython
version isn't new enough.

Also killing tag_defs.cc, it just had one line tag registrations that
could go in the headers. There were some tags that were unused so killed
them.
There were also some string constants that could just be put in the one
spot they were used so the files that use it don't need the dependency.

The biggest change is changing the record to take a vector of pairs
instead of an unordered map. We didn't use the map aspect of it, so a
vector is more efficient.

Record was also taking by const ref before and then trying to move, so
the move wasn't actually happening. Taking by value now so that it
actually moves.

---------

Signed-off-by: dayshah <dhyey2019@gmail.com>
justinyeh1995 pushed a commit to justinyeh1995/ray that referenced this pull request Oct 20, 2025
…6915)

https://buildkite.com/ray-project/postmerge-macos/builds/8257#01997de0-1e13-4954-a370-6255f650ca17
mac c++ / java tests broke after ray-project#56514.

Fixing by reverting to have tag_defs.cc define the vars in a separate
file and not just in the header.

Why does this fix it - I have no idea... for some reason the c++ api
dynamic linking madness doesn't like the inlined vars on the mac build
specifically???

---------

Signed-off-by: dayshah <dhyey2019@gmail.com>
landscapepainter pushed a commit to landscapepainter/ray that referenced this pull request Nov 17, 2025
## Why are these changes needed?
Fixing the build for my gcc devbox, was struggling to disambiguate
between map with string_view vs. map with string. Changed Record to
always take string_view. The string overload is only used in Cython so
just have a separate RecordForCython that's not part of the
MetricInterface. We can't use string_view in Cython because our Cython
version isn't new enough.

Also killing tag_defs.cc, it just had one line tag registrations that
could go in the headers. There were some tags that were unused so killed
them.
There were also some string constants that could just be put in the one
spot they were used so the files that use it don't need the dependency.

The biggest change is changing the record to take a vector of pairs
instead of an unordered map. We didn't use the map aspect of it, so a
vector is more efficient.

Record was also taking by const ref before and then trying to move, so
the move wasn't actually happening. Taking by value now so that it
actually moves.

---------

Signed-off-by: dayshah <dhyey2019@gmail.com>
landscapepainter pushed a commit to landscapepainter/ray that referenced this pull request Nov 17, 2025
…6915)

https://buildkite.com/ray-project/postmerge-macos/builds/8257#01997de0-1e13-4954-a370-6255f650ca17
mac c++ / java tests broke after ray-project#56514.

Fixing by reverting to have tag_defs.cc define the vars in a separate
file and not just in the header.

Why does this fix it - I have no idea... for some reason the c++ api
dynamic linking madness doesn't like the inlined vars on the mac build
specifically???

---------

Signed-off-by: dayshah <dhyey2019@gmail.com>
Aydin-ab pushed a commit to Aydin-ab/ray-aydin that referenced this pull request Nov 19, 2025
…6915)

https://buildkite.com/ray-project/postmerge-macos/builds/8257#01997de0-1e13-4954-a370-6255f650ca17
mac c++ / java tests broke after ray-project#56514.

Fixing by reverting to have tag_defs.cc define the vars in a separate
file and not just in the header.

Why does this fix it - I have no idea... for some reason the c++ api
dynamic linking madness doesn't like the inlined vars on the mac build
specifically???

---------

Signed-off-by: dayshah <dhyey2019@gmail.com>
Signed-off-by: Aydin Abiar <aydin@anyscale.com>
Future-Outlier pushed a commit to Future-Outlier/ray that referenced this pull request Dec 7, 2025
## Why are these changes needed?
Fixing the build for my gcc devbox, was struggling to disambiguate
between map with string_view vs. map with string. Changed Record to
always take string_view. The string overload is only used in Cython so
just have a separate RecordForCython that's not part of the
MetricInterface. We can't use string_view in Cython because our Cython
version isn't new enough.

Also killing tag_defs.cc, it just had one line tag registrations that
could go in the headers. There were some tags that were unused so killed
them.
There were also some string constants that could just be put in the one
spot they were used so the files that use it don't need the dependency.

The biggest change is changing the record to take a vector of pairs
instead of an unordered map. We didn't use the map aspect of it, so a
vector is more efficient.

Record was also taking by const ref before and then trying to move, so
the move wasn't actually happening. Taking by value now so that it
actually moves.

---------

Signed-off-by: dayshah <dhyey2019@gmail.com>
Signed-off-by: Future-Outlier <eric901201@gmail.com>
Future-Outlier pushed a commit to Future-Outlier/ray that referenced this pull request Dec 7, 2025
…6915)

https://buildkite.com/ray-project/postmerge-macos/builds/8257#01997de0-1e13-4954-a370-6255f650ca17
mac c++ / java tests broke after ray-project#56514.

Fixing by reverting to have tag_defs.cc define the vars in a separate
file and not just in the header.

Why does this fix it - I have no idea... for some reason the c++ api
dynamic linking madness doesn't like the inlined vars on the mac build
specifically???

---------

Signed-off-by: dayshah <dhyey2019@gmail.com>
Signed-off-by: Future-Outlier <eric901201@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

core Issues that should be addressed in Ray Core go add ONLY when ready to merge, run all tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants