-
Notifications
You must be signed in to change notification settings - Fork 75
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
APP-7267 APP-7269 Fragment versions proto changes #610
base: main
Are you sure you want to change the base?
Conversation
proto/viam/app/v1/app.proto
Outdated
} | ||
|
||
message GetFragmentResponse { | ||
Fragment fragment = 1; | ||
FragmentUsage fragment_usage = 2; | ||
repeated FragmentUsage usages = 2; |
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 this is a breaking change, but i think it should be okay if it's resolved before the list machines using fragment epic is launched
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 the reason we initially did a single item is that we could return a mapping of version usage in the FragmentUsage message. I don't think the Fragment Version Tech Spec prescribes the exact message but we are planning on storing it as a map based on the Fragment Usage Stats Tech Spec.
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.
oh hm, were you thinking something like this? for my understanding, is the primary advantage that it's closer to our DB storage schema?
message FragmentUsageStats {
int32 organizations = 2;
int32 machines = 3;
int32 machines_in_current_org = 4;
}
message FragmentUsage {
string fragment_id = 1;
map<string, FragmentUsageStats> usage = 2;
}
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 there are a few options. Mainly we have to decide what the right balance between returning overall metrics along with version level metrics. I believe we still need to return overall metrics for a few reasons, mainly that the Fragment list page will show overall metrics:
- The way you have it in the PR code now, all metrics are versioned and the only way to get overall metrics (usage across all versions) returned is to put in a key like "all" which isn't necessarily clean.
- What you proposed above but then we have a similar issue with needing to store "all".
- Could do this which has fields for revisions and overall:
message FragmentUsageStats {
int32 organizations = 2;
int32 machines = 3;
int32 machines_in_current_org = 4;
}
message FragmentUsage {
string fragment_id = 1;
FragmentUsageStats fragment_usage = 2;
map<string, FragmentUsageStats> fragment_revision_usage = 3;
}
LMK what you think. We could also change fragment_usage
to overall_usage
to be more clear but the way I wrote it out is not a breaking change.
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.
ah, okay. i didn't realize that we also needed to show overall metrics. this makes sense!
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.
@michaellee1019 i updated to your suggestion. i renamed to overall_usage
because i think it's a breaking change anyway to move the stats out of the original FragmentUsage
message
proto/viam/app/v1/app.proto
Outdated
} | ||
|
||
message GetFragmentResponse { | ||
Fragment fragment = 1; | ||
FragmentUsage fragment_usage = 2; | ||
repeated FragmentUsage usages = 2; |
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 the reason we initially did a single item is that we could return a mapping of version usage in the FragmentUsage message. I don't think the Fragment Version Tech Spec prescribes the exact message but we are planning on storing it as a map based on the Fragment Usage Stats Tech Spec.
proto/viam/app/v1/app.proto
Outdated
repeated FragmentVersion versions = 3; | ||
repeated FragmentTag tags = 4; |
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.
Should these be nested in the Fragment message? Or are you doing this to only return these fields on GetFragment?
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.
good q. looking at other uses of Fragment
, if i nest it in Fragment
the tags will also be returned with:
GetFragmentHistory
ListFragments
CreateFragment
UpdateFragment
do we think we'll want tag info for all of these endpoints? happy to nest if so
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.
Yeah I think for consistency lets put into the Fragment message. The size of the data transmitted is not going to increase that much. We might not use the fields on app.viam.com in some APIs but I think it will be useful for any API customers and prevent having to call Get after List, for example.
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.
moved tags into fragment!
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.
LGTM, but would like ML to sound off so we're aligned with registry language
message FragmentVersion { | ||
string version = 1; |
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.
@michaellee1019 we talked about this in a dev jam before the holidays: you had some thoughts on aligning our language with registry modules. What terms do we use there, and do you have any thoughts about what we should use for fragments?
I remember you mentioning "version", "tag", and "revision" as different terms
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.
Great point, thanks for reminding me. I think here we'd keep the terms "version" and "tag". Whenever we want to combine the two into one field, Such as A) in the robot part config or B) in the metrics storage and protos, we should use the "revision" term. We can come up with a better name too, but something like "version_or_tag" should be avoided I think.
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 thought version was the name for revision_or_tag?
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.
Oops. You are right.
Revision: The fragment is saved and given an auto-incremented revision number
Tag: A string name that is a pointer to a Revision.
Version: A reference to either a Revision number or Tag string.
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.
TLDR: I think the following protos use the right terminology. The rest of the changes can stay as is because the version field is either referencing a revision or a tag:
message FragmentRevision {
string revision = 1;
google.protobuf.Timestamp created_at = 2;
}
message FragmentTag {
string tag = 1;
string revision = 2;
google.protobuf.Timestamp created_at = 3;
google.protobuf.Timestamp updated_at = 4;
}
int32 organizations = 2; | ||
int32 machines = 3; | ||
int32 machines_in_current_org = 4; |
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 forgot this was breaking. But I think we can handle that. I think its better than keeping these fields AND having a separate object for versions
Overview
in
GetFragment
: