|
| 1 | +# Query/Response Events |
| 2 | + |
| 3 | +## Metrics or "Stats" |
| 4 | + |
| 5 | +Participating nodes in a Query/Response topology will broadcast events of structured statistics for the UI and monitoring applications to consume. The common data-shape encapsulates a way to communicate measurements, events, and node-identifying and describing meta-data. |
| 6 | + |
| 7 | +The entry structure and format is encoded as a JSON UTF-8 encoded string. |
| 8 | + |
| 9 | +```json |
| 10 | +{ |
| 11 | + "elements": [ |
| 12 | + { |
| 13 | + "key": "<string>", |
| 14 | + "value": "<string|number|boolean>", |
| 15 | + "timestamp": "<OPTIONAL:number>", |
| 16 | + "uuid": "<OPTIONAL:string>" |
| 17 | + } |
| 18 | + // ... |
| 19 | + ] |
| 20 | +} |
| 21 | +``` |
| 22 | + |
| 23 | +The `key` and `value` property pairs are used to encode any measurement. The `timestamp` is an optional property, that can be used to associate a measurement with a point in time since the EPOCH, in milliseconds. |
| 24 | + |
| 25 | +The `uuid` property is used to identify the publishing node during its lifetime—effectively creating an aggregate for statistics to present. This means that in practice there are operational metrics which may _come and go_ as well as logical statistics which may pertain to the topology or cluster of nodes. |
| 26 | + |
| 27 | +### Table of published statistics |
| 28 | + |
| 29 | +| Key | Value | Timestamp | UUID | Description | |
| 30 | +|---------------------------|---------|-----------|--------|-----------------------------------------------------------------------------| |
| 31 | +| `name` | string | - | ✓ | Name or identity of the node, or `application` | |
| 32 | +| `pid` | string | - | ✓ | Node process id, or `-` | |
| 33 | +| `host` | string | - | ✓ | Node hostname, or `unknown` | |
| 34 | +| `uptime` | string | - | ✓ | Node uptime, or `-` | |
| 35 | +| `only_responses` | boolean | - | ✓ | Whether node has only responded `true`, or published queries `false` | |
| 36 | +| `count_queries` | number | - | ✓ | Number of published queries | |
| 37 | +| `count_consumed_responses`| number | - | ✓ | Number of consumed responses | |
| 38 | +| `count_published_responses`| number | - | ✓ | Number of published responses | |
| 39 | +| `count_fallbacks` | number | - | ✓ | Number of _fallbacks_ (no responses) | |
| 40 | +| `max_latency` | number | - | ✓ | Largest recorded time between query and response, in milliseconds | |
| 41 | +| `min_latency` | number | - | ✓ | Smallest recorded time between query and response, in milliseconds | |
| 42 | +| `avg_latency` | number | - | ✓ | Average time between query and response, in milliseconds | |
| 43 | +| `throughput_queries` | number | ✓ | ✓ | Number of queries published, since last notification | |
| 44 | +| `throughput_responses` | number | ✓ | ✓ | Number of responses consumed, since last notification | |
0 commit comments