87 lines
5.6 KiB
Python
87 lines
5.6 KiB
Python
#Single value tile definition (for json parse purpose)
|
|
class SingleValueTile:
|
|
def __init__(self,name,bounds,timeframe,remoteEnvironmentUrl,metricSelector,graphThreshold):
|
|
self.name = name
|
|
self.tileType = "DATA_EXPLORER"
|
|
self.configured = "true"
|
|
self.bounds = bounds
|
|
self.tileFilter = { "timeframe": timeframe }
|
|
self.remoteEnvironmentUri = remoteEnvironmentUrl
|
|
self.customName = metricSelector
|
|
self.queries = [
|
|
{
|
|
"id": "A",
|
|
"timeAggregation": "DEFAULT",
|
|
|
|
"metricSelector": metricSelector,
|
|
|
|
"foldTransformation": "TOTAL",
|
|
"enabled": "true"
|
|
}
|
|
]
|
|
self.visualConfig = {
|
|
"type": "SINGLE_VALUE", "global": { "seriesType": "LINE", "hideLegend": "true" },
|
|
"rules": [ { "matcher": "A:", "properties": { "color": "DEFAULT", "seriesType": "LINE", "alias": "SLO" }, "seriesOverrides": [{"name": metricSelector, "color": "#ffffff"}] } ],
|
|
"axes": { "xAxis": { "visible": "true" }, "yAxes": [] },
|
|
"heatmapSettings": {},
|
|
"singleValueSettings": { "showTrend": "false", "showSparkLine": "false", "linkTileColorToThreshold": "true" },
|
|
"thresholds": [ { "axisTarget": "LEFT", "rules": graphThreshold, "queryId": "", "visible": "true" } ],
|
|
"tableSettings": { "isThresholdBackgroundAppliedToCell": "false" },
|
|
"graphChartSettings": { "connectNulls": "false" } }
|
|
self.queriesSettings = { "resolution": "","foldAggregation": "AVG" }
|
|
#Graph tile definition (for json parse purpose)
|
|
class GraphTile:
|
|
def __init__(self,name,bounds,remoteEnvironmentUrl,metricSelector, countMetricSelector, responseMetricSelector,graphThreshold,customName,axisTargetMin,axisTargetMax,config):
|
|
self.name = name
|
|
self.tileType = "DATA_EXPLORER"
|
|
self.configured = "true"
|
|
self.bounds = bounds
|
|
self.tileFilter = { "timeframe": config["metadata"]["graph_timeframe"] }
|
|
self.remoteEnvironmentUri = remoteEnvironmentUrl
|
|
self.customName = metricSelector
|
|
self.queries = [
|
|
{
|
|
"id": "A",
|
|
"timeAggregation": "DEFAULT",
|
|
|
|
"metricSelector": metricSelector,
|
|
|
|
"foldTransformation": "TOTAL",
|
|
"enabled": "true"
|
|
},
|
|
{
|
|
"id": "B",
|
|
"timeAggregation": "DEFAULT",
|
|
|
|
"metricSelector": countMetricSelector,
|
|
|
|
"foldTransformation": "TOTAL",
|
|
"enabled": "true"
|
|
},
|
|
{
|
|
"id": "C",
|
|
"timeAggregation": "DEFAULT",
|
|
|
|
"metricSelector": responseMetricSelector,
|
|
|
|
"foldTransformation": "TOTAL",
|
|
"enabled": "true"
|
|
}
|
|
]
|
|
self.visualConfig = {
|
|
"type": "GRAPH_CHART", "global": { "seriesType": "LINE", "hideLegend": "true" },
|
|
"rules": [ { "matcher": "A:", "properties": { "color": "GREEN", "seriesType": "LINE", "alias": customName }, "seriesOverrides": [{"name": customName, "color": config["visualconfig"]["slo_line_color"]}] },
|
|
{ "matcher": "B:", "properties": { "color": "BLUE", "seriesType": "COLUMN", "alias": "Request count - server" }, "seriesOverrides": [{"name": "Request count - server", "color": config["visualconfig"]["request_count_color"]}] },
|
|
{ "matcher": "C:", "properties": { "color": "PURPLE", "seriesType": "LINE", "alias": "Key request response time" }, "seriesOverrides": [{"name": "Key request response time", "color": config["visualconfig"]["response_time_color"]}] } ],
|
|
"axes": { "xAxis": { "visible": "true" }, "yAxes": [
|
|
{ "displayName": "", "visible": "true", "min": axisTargetMin, "max": axisTargetMax, "position": "LEFT", "queryIds": [ "A" ], "defaultAxis": "true" },
|
|
{ "displayName": "", "visible": "true", "min": "AUTO", "max": "AUTO", "position": "RIGHT", "queryIds": [ "B" ], "defaultAxis": "true" },
|
|
{ "displayName": "", "visible": "true", "min": "AUTO", "max": "AUTO", "position": "LEFT", "queryIds": [ "C" ], "defaultAxis": "true" }
|
|
] },
|
|
"heatmapSettings": {},
|
|
"singleValueSettings": { "showTrend": "false", "showSparkLine": "false", "linkTileColorToThreshold": "true" },
|
|
"thresholds": [ { "axisTarget": "LEFT", "rules": graphThreshold, "queryId": "", "visible": "false" } ],
|
|
"tableSettings": { "isThresholdBackgroundAppliedToCell": "false" },
|
|
"graphChartSettings": { "connectNulls": "false" } }
|
|
self.queriesSettings = { "resolution": "" }
|