Skip to content

Instantly share code, notes, and snippets.

@luhenry
Created March 31, 2014 19:52
Show Gist options
  • Save luhenry/9900756 to your computer and use it in GitHub Desktop.
Save luhenry/9900756 to your computer and use it in GitHub Desktop.
DEFINITIONS:
Agent : running in the Mono VM, tcp client or write to a file, in charge of : sending the samples to the inspector, execute add/remove/list counters commands.
Inspector : tcp server or read a file, in charge of : displaying samples, send add/remove/lists counters commands. Can be written in any language that support socket or file streaming.
TYPES:
remark: there is two ways to send a list of values :
- first, you can send the count first, and then the values
- second, you send the values and finish the list by an end value ( marked as ‘type…endtype(value = end)’ )
Char:
[value: 1 byte]
Short:
[value: 2 bytes]
Int:
[value: 4 bytes]
Long:
[value: 8 bytes]
Double:
[value: 8 bytes]
String: if value == null, then length = -1 and there is no value;
[length: int]
[value: length * char]
Header: describe a counter that is going to be sent during sampling
[category: int]
[name: string]
[type: int]
[unit: int]
[variance: int]
[index: short]
Headers: list of header
[count: short] number of header
[value: count * header]
Counter:
[name: string]
[category: string]
Value:
[index: short]
[size: short]
[value: size * char]
ResponseStatus:
[id: char] possible values : { 0x00: OK, 0x01: NOK, 0x02: NOTFOUND, 0x03: EXISTING }
COMMANDS:
Hello: first command of the protocol, sent by the agent to the inspector on connection. One way from agent to inspector.
[cmd: char] 0
[version: short] version of the protocol, currently 0.1 => 1
[headers: headers] the agent counters headers.
List counters: list all the mono counters that are available for sampling. Request-Response from inspector to agent.
Request:
[cmd: char(value = 1)]
Response:
[cmd: char(value = 1)]
[mono counter: counter…string(value = null)]
Add Counter: add a counter to the sample set. Request-Response from inspector to agent.
Request:
[cmd: char(value = 2)]
[name: string]
[category: string]
Response:
[cmd: char(value = 2)]
[status: response_status]
[header: header]
Remove Counter: remove counter from the sample set. Request-Response from inspector to agent.
Request:
[cmd: char(value = 3)]
[index: short]
Response:
[cmd: char(value = 3)]
[status: response_status]
Sampling: actual sampling of the data. One way from agent to inspector.
[cmd: 4]
[timestamp: long]
[values: value…short(value = -1)]
Good Bye: close the connection. One way from inspector to agent.
[cmd: 127]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment