Skip to content

Commit

Permalink
separate callhome UnsupportedFeature for each extension in assess-mig…
Browse files Browse the repository at this point in the history
…ration (#2131)

Add extension name to the FeatureName in callhome phase payload of assess-migration to have better categorization.
  • Loading branch information
makalaaneesh authored Jan 6, 2025
1 parent b7f29af commit 26fc27b
Showing 1 changed file with 23 additions and 11 deletions.
34 changes: 23 additions & 11 deletions yb-voyager/cmd/assessMigrationCommand.go
Original file line number Diff line number Diff line change
Expand Up @@ -115,9 +115,7 @@ var assessMigrationCmd = &cobra.Command{
}

// Assessment feature names to send the object names for to callhome
var featuresToSendObjectsToCallhome = []string{
EXTENSION_FEATURE,
}
var featuresToSendObjectsToCallhome = []string{}

func packAndSendAssessMigrationPayload(status string, errMsg string) {
if !shouldSendCallhome() {
Expand Down Expand Up @@ -163,24 +161,38 @@ func packAndSendAssessMigrationPayload(status string, errMsg string) {
return len(constructs)
})

assessPayload := callhome.AssessMigrationPhasePayload{
TargetDBVersion: assessmentReport.TargetDBVersion,
MigrationComplexity: assessmentReport.MigrationComplexity,
UnsupportedFeatures: callhome.MarshalledJsonString(lo.Map(assessmentReport.UnsupportedFeatures, func(feature UnsupportedFeature, _ int) callhome.UnsupportedFeature {
var unsupportedFeatures []callhome.UnsupportedFeature
for _, feature := range assessmentReport.UnsupportedFeatures {
if feature.FeatureName == EXTENSION_FEATURE {
// For extensions, we need to send the extension name in the feature name
// for better categorization in callhome
for _, object := range feature.Objects {
unsupportedFeatures = append(unsupportedFeatures, callhome.UnsupportedFeature{
FeatureName: fmt.Sprintf("%s - %s", feature.FeatureName, object.ObjectName),
ObjectCount: 1,
TotalOccurrences: 1,
})
}
} else {
var objects []string
if slices.Contains(featuresToSendObjectsToCallhome, feature.FeatureName) {
objects = lo.Map(feature.Objects, func(o ObjectInfo, _ int) string {
return o.ObjectName
})
}
res := callhome.UnsupportedFeature{
unsupportedFeatures = append(unsupportedFeatures, callhome.UnsupportedFeature{
FeatureName: feature.FeatureName,
ObjectCount: len(feature.Objects),
Objects: objects,
TotalOccurrences: len(feature.Objects),
}
return res
})),
})
}
}

assessPayload := callhome.AssessMigrationPhasePayload{
TargetDBVersion: assessmentReport.TargetDBVersion,
MigrationComplexity: assessmentReport.MigrationComplexity,
UnsupportedFeatures: callhome.MarshalledJsonString(unsupportedFeatures),
UnsupportedQueryConstructs: callhome.MarshalledJsonString(countByConstructType),
UnsupportedDatatypes: callhome.MarshalledJsonString(unsupportedDatatypesList),
MigrationCaveats: callhome.MarshalledJsonString(lo.Map(assessmentReport.MigrationCaveats, func(feature UnsupportedFeature, _ int) callhome.UnsupportedFeature {
Expand Down

0 comments on commit 26fc27b

Please sign in to comment.