-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathdoc.go
More file actions
97 lines (68 loc) · 2.24 KB
/
Copy pathdoc.go
File metadata and controls
97 lines (68 loc) · 2.24 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
/*
A time series database optimized for performance measurements.
Storing samples
Let's say you measure application latency several times per second.
Each sample is a JSON document:
{
"read_latency": 12.3
}
To persist measurements, send the following HTTP request:
curl -X POST http://localhost:8080/mydatabase -d '{"read_latency":12.3}'
where:
`mydatabase` is time series database name. It's recommended to create a separate database for each benchmark.
Obviously, you will rather use your favourite programming language to send HTTP requests.
It's absolutely OK to create thousands of databases.
Aggregation and visualization
This API returns JSON document with aggregated characteristics (mean, percentiles, and etc.):
$ curl -s http://127.0.0.1:8080/mydatabase/read_latency/summary | python -m json.tool
{
"avg": 5.82248,
"count": 200000,
"max": 100,
"min": 0,
"p50": 3,
"p80": 9,
"p90": 14,
"p95": 21,
"p99": 40,
"p99.9": 76
}
Please notice that Python is used for demonstration purpose only.
Finally, it is possible to generate heat map graphs in SVG format (use your browser to view):
http://127.0.0.1:8080/mydatabase/read_latency/heatmap
Each rectangle is a cluster of values. The darker color corresponds to the denser population. The legend on the right side of the graph (the vertical bar) should help to understand the density.
Browsing data
To list all available database, use the following request:
$ curl -s http://127.0.0.1:8080/ | python -m json.tool
[
"mydatabase"
]
To list all metrics, use request similar to:
$ curl -s http://127.0.0.1:8080/mydatabase | python -m json.tool
[
"read_latency",
"write_latency"
]
Querying samples
Only bulk queries are supported, but even they are not recommended.
To get the list of samples, use request similar to:
$ curl -s http://127.0.0.1:8080/mydatabase/read_latency | python -m json.tool
Output is a JSON document with all timestamps and values:
[
[
1437137708114018208,
10
],
[
1437137708114967597,
15
],
[
1437137708123781628,
16
]
]
The first value in the nested list is the timestamp (the number of milliseconds elapsed since January 1, 1970 UTC).
The second value is the stored measurement (integer or float).
*/
package main