-
Notifications
You must be signed in to change notification settings - Fork 68
[AL-4149] Validate metric names against reserved names #770
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
Conversation
labelbox/data/metrics/iou/iou.py
Outdated
| continue | ||
| metrics.append( | ||
| ScalarMetric(metric_name="iou", feature_name=key, value=value)) | ||
| ScalarMetric(metric_name="custom_iou", feature_name=key, value=value)) |
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.
as we agreed in Slack discussion, we rename these to custom_iou
| if name.lower().strip() in RESERVED_METRIC_NAMES: | ||
| raise ValueError(f"`{clean_name}` is a reserved metric name. " | ||
| "Please provide another value for `metric_name`.") | ||
| return clean_name |
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 think we shouldn't force all lowercase, it's just for validation purpose
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 think we should be consistent, if we're validating against lower-cased value then we should store it that way as well
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.
but on the other hand it will break existing metrics, yeah 🤔
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 say validating against lower-cased metric name feels weird, we should just trim it
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.
@msokoloff1 @kozikkamil wdyt?
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.
alright, I think that's not so important
now we return the source name as it's currently in prod version 👌
| @validator('metric_name') | ||
| def validate_metric_name(cls, name: str): | ||
| clean_name = name.lower().strip() | ||
| if name.lower().strip() in RESERVED_METRIC_NAMES: |
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.
super nit, might want to change name.lower().strip() to clean_name
Validate metric names against the list of reserved ones