Skip to content
This repository has been archived by the owner on May 3, 2024. It is now read-only.

Commit

Permalink
CORTX-30531: Add sanity summary table from sanity config
Browse files Browse the repository at this point in the history
Signed-off-by: Sampada Petkar <[email protected]>
  • Loading branch information
sampadap03 committed Apr 19, 2022
1 parent 5017f17 commit a4fde29
Show file tree
Hide file tree
Showing 4 changed files with 114 additions and 1 deletion.
33 changes: 32 additions & 1 deletion dashboards/perf-rest/rest_app/sanity.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
import flask
from flask_restx import Resource, Namespace

from . import read_config, validations, sanityapi, schemas
from . import read_config, validations, sanityapi, schemas, global_functions

api = Namespace('Sanity', path="/sanity",
description='Endpoints for sanity operations')
Expand Down Expand Up @@ -264,3 +264,34 @@ def get():

return flask.jsonify({'result': results})
# return flask.Response(status=query_results[1][0], response=query_results[1][1])


@api.route("/config", doc={"description": "Get config of sanity run based on ID from MongoDB."})
@api.response(200, "Success")
@api.response(400, "Bad Request: Missing parameters. Do not retry.")
@api.response(401, "Unauthorized: Wrong db_username/db_password.")
@api.response(403, "Forbidden: User does not have permission for operation.")
@api.response(404, "Not Found: No entry for that query in MongoDB.")
@api.response(503, "Service Unavailable: Unable to connect to mongoDB.")
class sanity_config(Resource):
"""Sanity Config endpoint"""
@staticmethod
def get():
"""Get Config data endpoints from MongoDB for given query."""
request_runid = flask.request.args.get('run_id')
json_data = { "run_id": request_runid }

if not request_runid:
return flask.Response(status=HTTPStatus.BAD_REQUEST,
response="Body is empty")

validate_field = validations.validate_sanity_fields(json_data)
if not validate_field[0]:
return flask.Response(status=validate_field[1][0], response=validate_field[1][1])

uri = read_config.mongodb_uri.format(read_config.db_username, read_config.db_password,
read_config.db_hostname)
data = sanityapi.get_sanity_config(uri, json_data['run_id'])
global_functions.convert_objectids(data)

return data
10 changes: 10 additions & 0 deletions dashboards/perf-rest/rest_app/sanityapi.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,3 +93,13 @@ def read_write_routine_for_ttfb(**kwargs):

kwargs['temp_write'][kwargs['obj']
] = round(query_results[1][0][kwargs['metrix']]['99p'], 3)


def get_sanity_config(uri, run_id):
"""Get run ID from the given query."""
query_results = mongodbapi.find_documents({"run_ID": run_id}, None, uri,
read_config.db_name, read_config.sanity_config)
if query_results[0]:
return query_results[1][0]
else:
return None
3 changes: 3 additions & 0 deletions dashboards/superperf/src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
<v-app>
<v-main>
<MainHeader/>
<SanitySummary/>
<SanityDetails/>
</v-main>
</v-app>
Expand All @@ -10,12 +11,14 @@
<script>
import MainHeader from './components/MainHeader.vue'
import SanityDetails from './components/SanityDetails.vue'
import SanitySummary from './components/SanitySummary.vue'
export default {
name: 'App',
components: {
MainHeader,
SanitySummary,
SanityDetails
},
Expand Down
69 changes: 69 additions & 0 deletions dashboards/superperf/src/components/SanitySummary.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
<template>
<v-expansion-panels focusable class="sanity_summary">
<v-expansion-panel>
<v-expansion-panel-header>Sanity Run Summary</v-expansion-panel-header>
<v-expansion-panel-content>
<div>
<h4>Run ID: {{ run_id }}</h4>
<h4 style='display:inline'>User: </h4> <p style='display:inline'>{{ config_data['User'] }}</p>
<div>
<h4 style='display:inline'>Nodes ({{ config_data['Count_of_Servers'] }}): </h4>
<p style='display:inline'>{{ config_data['Nodes'].join([separator = ', ']) }}</p>
</div>
<div>
<h4 style='display:inline'>Clients ({{ config_data['Count_of_Clients'] }}): </h4>
<p style='display:inline'>{{ config_data['Clients'].join([separator = ', ']) }}</p>
</div>
<div>
<h4 style='display:inline'>Cluster Fill: </h4>
<p style='display:inline'>{{ config_data['Percentage_full'] }}%</p>
</div>
</div>

<!-- <v-card v-if="headers && headers.length > 0">
<SanityDataTable
TableName="Data"
v-if="data_throughput_write && data_throughput_write.length>0"
:Headers="headers"
:DataValuesRead="data_throughput_read"
:DataValuesWrite="data_throughput_write"
/>
</v-card> -->
</v-expansion-panel-content>
</v-expansion-panel>
</v-expansion-panels>
</template>

<script>
import * as sanityapi from "./backend/getSanityData.js";
// import SanityDataTable from "./SanityDataTable.vue";
export default {
name: "SanitySummary",
// components: {
// SanityDataTable,
// },
data() {
return {
config_data: {
},
run_id: this.$route.query.run_id
};
},
mounted: function() {
sanityapi.fetch_data_from_respose(this.run_id, "config")
.then((response) => {
this.config_data = response.data;
});
},
}
</script>

<style>
.sanity_summary {
padding-left: 20px;
padding-right: 20px;
}
</style>

0 comments on commit a4fde29

Please sign in to comment.