Skip to content

Commit

Permalink
Merge pull request #109 from Manda-supraja26/uperf
Browse files Browse the repository at this point in the history
Adding Public - UPerf Results dashboard to grafonnet.
  • Loading branch information
vishnuchalla authored Feb 9, 2024
2 parents 1ab1846 + 308f597 commit 45abdfd
Show file tree
Hide file tree
Showing 4 changed files with 388 additions and 0 deletions.
179 changes: 179 additions & 0 deletions assets/uperf/panels.libsonnet
Original file line number Diff line number Diff line change
@@ -0,0 +1,179 @@
local g = import 'github.com/grafana/grafonnet/gen/grafonnet-latest/main.libsonnet';

{
timeSeries: {
local timeSeries = g.panel.timeSeries,
local custom = timeSeries.fieldConfig.defaults.custom,
local options = timeSeries.options,

base(title, unit, targets, gridPos):
timeSeries.new(title)
+ timeSeries.queryOptions.withTargets(targets)
+ timeSeries.datasource.withType('elasticsearch')
+ timeSeries.datasource.withUid('$Datasource')
+ timeSeries.standardOptions.withUnit(unit)
+ timeSeries.gridPos.withX(gridPos.x)
+ timeSeries.gridPos.withY(gridPos.y)
+ timeSeries.gridPos.withH(gridPos.h)
+ timeSeries.gridPos.withW(gridPos.w)
+ custom.withSpanNulls(false)
+ options.tooltip.withMode('multi')
+ options.tooltip.withSort('none')
+ options.legend.withShowLegend(true)
+ timeSeries.queryOptions.withTimeFrom(null)
+ timeSeries.queryOptions.withTimeShift(null)
+ timeSeries.panelOptions.withTransparent(true),

uperfPerformance(title, unit, targets, gridPos):
self.base(title, unit, targets, gridPos)
+ options.legend.withCalcs([
'mean',
'max',
])
+ options.legend.withShowLegend(true)
+ options.legend.withDisplayMode('table')
+ options.legend.withPlacement('bottom')
+ custom.withLineWidth(1)
+ custom.withFillOpacity(10)
+ custom.withPointSize(5)
+ custom.withSpanNulls(true)
+ custom.withShowPoints('never'),
},

table: {
local table = g.panel.table,
local custom = table.fieldConfig.defaults.custom,
local options = table.options,

base(title, targets, gridPos):
table.new(title)
+ table.queryOptions.withTargets(targets)
+ table.datasource.withType('elasticsearch')
+ table.datasource.withUid('$Datasource')
+ table.gridPos.withX(gridPos.x)
+ table.gridPos.withY(gridPos.y)
+ table.gridPos.withH(gridPos.h)
+ table.gridPos.withW(gridPos.w)
+ options.withShowHeader(true)
+ options.footer.TableFooterOptions.withShow(false)
+ options.footer.TableFooterOptions.withReducer('sum')
+ options.footer.TableFooterOptions.withCountRows(false)
+ custom.withAlign('auto')
+ custom.withInspect(false)
+ table.panelOptions.withTransparent(true)
+ table.queryOptions.withTimeFrom(null)
+ table.queryOptions.withTimeShift(null)
+ table.standardOptions.color.withMode('thresholds')
+ table.queryOptions.withTransformations([
{
"id": "seriesToColumns",
"options": {
"reducers": []
}
}
])
+ table.standardOptions.withOverrides([
{
"matcher": {
"id": "byName",
"options": "message_size"
},
"properties": [
{
"id": "unit",
"value": ""
},
{
"id": "custom.align",
"value": null
}
]
},
{
"matcher": {
"id": "byName",
"options": "Average norm_byte"
},
"properties": [
{
"id": "unit",
"value": "bps"
},
{
"id": "decimals",
"value": "2"
},
{
"id": "custom.align",
"value": null
}
]
},
{
"matcher": {
"id": "byName",
"options": "Average norm_ops"
},
"properties": [
{
"id": "unit",
"value": "none"
},
{
"id": "decimals",
"value": "0"
},
{
"id": "custom.align",
"value": null
}
]
},
{
"matcher": {
"id": "byName",
"options": "Average norm_ltcy"
},
"properties": [
{
"id": "unit",
"value": "µs"
},
{
"id": "decimals",
"value": "2"
},
{
"id": "custom.align",
"value": null
}
]
},
{
"matcher": {
"id": "byName",
"options": "Count"
},
"properties": [
{
"id": "displayName",
"value": "Sample count"
},
{
"id": "unit",
"value": "short"
},
{
"id": "decimals",
"value": "2"
},
{
"id": "custom.align",
"value": null
}
]
}
])
}

}
104 changes: 104 additions & 0 deletions assets/uperf/queries.libsonnet
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
local g = import 'github.com/grafana/grafonnet/gen/grafonnet-latest/main.libsonnet';
local variables = import './variables.libsonnet';
local elasticsearch = g.query.elasticsearch;

