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

Refactor interface for registering custom label providers #130

Merged

Conversation

patnebe
Copy link
Collaborator

@patnebe patnebe commented Jan 8, 2025

Context

  • The interface for registering custom providers assumes all metadata providers will accept a pid arg. This is not true, especially for providers that return system-level metadata that might be company/deployment/runtime environment specific and not in any way related to the task being profiled.
  • To work around this today, one option is for users have to modify metadata_provider.rs in their fork to add/invoke logic for custom system metadata providers. This is not ideal.
  • A separate interface for registering system-level metadata providers eliminates the need for such code changes.

Changes

  • Rename ThreadSafeMetadataProvider to ThreadSafeTaskMetadataProvider
  • Introduce a new SystemMetadataProvider trait that has a get_metadataaccepts no arguments and returns a vector of labels.
  • Add a new method -- register_system_metadata_providers() -- to the GlobalMetadataProvider struct.

Test Plan

  • Manual testing + Existing Unit tests.

@patnebe patnebe marked this pull request as ready for review January 8, 2025 22:01
@patnebe patnebe requested a review from javierhonduco January 9, 2025 11:44
Copy link
Owner

@javierhonduco javierhonduco left a comment

Choose a reason for hiding this comment

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

Makes sense, thanks for the PR!

@javierhonduco javierhonduco merged commit 8c9f3e5 into javierhonduco:main Jan 10, 2025
4 checks passed
@patnebe patnebe deleted the refactor-label-provider-interface branch January 15, 2025 07:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants