Restructure user-guide
[yardstick.git] / docs / userguide / 09-result-store-InfluxDB.rst
1 .. This work is licensed under a Creative Commons Attribution 4.0 International
2 .. License.
3 .. http://creativecommons.org/licenses/by/4.0
4 .. (c) OPNFV, 2016 Huawei Technologies Co.,Ltd and others.
5
6 ==============================================
7 Store Other Project's Test Results in InfluxDB
8 ==============================================
9
10 Abstract
11 ========
12
13 .. _Framework: https://wiki.opnfv.org/download/attachments/6827660/wiki.png?version=1&modificationDate=1470298075000&api=v2
14
15 This chapter illustrates how to run plug-in test cases and store test results
16 into community's InfluxDB. The framework is shown in Framework_.
17
18
19 .. image:: images/InfluxDB_store.png
20    :width: 1200px
21    :alt: Store Other Project's Test Results in InfluxDB
22
23 Store Storperf Test Results into Community's InfluxDB
24 =====================================================
25
26 .. _Influxdb: https://git.opnfv.org/cgit/yardstick/tree/yardstick/dispatcher/influxdb.py
27 .. _Mingjiang: limingjiang@huawei.com
28 .. _Visual: https://wiki.opnfv.org/download/attachments/6827660/tc074.PNG?version=1&modificationDate=1470298075000&api=v2
29 .. _Login: http://testresults.opnfv.org/grafana/login
30
31 As shown in Framework_, there are two ways to store Storperf test results
32 into community's InfluxDB:
33
34 1. Yardstick asks Storperf to run the test case. After the test case is
35    completed, Yardstick reads test results via ReST API from Storperf and
36    posts test data to the influxDB.
37
38 2. Additionally, Storperf can run tests by itself and post the test result
39    directly to the InfluxDB. The method for posting data directly to influxDB
40    will be supported in the future.
41
42 Our plan is to support rest-api in D release so that other testing projects can
43 call the rest-api to use yardstick dispatcher service to push data to yardstick's
44 influxdb database.
45
46 For now, influxdb only support line protocol, and the json protocol is deprecated.
47
48 Take ping test case for example, the raw_result is json format like this:
49 ::
50
51     "benchmark": {
52         "timestamp": 1470315409.868095,
53         "errors": "",
54         "data": {
55           "rtt": {
56           "ares": 1.125
57           }
58         },
59       "sequence": 1
60       },
61     "runner_id": 2625
62   }
63
64 With the help of "influxdb_line_protocol", the json is transform to like below as a line string:
65 ::
66
67   'ping,deploy_scenario=unknown,host=athena.demo,installer=unknown,pod_name=unknown,
68     runner_id=2625,scenarios=Ping,target=ares.demo,task_id=77755f38-1f6a-4667-a7f3-
69       301c99963656,version=unknown rtt.ares=1.125 1470315409868094976'
70
71 So, for data output of json format, you just need to transform json into line format and call
72 influxdb api to post the data into the database. All this function has been implemented in Influxdb_.
73 If you need support on this, please contact Mingjiang_.
74 ::
75
76   curl -i -XPOST 'http://104.197.68.199:8086/write?db=yardstick' --
77     data-binary 'ping,deploy_scenario=unknown,host=athena.demo,installer=unknown, ...'
78
79 Grafana will be used for visualizing the collected test data, which is shown in Visual_. Grafana
80 can be accessed by Login_.
81
82
83 .. image:: images/results_visualization.png
84    :width: 1200px
85    :alt: results visualization
86