{
throughput: {
query():
elasticsearch.withAlias(null)
+ elasticsearch.withBucketAggs([
elasticsearch.bucketAggs.DateHistogram.withField("uperf_ts")
+ elasticsearch.bucketAggs.DateHistogram.withId("2")
+ elasticsearch.bucketAggs.DateHistogram.withType('date_histogram')
+ elasticsearch.bucketAggs.DateHistogram.settings.withInterval('auto')
+ elasticsearch.bucketAggs.DateHistogram.settings.withMinDocCount(0)
+ elasticsearch.bucketAggs.DateHistogram.settings.withTimeZone("utc")
+ elasticsearch.bucketAggs.DateHistogram.settings.withTrimEdges(null),
])
+ elasticsearch.withMetrics([
elasticsearch.metrics.MetricAggregationWithSettings.Sum.withField("norm_byte")
+ elasticsearch.metrics.MetricAggregationWithSettings.Sum.withId("1")
+ elasticsearch.metrics.MetricAggregationWithSettings.Sum.withType('sum')
+ elasticsearch.metrics.MetricAggregationWithSettings.Sum.settings.script.withInline('_value * 8')
])
+ elasticsearch.withQuery('uuid: $uuid AND cluster_name: $cluster_name AND user: $user AND iteration: $iteration AND remote_ip: $server AND message_size: $message_size AND test_type: $test_type AND protocol: $protocol AND num_threads: $threads')
+ elasticsearch.withTimeField('uperf_ts')
},

operations: {
query():
elasticsearch.withAlias(null)
+ elasticsearch.withBucketAggs([
elasticsearch.bucketAggs.DateHistogram.withField("uperf_ts")
+ elasticsearch.bucketAggs.DateHistogram.withId("2")
+ elasticsearch.bucketAggs.DateHistogram.withType('date_histogram')
+ elasticsearch.bucketAggs.DateHistogram.settings.withInterval('auto')
+ elasticsearch.bucketAggs.DateHistogram.settings.withMinDocCount(0)
+ elasticsearch.bucketAggs.DateHistogram.settings.withTimeZone("utc")
+ elasticsearch.bucketAggs.DateHistogram.settings.withTrimEdges(null),
])
+ elasticsearch.withMetrics([
elasticsearch.metrics.MetricAggregationWithSettings.Sum.withField("norm_ops")
+ elasticsearch.metrics.MetricAggregationWithSettings.Sum.withId("1")
+ elasticsearch.metrics.MetricAggregationWithSettings.Sum.withType('sum')
])
+ elasticsearch.withQuery('uuid: $uuid AND user: $user AND iteration: $iteration AND remote_ip: $server AND message_size: $message_size AND test_type: $test_type AND protocol: $protocol AND num_threads: $threads')
+ elasticsearch.withTimeField('uperf_ts')
},

results: {
query():
elasticsearch.withAlias(null)
+ elasticsearch.withBucketAggs([
elasticsearch.bucketAggs.Terms.withField("test_type.keyword")
+ elasticsearch.bucketAggs.Terms.withId("3")
+ elasticsearch.bucketAggs.Terms.withType('terms')
+ elasticsearch.bucketAggs.Terms.settings.withOrder('desc')
+ elasticsearch.bucketAggs.Terms.settings.withOrderBy('_term')
+ elasticsearch.bucketAggs.Terms.settings.withMinDocCount(1)
+ elasticsearch.bucketAggs.Terms.settings.withSize("10"),
elasticsearch.bucketAggs.Terms.withField("protocol.keyword")
+ elasticsearch.bucketAggs.Terms.withId("4")
+ elasticsearch.bucketAggs.Terms.withType('terms')
+ elasticsearch.bucketAggs.Terms.settings.withOrder('desc')
+ elasticsearch.bucketAggs.Terms.settings.withOrderBy('_term')
+ elasticsearch.bucketAggs.Terms.settings.withMinDocCount(1)
+ elasticsearch.bucketAggs.Terms.settings.withSize("10"),
elasticsearch.bucketAggs.Terms.withField("num_threads")
+ elasticsearch.bucketAggs.Terms.withId("5")
+ elasticsearch.bucketAggs.Terms.withType('terms')
+ elasticsearch.bucketAggs.Terms.settings.withOrder('desc')
+ elasticsearch.bucketAggs.Terms.settings.withOrderBy('_term')
+ elasticsearch.bucketAggs.Terms.settings.withMinDocCount(1)
+ elasticsearch.bucketAggs.Terms.settings.withSize("10"),
elasticsearch.bucketAggs.Terms.withField("message_size")
+ elasticsearch.bucketAggs.Terms.withId("2")
+ elasticsearch.bucketAggs.Terms.withType('terms')
+ elasticsearch.bucketAggs.Terms.settings.withOrder('desc')
+ elasticsearch.bucketAggs.Terms.settings.withOrderBy('_term')
+ elasticsearch.bucketAggs.Terms.settings.withMinDocCount(1)
+ elasticsearch.bucketAggs.Terms.settings.withSize("10"),

])
+ elasticsearch.withMetrics([
elasticsearch.metrics.MetricAggregationWithSettings.Average.withField("norm_byte")
+ elasticsearch.metrics.MetricAggregationWithSettings.Average.withId("1")
+ elasticsearch.metrics.MetricAggregationWithSettings.Average.withType('avg')
+ elasticsearch.metrics.MetricAggregationWithSettings.Average.settings.script.withInline('_value * 8'),

elasticsearch.metrics.MetricAggregationWithSettings.Average.withField("norm_ops")
+ elasticsearch.metrics.MetricAggregationWithSettings.Average.withId("6")
+ elasticsearch.metrics.MetricAggregationWithSettings.Average.withType('avg'),

elasticsearch.metrics.MetricAggregationWithSettings.Average.withField("norm_ltcy")
+ elasticsearch.metrics.MetricAggregationWithSettings.Average.withId("7")
+ elasticsearch.metrics.MetricAggregationWithSettings.Average.withType('avg'),

elasticsearch.metrics.MetricAggregationWithSettings.UniqueCount.withType('count')
+ elasticsearch.metrics.MetricAggregationWithSettings.UniqueCount.withId('8')
+ elasticsearch.metrics.MetricAggregationWithSettings.UniqueCount.withField('select field')
])
+ elasticsearch.withQuery('uuid: $uuid AND user: $user AND iteration: $iteration AND remote_ip: $server AND message_size: $message_size AND test_type: $test_type AND protocol: $protocol AND NOT norm_ops:0')
+ elasticsearch.withTimeField('uperf_ts')
}
}
73 changes: 73 additions & 0 deletions assets/uperf/variables.libsonnet
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
local g = import 'github.com/grafana/grafonnet/gen/grafonnet-latest/main.libsonnet';
local var = g.dashboard.variable;

