Skip to content

Commit 2c26560

Browse files
authored
Merge pull request sonic-net#329 from sachinholla/stats_api
Add telemetry stats API info
2 parents 1d8de92 + b69e21e commit 2c26560

File tree

1 file changed

+106
-1
lines changed

1 file changed

+106
-1
lines changed

manageability/mgmt-framework/db_stats.md

+106-1
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ Management Framework DB Layer Statistics
77
| Rev | Date | Author | Change Description |
88
|:---:|:-----------:|:------------------:|-----------------------------------|
99
| 0.1 | 02/18/2022 | Arun Barboza | Initial version |
10+
| 0.2 | 03/14/2022 | Sachin Holla | Telemetry server stats |
1011

1112
# Scope
1213
This document describes the high level design of obtaining the [Management Framework](#management-framework) DB layer statistics.
@@ -83,8 +84,9 @@ A new table "TRANSLIB_DB" is introduced in ConfigDB. It is not expected to be us
8384
- Send SIGUSR2 (or the re-configure signal) to the rest_server to reconfigure
8485
- Reconfiguration, with a detectable change, clears the stats.
8586
- Perform the operations which need to have their DB usage instrumented.
86-
- Statistics are viewable using the GET method on https://ipaddress/debug/stats.
87+
- Statistics from REST server are viewable using the GET method on https://ipaddress/debug/stats.
8788
- Statistics are cleared using the DELETE method.
89+
- Statistics from Telemetry server can be managed using `GetStats` and `ClearStats` gRPC APIs from the "Debug" gNOI service
8890

8991
# Examples
9092

@@ -201,6 +203,109 @@ DB APIs Globals: New: 81 Delete: 81 PeakNew: 9 ZeroGetHits 69
201203
202204
```
203205

206+
## Collecting Statistics from Telemetry Server
207+
208+
`gnoi_client` program from the telemetry container can be used for dumping the statistics on any sonic switch.
209+
This program will also available on the build servers at `sonic-telemetry/build/bin` directory.
210+
Output will be a JSON value as shown below.
211+
212+
```text
213+
~ # docker exec telemetry gnoi_client -insecure -username admin -password YourPaSsWoRd -module Debug -rpc GetStats
214+
Unable to connect to syslogD
215+
{
216+
"cvl-stats": {
217+
"Hits": 0,
218+
"Time": 0,
219+
"Peak": 0
220+
},
221+
"db-stats": {
222+
"new-db": 24,
223+
"delete-db": 13,
224+
"peak-open": 20,
225+
"new-time": 25260500,
226+
"peak-new-time": 13473300,
227+
"zero-get-ops-db": 6,
228+
"dbs": [
229+
{
230+
"name": "APPL_DB",
231+
"all-tables": {
232+
"hits": 582,
233+
"total-time": 204580500,
234+
"peak-time": 1316600,
235+
"get-entry-hits": 372,
236+
"get-keys-hits": 106,
237+
"get-keys-pattern-hits": 210,
238+
"get-entry-time": 128736800,
239+
"get-keys-time": 39683300,
240+
"get-keys-pattern-time": 75843700,
241+
"get-entry-peak-time": 1316600,
242+
"get-keys-peak-time": 1257000,
243+
"get-keys-pattern-peak-time": 1257000
244+
},
245+
"all-maps": {}
246+
},
247+
{
248+
"name": "COUNTERS_DB",
249+
"all-tables": {
250+
"hits": 322,
251+
"total-time": 98935000,
252+
"peak-time": 9217000,
253+
"get-entry-hits": 322,
254+
"get-entry-time": 98935000,
255+
"get-entry-peak-time": 9217000
256+
},
257+
"all-maps": {
258+
"hits": 206,
259+
"total-time": 103472600,
260+
"peak-time": 1912100,
261+
"get-map-all-hits": 206,
262+
"get-map-all-time": 103472600,
263+
"get-map-all-peak-time": 1912100
264+
}
265+
},
266+
{
267+
"name": "CONFIG_DB",
268+
"all-tables": {
269+
"hits": 909,
270+
"total-time": 336121300,
271+
"peak-time": 12203100,
272+
"get-entry-hits": 589,
273+
"get-keys-hits": 216,
274+
"get-keys-pattern-hits": 320,
275+
"get-entry-time": 203859100,
276+
"get-keys-time": 84894200,
277+
"get-keys-pattern-time": 132262200,
278+
"get-entry-peak-time": 12203100,
279+
"get-keys-peak-time": 1191200,
280+
"get-keys-pattern-peak-time": 5866800
281+
},
282+
"all-maps": {}
283+
},
284+
{
285+
"name": "STATE_DB",
286+
"all-tables": {
287+
"hits": 106,
288+
"total-time": 35465800,
289+
"peak-time": 1170500,
290+
"get-entry-hits": 103,
291+
"get-keys-hits": 3,
292+
"get-keys-pattern-hits": 3,
293+
"get-entry-time": 33627900,
294+
"get-keys-time": 1837900,
295+
"get-keys-pattern-time": 1837900,
296+
"get-entry-peak-time": 1170500,
297+
"get-keys-peak-time": 840600,
298+
"get-keys-pattern-peak-time": 840600
299+
},
300+
"all-maps": {}
301+
}
302+
]
303+
}
304+
}
305+
```
306+
307+
Note: Time stats and table stats can be enabled similar to the REST server examples shown in previous sections.
308+
204309
# Limitations
205310

206311
## Only Read side instrumented

0 commit comments

Comments
 (0)