mirror of
https://github.com/valitydev/yandex-tank.git
synced 2024-11-06 18:35:18 +00:00
use string.Template().safe_replace
This commit is contained in:
parent
45173e4c03
commit
1e322ee562
@ -43,7 +43,10 @@ class GraphiteUploaderPlugin(AbstractPlugin, AggregateResultListener):
|
|||||||
port = self.get_option("port", "2003")
|
port = self.get_option("port", "2003")
|
||||||
self.web_port = self.get_option("web_port", "8080")
|
self.web_port = self.get_option("web_port", "8080")
|
||||||
self.prefix = self.get_option("prefix", "one_sec.yandex_tank")
|
self.prefix = self.get_option("prefix", "one_sec.yandex_tank")
|
||||||
self.template = self.get_option("template", os.path.dirname(__file__) + "/graphite.tpl")
|
default_template = "/graphite.tpl"
|
||||||
|
if self.get_option("js", "1") == "1":
|
||||||
|
default_template = "/graphite-js.tpl"
|
||||||
|
self.template = self.get_option("template", os.path.dirname(__file__) + default_template)
|
||||||
self.graphite_client = GraphiteClient(self.prefix, self.address, port)
|
self.graphite_client = GraphiteClient(self.prefix, self.address, port)
|
||||||
aggregator = self.core.get_plugin_of_type(AggregatorPlugin)
|
aggregator = self.core.get_plugin_of_type(AggregatorPlugin)
|
||||||
aggregator.add_result_listener(self)
|
aggregator.add_result_listener(self)
|
||||||
@ -69,8 +72,8 @@ class GraphiteUploaderPlugin(AbstractPlugin, AggregateResultListener):
|
|||||||
self.core.add_artifact_file(graphite_html)
|
self.core.add_artifact_file(graphite_html)
|
||||||
with open(graphite_html, 'w') as graphite_html_file:
|
with open(graphite_html, 'w') as graphite_html_file:
|
||||||
graphite_html_file.write(
|
graphite_html_file.write(
|
||||||
template.format(
|
string.Template(template).safe_substitute(
|
||||||
host='%s' % self.address,
|
host=self.address,
|
||||||
width=1000,
|
width=1000,
|
||||||
height=400,
|
height=400,
|
||||||
start_time=self.start_time,
|
start_time=self.start_time,
|
||||||
|
@ -10,6 +10,6 @@
|
|||||||
</script>
|
</script>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<div class="graphite-charts" data-host="{host}" data-web-port="{web_port}" data-start-time="{start_time}" data-end-time="{end_time}" data-prefix="{prefix}" />
|
<div class="graphite-charts" data-host="$host" data-web-port="$web_port" data-start-time="$start_time" data-end-time="$end_time" data-prefix="$prefix" />
|
||||||
<body>
|
<body>
|
||||||
<html>
|
<html>
|
@ -2,22 +2,22 @@
|
|||||||
<body>
|
<body>
|
||||||
|
|
||||||
<h2>Overall quantiles and average response time</h2>
|
<h2>Overall quantiles and average response time</h2>
|
||||||
<img src="http://{host}:{web_port}/render/?width={width}&height={height}&from={start_time}&until={end_time}&target=aliasByMetric(color({prefix}.overall.quantiles.25_0,%22%23DD0000%22))&target=aliasByMetric(color({prefix}.overall.quantiles.50_0,%22%23DD3800%22))&target=aliasByMetric(color({prefix}.overall.quantiles.75_0,%22%23DD6e00%22))&target=aliasByMetric(color({prefix}.overall.quantiles.90_0,%22%23DDDC00%22))&target=aliasByMetric(color({prefix}.overall.quantiles.95_0,%22%23A6DD00%22))&target=aliasByMetric(color({prefix}.overall.quantiles.99_0,%22%2338DD00%22))&target=aliasByMetric(alpha(color({prefix}.overall.quantiles.100_0,%22green%22),0.5))&target=aliasByMetric({prefix}.overall.avg_response_time)&areaMode=all" />
|
<img src="http://${host}:${web_port}/render/?width=${width}&height=${height}&from=${start_time}&until=${end_time}&target=aliasByMetric(color(${prefix}.overall.quantiles.25_0,%22%23DD0000%22))&target=aliasByMetric(color(${prefix}.overall.quantiles.50_0,%22%23DD3800%22))&target=aliasByMetric(color(${prefix}.overall.quantiles.75_0,%22%23DD6e00%22))&target=aliasByMetric(color(${prefix}.overall.quantiles.90_0,%22%23DDDC00%22))&target=aliasByMetric(color(${prefix}.overall.quantiles.95_0,%22%23A6DD00%22))&target=aliasByMetric(color(${prefix}.overall.quantiles.99_0,%22%2338DD00%22))&target=aliasByMetric(alpha(color(${prefix}.overall.quantiles.100_0,%22green%22),0.5))&target=aliasByMetric(${prefix}.overall.avg_response_time)&areaMode=all" />
|
||||||
|
|
||||||
<h2>RPS by marker</h2>
|
<h2>RPS by marker</h2>
|
||||||
<img src="http://{host}:{web_port}/render/?width={width}&height={height}&from={start_time}&until={end_time}&target={prefix}.markers.*.RPS&target={prefix}.overall.RPS" />
|
<img src="http://${host}:${web_port}/render/?width=${width}&height=${height}&from=${start_time}&until=${end_time}&target=${prefix}.markers.*.RPS&target=${prefix}.overall.RPS" />
|
||||||
|
|
||||||
<h2>Average response time by marker</h2>
|
<h2>Average response time by marker</h2>
|
||||||
<img src="http://{host}:{web_port}/render/?width={width}&height={height}&from={start_time}&until={end_time}&target=aliasByNode({prefix}.overall.avg_response_time,2)&target=aliasByNode({prefix}.markers.*.avg_response_time,3)" />
|
<img src="http://${host}:${web_port}/render/?width=${width}&height=${height}&from=${start_time}&until=${end_time}&target=aliasByNode(${prefix}.overall.avg_response_time,2)&target=aliasByNode(${prefix}.markers.*.avg_response_time,3)" />
|
||||||
|
|
||||||
<h2>HTTP codes</h2>
|
<h2>HTTP codes</h2>
|
||||||
<img src="http://{host}:{web_port}/render/?width={width}&height={height}&from={start_time}&until={end_time}&target=aliasByMetric({prefix}.overall.http_codes.*)" />
|
<img src="http://${host}:${web_port}/render/?width=${width}&height=${height}&from=${start_time}&until=${end_time}&target=aliasByMetric(${prefix}.overall.http_codes.*)" />
|
||||||
|
|
||||||
<h2>NET codes</h2>
|
<h2>NET codes</h2>
|
||||||
<img src="http://{host}:{web_port}/render/?width={width}&height={height}&from={start_time}&until={end_time}&target=aliasByMetric({prefix}.overall.net_codes.*)" />
|
<img src="http://${host}:${web_port}/render/?width=${width}&height=${height}&from=${start_time}&until=${end_time}&target=aliasByMetric(${prefix}.overall.net_codes.*)" />
|
||||||
|
|
||||||
<h2>Cumulative quantiles and average response time</h2>
|
<h2>Cumulative quantiles and average response time</h2>
|
||||||
<img src="http://{host}:{web_port}/render/?width={width}&height={height}&from={start_time}&until={end_time}&target=aliasByMetric(color({prefix}.cumulative.quantiles.25_0,%22%23DD0000%22))&target=aliasByMetric(color({prefix}.cumulative.quantiles.50_0,%22%23DD3800%22))&target=aliasByMetric(color({prefix}.cumulative.quantiles.75_0,%22%23DD6e00%22))&target=aliasByMetric(color({prefix}.cumulative.quantiles.90_0,%22%23DDDC00%22))&target=aliasByMetric(color({prefix}.cumulative.quantiles.95_0,%22%23A6DD00%22))&target=aliasByMetric(color({prefix}.cumulative.quantiles.99_0,%22%2338DD00%22))&target=aliasByMetric(alpha(color({prefix}.cumulative.quantiles.100_0,%22green%22),0.5))&&target=aliasByMetric({prefix}.cumulative.avg_response_time)&areaMode=all" />
|
<img src="http://${host}:${web_port}/render/?width=${width}&height=${height}&from=${start_time}&until=${end_time}&target=aliasByMetric(color(${prefix}.cumulative.quantiles.25_0,%22%23DD0000%22))&target=aliasByMetric(color(${prefix}.cumulative.quantiles.50_0,%22%23DD3800%22))&target=aliasByMetric(color(${prefix}.cumulative.quantiles.75_0,%22%23DD6e00%22))&target=aliasByMetric(color(${prefix}.cumulative.quantiles.90_0,%22%23DDDC00%22))&target=aliasByMetric(color(${prefix}.cumulative.quantiles.95_0,%22%23A6DD00%22))&target=aliasByMetric(color(${prefix}.cumulative.quantiles.99_0,%22%2338DD00%22))&target=aliasByMetric(alpha(color(${prefix}.cumulative.quantiles.100_0,%22green%22),0.5))&&target=aliasByMetric(${prefix}.cumulative.avg_response_time)&areaMode=all" />
|
||||||
|
|
||||||
<body>
|
<body>
|
||||||
<html>
|
<html>
|
||||||
|
Loading…
Reference in New Issue
Block a user