{
Datasource:
var.datasource.new('Datasource','elasticsearch')
+ var.datasource.withRegex("/(.*uperf.*)/")
+ var.query.generalOptions.withLabel('uperf-results datasource')
+ var.query.withRefresh(1),

uuid:
var.query.new('uuid','{"find": "terms", "field": "uuid.keyword"}')
+ var.query.withDatasourceFromVariable(self.Datasource)
+ var.query.selectionOptions.withMulti(false)
+ var.query.selectionOptions.withIncludeAll(true)
+ var.query.withRefresh(2),

cluster_name:
var.query.new('cluster_name','{"find": "terms", "field": "cluster_name.keyword"}')
+ var.query.withDatasourceFromVariable(self.Datasource)
+ var.query.selectionOptions.withMulti(false)
+ var.query.selectionOptions.withIncludeAll(true)
+ var.query.withRefresh(2),

user:
var.query.new('user','{"find": "terms", "field": "user.keyword"}')
+ var.query.withDatasourceFromVariable(self.Datasource)
+ var.query.selectionOptions.withMulti(false)
+ var.query.selectionOptions.withIncludeAll(true)
+ var.query.withRefresh(2),

iteration:
var.query.new('iteration','{"find": "terms", "field": "iteration"}')
+ var.query.withDatasourceFromVariable(self.Datasource)
+ var.query.selectionOptions.withMulti(false)
+ var.query.selectionOptions.withIncludeAll(true)
+ var.query.withRefresh(2),

server:
var.query.new('server','{"find": "terms", "field": "remote_ip.keyword"}')
+ var.query.withDatasourceFromVariable(self.Datasource)
+ var.query.selectionOptions.withMulti(false)
+ var.query.selectionOptions.withIncludeAll(true)
+ var.query.withRefresh(2),

test_type:
var.query.new('test_type','{"find": "terms", "field": "test_type.keyword"}')
+ var.query.withDatasourceFromVariable(self.Datasource)
+ var.query.selectionOptions.withMulti(false)
+ var.query.selectionOptions.withIncludeAll(true)
+ var.query.withRefresh(2),

protocol:
var.query.new('protocol','{"find": "terms", "field": "protocol.keyword"}')
+ var.query.withDatasourceFromVariable(self.Datasource)
+ var.query.selectionOptions.withMulti(false)
+ var.query.selectionOptions.withIncludeAll(true)
+ var.query.withRefresh(2),

message_size:
var.query.new('message_size','{"find": "terms", "field": "message_size"}')
+ var.query.withDatasourceFromVariable(self.Datasource)
+ var.query.selectionOptions.withMulti(false)
+ var.query.selectionOptions.withIncludeAll(true)
+ var.query.withRefresh(2),

threads:
var.query.new('threads','{"find": "terms", "field": "num_threads"}')
+ var.query.withDatasourceFromVariable(self.Datasource)
+ var.query.selectionOptions.withMulti(false)
+ var.query.selectionOptions.withIncludeAll(true)
+ var.query.withRefresh(2),
}
32 changes: 32 additions & 0 deletions templates/General/uperf-v2.jsonnet
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
local panels = import '../../assets/uperf/panels.libsonnet';
local queries = import '../../assets/uperf/queries.libsonnet';
local variables = import '../../assets/uperf/variables.libsonnet';
local g = import 'github.com/grafana/grafonnet/gen/grafonnet-latest/main.libsonnet';

