A typical sort of plugin I'd like nolo to support would work like this:
% ./app_plugin
connections_open 216 time=1200928930 type=uint16 host=darkstar
requests 153 release=2.24.2.4271 type=uint8 host=darkstar
While I'm interesting in writing pure adapters for things like collectd and ganglia, I'd like a JSON adapter so it's easy to prototype adapters. Here's a naive way of structuring that data:
% nolo-json ./app_plugin
{
"app-plugin": {
"connections_open": {
"value": 216,
"time": 1200928930,
"type": "uint16",
"host": "darkstar"
},
"requests": {
"value": 153,
"release": "2.24.2.4271"
"type": "uint8",
"host": "darkstar"
}
}
}
But there's one obvious problem with this approach, you can't have more than a single metric with the same identifier. For most systems, this would be nonsense. But OpenTSDB encourages folks to reuse identifiers and break them down by metadata. So to support multiple metrics with the same identifier, we can stop using identifiers as the key for a metrics. Instead, we'll just use an array of metrics:
% nolo-json ./app_plugin
{
"app-plugin": [
{
"connections_open": {
"value": 216,
"time": 1200928930,
"type": "uint16",
"host": "darkstar"
}
},
{
"requests": {
"value": 153,
"release": "2.24.2.4271"
"type": "uint8",
"host": "darkstar"
}
}
]
}
But while this is an easy refactoring of the naive format, it looks silly having an object with a single key. Let's try flattening it so all the data is at the same depth:
% nolo-json ./app_plugin
{
"app-plugin": [
{
"identifier": "connections_open",
"value": 216,
"time": 1200928930,
"type": "uint16",
"host": "darkstar"
},
{
"identifier: "requests",
"value": 153,
"release": "2.24.2.4271"
"type": "uint8",
"host": "darkstar"
}
]
}
This looks great. The only remaining problem is that now we're
constraining the metadata namespace so it can't contain identifier
or
value
. I have a feeling that nolo is going to need to stake claim to
the semantics of few metadata terms (probably a hostname in host
,
timestamp in time
, and metric data type in type
), so I'm not quite
ready to agree to this format:
% nolo-json ./app_plugin
{
"app-plugin": [
{
"identifier": "connections_open",
"value": 216,
"metadata": {
"time": 1200928930,
"type": "uint16",
"host": "darkstar"
}
},
{
"identifier: "requests",
"value": 153,
"metadata": {
"release": "2.24.2.4271"
"type": "uint8",
"host": "darkstar"
}
}
]
}