-
Notifications
You must be signed in to change notification settings - Fork 11
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
Implement versioning for Assess Migration callhome payload #2234
Conversation
4fbd267
to
b0a2b9c
Compare
unsupportedDatatypesList := lo.Map(assessmentReport.UnsupportedDataTypes, func(datatype utils.TableColumnsDataTypes, _ int) string { | ||
return datatype.DataType | ||
}) | ||
explanation, err := buildMigrationComplexityExplanation(source.DBType, assessmentReport, "") |
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.
Why are we building again? It should already be available in the assessment report, right?
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.
the reason is, we will this twice... for json and html reports both, at the time of report generation.
whatever happens later will be stored in the struct's field.
So just to be on safer side i am building it again.
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, right. See, here's another reason why having different values for the same field (depending on report type) is not a good idea. AssessmentReport.MigrationComplexityExplanation
should be properly defined in our struct (without including any html/json specific logic).
- If we want any HTML specific logic, it should be in the template.
- If we want any json-specific logic, it should be in a custom marshaller.
- If we want any callhome specific logic, it should be in the callhome layer (this function)
Pls add a comment here explaining why we're re-building. And let's clean this up soon
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 agree, only limitation which stopped me was that to the template we can pass only one struct.
In the original assessment report struct, i wanted to avoid a new child struct, just for the html report case.
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 I see. It might not be such a bad idea to have a chid struct actually. But alternatively, you could just have all the fields in the struct directly, and then mark them as json:"-" if you don't want them in the json
objects = lo.Map(feature.Objects, func(o ObjectInfo, _ int) string { | ||
return o.ObjectName | ||
}) | ||
for _, sensitiveDescription := range descriptionsIncludingSensitiveInformationToCallhome { |
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.
We had discussed that it does not make sense to send description, right? 🤔
Do we see any value in sending "description"? It just contains a more verbose explanation of the issue type + sensitive object names. It's more for the user, not helpful when collecting data.
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.
no, you remember we discussed that some info in this might be required.
Like column name or object name is not requrid
But object type / datatype like citext etc... can also be there which can be useful..
Although this might not be a good way to send that type of info to callhome.
for _, sensitiveDescription := range descriptionsIncludingSensitiveInformationToCallhome { | ||
if sensitiveDescription == UNSUPPORTED_PG_SYNTAX_ISSUE_REASON && strings.HasPrefix(obfuscatedIssue.Description, sensitiveDescription) { | ||
obfuscatedIssue.Description = sensitiveDescription | ||
} else { | ||
match, err := utils.MatchesFormatString(sensitiveDescription, obfuscatedIssue.Description) | ||
if match { | ||
obfuscatedIssue.Description, err = utils.ObfuscateFormatDetails(sensitiveDescription, obfuscatedIssue.Description, constants.OBFUSCATE_STRING) | ||
} | ||
if err != nil { | ||
log.Errorf("error while matching issue description with sensitive descriptions: %v", err) | ||
obfuscatedIssue.Description = constants.OBFUSCATE_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.
I think we don't need to send the description at all in the assessment issues as the issue.Name/issue.Type
should be sufficient but in the cases this is not sufficient like index on complex datatypes, etc..
we should not worry about sending this currently as we were not sending this before as well and we should separate out issues to have issue.Type/Name
differentiate that.
cc: @makalaaneesh
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.
we did this for analyze as we don't want to regress there with less information but I think here we can go without descriptions 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.
only problem is we won't know have the info like index access method, datatype which is unsupported in the issue... anywhere...
The description after obfuscation of objectname can even act as a key for case like index on complex datatypes 'citext'
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.
Agreed but based on what we had discussed earlier, the solution would be for us to define separate issues (index-not-supported-json, index-not-supported-citext, etc).
Only in cases where that's not possible (for instance, extensions), we could somehow pass that information along (using the TYPE field for example)
Impact: issue.Impact, | ||
ObjectType: issue.ObjectType, | ||
ObjectName: constants.OBFUSCATE_STRING, | ||
SqlStatement: constants.OBFUSCATE_STRING, // TODO(future): we can obfuscate sensitive info in SQL statement |
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 am not sure if that would be easily possible to obfuscate the SQL statement and if there is any need to do that.
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.
will remove SqlStatement field, and keep ObjectName since we need that for extensions case
// object name(i.e. extension name here) might be qualified with schema so just taking the last part | ||
obfuscatedIssue.ObjectName = strings.Split(issue.ObjectName, ".")[len(strings.Split(issue.ObjectName, "."))-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.
generally extension name is not qualified as the CREATE EXTENSION DDL has a separate option for mentioning the schema name and I believe we are not using the schema name.
CREATE EXTENSION IF NOT EXISTS citext WITH SCHEMA public;
DocsLink: issue.DocsLink, | ||
MinimumVersionFixedIn: issue.MinimumVersionFixedIn, |
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.
Maybe we can also skip sending these two as they are static information.
a7360b1
to
c373c2a
Compare
return len(constructs) | ||
}) | ||
// allowing object name for unsupported extension issue type | ||
if issue.Type == UNSUPPORTED_EXTENSION_ISSUE_TYPE { |
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 part of https://yugabyte.atlassian.net/browse/DB-14476, we had decided to create separate items for each extension type. Let's keep that behavior as is. Shall we modify the Type
field to also include the extension 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.
LGTM!
- it starts with 1.0 - with this version we are also sending MigrationComplexityExplanation and assessment issues struct instead of separate fields for each category
…gic for assessment issue descriptions
…load - that required info will be covered in next relase
e8534c7
to
b5b7c5d
Compare
Describe the changes in this pull request
Describe if there are any user-facing changes
Callhome payloads has changed.
So the dashboard queries needs to be updated for the payload version
1.0
(create a ticket for this?)How was this pull request tested?
Manually tests on a local callhome server.
cc @shubham-yb for second round of testing before
Does your PR have changes that can cause upgrade issues?