g.dashboard.new('Public - UPerf Results dashboard')
+ g.dashboard.withTags(['network', 'performance'])
+ g.dashboard.time.withFrom('now-1h')
+ g.dashboard.time.withTo('now')
+ g.dashboard.withTimezone('utc')
+ g.dashboard.timepicker.withRefreshIntervals(['5s', '10s', '30s', '1m', '5m', '15m', '30m', '1h', '2h', '1d'])
+ g.dashboard.timepicker.withTimeOptions(['5m', '15m', '1h', '6h', '12h', '24h', '2d', '7d', '30d'])
+ g.dashboard.withRefresh('')
+ g.dashboard.withEditable(false)
+ g.dashboard.graphTooltip.withSharedCrosshair()
+ g.dashboard.withVariables([
variables.Datasource,
variables.uuid,
variables.cluster_name,
variables.user,
variables.iteration,
variables.server,
variables.test_type,
variables.protocol,
variables.message_size,
variables.threads,
])
+ g.dashboard.withPanels([
panels.timeSeries.uperfPerformance('UPerf Performance : Throughput per-second', 'bps', queries.throughput.query(), { x: 0, y: 0, w: 12, h: 9 }),
panels.timeSeries.uperfPerformance('UPerf Performance : Operations per-second', 'pps', queries.operations.query(), { x: 12, y: 0, w: 12, h: 9 }),
panels.table.base('UPerf Result Summary', queries.results.query(), { x: 0, y: 20, w: 24, h: 18 }),
])

0 comments on commit 45abdfd

Please sign in to comment.