Skip to content

Commit 2c39036

Browse files
authored
Merge pull request #181 from HarperDB/add-analytics-ops
Add docs for new analytics ops
2 parents 70941db + 557f51d commit 2c39036

File tree

1 file changed

+121
-0
lines changed

1 file changed

+121
-0
lines changed
Lines changed: 121 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,121 @@
1+
# Analytics Operations
2+
3+
## get_analytics
4+
Retrieves analytics data from the server.
5+
6+
* operation _(required)_ - must always be `get_analytics`
7+
* metric _(required)_ - any value returned by `list_metrics`
8+
* start_time _(optional)_ - Unix timestamp in seconds
9+
* end_time _(optional)_ - Unix timestamp in seconds
10+
* get_attributes _(optional)_ - array of attribute names to retrieve
11+
* conditions _(optional)_ - array of conditions to filter results (see [search_by_conditions docs](docs/developers/operations-api/nosql-operations.md) for details)
12+
13+
### Body
14+
15+
```json
16+
{
17+
"operation": "get_analytics",
18+
"metric": "resource-usage",
19+
"start_time": 1609459200,
20+
"end_time": 1609545600,
21+
"get_attributes": ["id", "metric", "userCPUTime", "systemCPUTime"],
22+
"conditions": [
23+
{
24+
"attribute": "node",
25+
"operator": "equals",
26+
"value": "node1.example.com"
27+
}
28+
]
29+
}
30+
```
31+
32+
### Response 200
33+
34+
```json
35+
[
36+
{
37+
"id": "12345",
38+
"metric": "resource-usage",
39+
"userCPUTime": 100,
40+
"systemCPUTime": 50
41+
},
42+
{
43+
"id": "67890",
44+
"metric": "resource-usage",
45+
"userCPUTime": 150,
46+
"systemCPUTime": 75
47+
}
48+
]
49+
```
50+
51+
## list_metrics
52+
Returns a list of available metrics that can be queried.
53+
54+
* operation _(required)_ - must always be `list_metrics`
55+
* metric_types _(optional)_ - array of metric types to filter results; one or both of `custom` and `builtin`; default is `builtin`
56+
57+
### Body
58+
59+
```json
60+
{
61+
"operation": "list_metrics",
62+
"metric_types": ["custom", "builtin"]
63+
}
64+
```
65+
66+
### Response 200
67+
68+
```json
69+
[
70+
"resource-usage",
71+
"table-size",
72+
"database-size",
73+
"main-thread-utilization",
74+
"utilization",
75+
"storage-volume"
76+
]
77+
```
78+
79+
## describe_metric
80+
Provides detailed information about a specific metric, including its structure and available parameters.
81+
82+
* operation _(required)_ - must always be `describe_metric`
83+
* metric _(required)_ - name of the metric to describe
84+
85+
### Body
86+
87+
```json
88+
{
89+
"operation": "describe_metric",
90+
"metric": "resource-usage"
91+
}
92+
```
93+
94+
### Response 200
95+
96+
```json
97+
{
98+
"attributes": [
99+
{
100+
"name": "id",
101+
"type": "number"
102+
},
103+
{
104+
"name": "metric",
105+
"type": "string"
106+
},
107+
{
108+
"name": "userCPUTime",
109+
"type": "number"
110+
},
111+
{
112+
"name": "systemCPUTime",
113+
"type": "number"
114+
},
115+
{
116+
"name": "node",
117+
"type": "string"
118+
}
119+
]
120+
}
121+
```

0 commit comments

Comments
 (0)