-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
tdg_dashboard: add GraphQL requests section
Add "TDG GraphQL requests" section to TDG dashboard templates. It consists of panels with following metrics: - tdg_graphql_query_time_sum - tdg_graphql_query_time_count - tdg_graphql_query_fail - tdg_graphql_mutation_time_sum - tdg_graphql_mutation_time_count - tdg_graphql_mutation_fail Part of #134
- Loading branch information
1 parent
f08e333
commit 05a8923
Showing
8 changed files
with
1,711 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,229 @@ | ||
local grafana = import 'grafonnet/grafana.libsonnet'; | ||
|
||
local common_utils = import '../common.libsonnet'; | ||
|
||
local influxdb = grafana.influxdb; | ||
local prometheus = grafana.prometheus; | ||
|
||
{ | ||
row:: common_utils.row('TDG GraphQL requests'), | ||
|
||
local rps_target( | ||
datasource, | ||
metric_name, | ||
job=null, | ||
rate_time_range=null, | ||
policy=null, | ||
measurement=null, | ||
) = | ||
if datasource == '${DS_PROMETHEUS}' then | ||
prometheus.target( | ||
expr=std.format('rate(%s{job=~"%s"}[%s])', | ||
[metric_name, job, rate_time_range]), | ||
legendFormat='{{operation_name}} ({{schema}}, {{entity}}) — {{alias}}', | ||
) | ||
else if datasource == '${DS_INFLUXDB}' then | ||
influxdb.target( | ||
policy=policy, | ||
measurement=measurement, | ||
group_tags=[ | ||
'label_pairs_alias', | ||
'label_pairs_operation_name', | ||
'label_pairs_schema', | ||
'label_pairs_entity', | ||
], | ||
alias='$tag_label_pairs_operation_name ($tag_label_pairs_schema, $tag_label_pairs_entity) — $tag_label_pairs_alias', | ||
).where('metric_name', '=', metric_name) | ||
.selectField('value').addConverter('mean').addConverter('non_negative_derivative', ['1s']), | ||
|
||
local average_target( | ||
datasource, | ||
metric_name, | ||
job=null, | ||
policy=null, | ||
measurement=null, | ||
) = | ||
if datasource == '${DS_PROMETHEUS}' then | ||
prometheus.target( | ||
expr=std.format( | ||
||| | ||
%(metric_name_sum)s{job=~"%(job)s"} / | ||
%(metric_name_count)s{job=~"%(job)s"} | ||
|||, | ||
{ | ||
metric_name_sum: std.join('_', [metric_name, 'sum']), | ||
metric_name_count: std.join('_', [metric_name, 'count']), | ||
job: job, | ||
} | ||
), | ||
legendFormat='{{operation_name}} ({{schema}}, {{entity}}) — {{alias}}' | ||
) | ||
else if datasource == '${DS_INFLUXDB}' then | ||
influxdb.target( | ||
rawQuery=true, | ||
query=std.format(||| | ||
SELECT mean("%(metric_name_sum)s") / mean("%(metric_name_count)s") | ||
as "average" FROM | ||
(SELECT "value" as "%(metric_name_sum)s" FROM %(policy_prefix)s"%(measurement)s" | ||
WHERE ("metric_name" = '%(metric_name_sum)s') AND $timeFilter), | ||
(SELECT "value" as "%(metric_name_count)s" FROM %(policy_prefix)s"%(measurement)s" | ||
WHERE ("metric_name" = '%(metric_name_count)s') AND $timeFilter) | ||
GROUP BY time($__interval), "label_pairs_alias", "label_pairs_operation_name", | ||
"label_pairs_schema", "label_pairs_entity" fill(none) | ||
|||, { | ||
metric_name_sum: std.join('_', [metric_name, 'sum']), | ||
metric_name_count: std.join('_', [metric_name, 'count']), | ||
policy_prefix: if policy == 'default' then '' else std.format('"%(policy)s".', policy), | ||
measurement: measurement, | ||
}), | ||
alias='$tag_label_pairs_operation_name ($tag_label_pairs_schema, $tag_label_pairs_entity) — $tag_label_pairs_alias' | ||
), | ||
|
||
query_success_rps( | ||
title='Success queries', | ||
description=common_utils.rate_warning(||| | ||
A number of successfully executed GraphQL queries. | ||
Graph shows mean requests per second. | ||
|||, datasource), | ||
datasource=null, | ||
policy=null, | ||
measurement=null, | ||
job=null, | ||
rate_time_range=null, | ||
):: common_utils.default_graph( | ||
title=title, | ||
description=description, | ||
datasource=datasource, | ||
labelY1='request per second', | ||
).addTarget(rps_target( | ||
datasource, | ||
'tdg_graphql_query_time_count', | ||
job, | ||
rate_time_range, | ||
policy, | ||
measurement, | ||
)), | ||
|
||
query_success_latency( | ||
title='Success query latency', | ||
description=||| | ||
Average time of GraphQL query execution. | ||
Only success requests are count. | ||
|||, | ||
datasource=null, | ||
policy=null, | ||
measurement=null, | ||
job=null, | ||
):: common_utils.default_graph( | ||
title=title, | ||
description=description, | ||
datasource=datasource, | ||
labelY1='average', | ||
format='µs', | ||
).addTarget(average_target( | ||
datasource, | ||
'tdg_graphql_query_time', | ||
job, | ||
policy, | ||
measurement, | ||
)), | ||
|
||
query_error_rps( | ||
title='Error queries', | ||
description=common_utils.rate_warning(||| | ||
A number of GraphQL queries failed to execute. | ||
Graph shows mean requests per second. | ||
|||, datasource), | ||
datasource=null, | ||
policy=null, | ||
measurement=null, | ||
job=null, | ||
rate_time_range=null, | ||
):: common_utils.default_graph( | ||
title=title, | ||
description=description, | ||
datasource=datasource, | ||
labelY1='request per second', | ||
).addTarget(rps_target( | ||
datasource, | ||
'tdg_graphql_query_fail', | ||
job, | ||
rate_time_range, | ||
policy, | ||
measurement, | ||
)), | ||
|
||
mutation_success_rps( | ||
title='Success mutations', | ||
description=common_utils.rate_warning(||| | ||
A number of successfully executed GraphQL mutations. | ||
Graph shows mean requests per second. | ||
|||, datasource), | ||
datasource=null, | ||
policy=null, | ||
measurement=null, | ||
job=null, | ||
rate_time_range=null, | ||
):: common_utils.default_graph( | ||
title=title, | ||
description=description, | ||
datasource=datasource, | ||
labelY1='request per second', | ||
).addTarget(rps_target( | ||
datasource, | ||
'tdg_graphql_mutation_time_count', | ||
job, | ||
rate_time_range, | ||
policy, | ||
measurement, | ||
)), | ||
|
||
mutation_success_latency( | ||
title='Success mutation latency', | ||
description=||| | ||
Average time of GraphQL mutation execution. | ||
Only success requests are count. | ||
|||, | ||
datasource=null, | ||
policy=null, | ||
measurement=null, | ||
job=null, | ||
):: common_utils.default_graph( | ||
title=title, | ||
description=description, | ||
datasource=datasource, | ||
labelY1='average', | ||
format='µs', | ||
).addTarget(average_target( | ||
datasource, | ||
'tdg_graphql_mutation_time', | ||
job, | ||
policy, | ||
measurement, | ||
)), | ||
|
||
mutation_error_rps( | ||
title='Error mutations', | ||
description=common_utils.rate_warning(||| | ||
A number of GraphQL mutations failed to execute. | ||
Graph shows mean requests per second. | ||
|||, datasource), | ||
datasource=null, | ||
policy=null, | ||
measurement=null, | ||
job=null, | ||
rate_time_range=null, | ||
):: common_utils.default_graph( | ||
title=title, | ||
description=description, | ||
datasource=datasource, | ||
labelY1='request per second', | ||
).addTarget(rps_target( | ||
datasource, | ||
'tdg_graphql_mutation_fail', | ||
job, | ||
rate_time_range, | ||
policy, | ||
measurement, | ||
)), | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.