Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@
import com.autotune.utils.KruizeSupportedTypes;
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

Expand Down Expand Up @@ -154,7 +156,10 @@ private ValidationOutputData validatePerformanceProfileData(PerformanceProfile p
SloInfo existingSLOData = existingPerformanceProfile.getSloInfo();
SloInfo newSLOData = performanceProfile.getSloInfo();

if (newSLOData.equals(existingSLOData)) {
ObjectMapper om = new ObjectMapper();
JsonNode existingSLOJson = om.valueToTree(existingSLOData);
JsonNode newSLOJson = om.valueToTree(newSLOData);
if (newSLOJson.equals(existingSLOJson)) {
errorString.append(String.format(AnalyzerErrorConstants.AutotuneObjectErrors.PERF_PROFILE_SLO_ALREADY_UPDATED,
performanceProfile.getName()));
return new ValidationOutputData(false, errorString.toString(), HttpServletResponse.SC_CONFLICT);
Expand Down Expand Up @@ -525,7 +530,7 @@ public ValidationOutputData validateMandatoryMetricProfileFieldsAndData(Performa
}

if (!missingMandatoryFields.isEmpty()) {
errorMsg = errorMsg.concat(String.format("Missing mandatory parameters: %s ", missingMandatoryFields));
errorMsg = errorMsg.concat(String.format("Missing mandatory parameters: %s", missingMandatoryFields));
validationOutputData.setSuccess(false);
validationOutputData.setMessage(errorMsg);
validationOutputData.setErrorCode(HttpServletResponse.SC_BAD_REQUEST);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -126,12 +126,13 @@ protected void doGet(HttpServletRequest req, HttpServletResponse response) throw
response.setStatus(HttpServletResponse.SC_OK);
String gsonStr = "[]";
// Fetch all profiles from the DB
Map<String, PerformanceProfile> performanceProfilesMap = new ConcurrentHashMap<>();
try {
new ExperimentDBService().loadAllPerformanceProfiles(performanceProfilesMap);
} catch (Exception e) {
LOGGER.error("Failed to load saved experiment data: {} ", e.getMessage());
}
if (performanceProfilesMap.size() > 0) {
if (!performanceProfilesMap.isEmpty()) {
Collection<PerformanceProfile> values = performanceProfilesMap.values();
Gson gsonObj = new GsonBuilder()
.disableHtmlEscaping()
Expand Down