[collectd] Change the model of host/plugin-plugin_instance/type-type_instance to a tag model.

Manuel Luis Sanmartín Rozada manuel.luis at gmail.com
Sat Nov 19 19:44:03 CET 2016


Hello.

For me, the collectd model of host/plugin-plugin_instance/type-type_instance
was worked well for host metrics and for backends like rrdtool or graphite,
but when you collect metrics from applications or need to add some info you
start to overload plugin_instance and type_instance appending strings.
And when you write the metrics into influxdb or opentsb, for example, you
lost some flexibility in the queries.

We can use the meta data to add more info to the metrics but currently it's
not handled in the network plugin and the majority of write plugins ignore
them.

Thinking in the future, you will have more complex metrics (people like to
monitor everything) and a tag system could be more flexible.

I'm thinking of a model like the one that opentsdb, prometheus or influxdb
has:

        <metric> <timestamp> <valuek1=valuev1[ valuek2=valuev2 ..
valuekN=valuevN]> <tagk1=tagv1[ tagk2=tagv2 ...tagkN=tagvN]>

for example:

        cpu  1479577385.274 user=12688371,nice=7391,
system=961387,idle=78450115,iowait=65758,irq=0,softirq=
33943,steal=0,guest=0,guest_nice=0   host=localhost.localdomain,
rack=23,zone=eu

This could be easily converted to a path for rrd with a template or strings
if the tags are sorted for graphite (
localhost_localdomain.rack-23.zone-eu.cpu.user
)

I know, it's a big change that will generate some compatibility problems
with older versions and a lot of changes in the code, maybe it could be
addressed in the major version like the 6, in the end, I think it will give
to collectd a great flexibility.

For clarify, without entering in the implementation: if tags and values
should be a list, ordered list, hashtable, avl  etc... , the value_list_t
could be:

typedef enum value_type_u {
  VALUE_TYPE_COUNTER,
  VALUE_TYPE_GAUGE,
  VALUE_TYPE_DERIVE,
  VALUE_TYPE_ABSOLUTE
} value_type_t;

typedef union value_u {
  counter_t  counter;
  gauge_t    gauge;
  derive_t   derive;
  absolute_t absolute;
} value_t;

typedef struct value_entry_u {
  char         *key;
  value_t       value
  value_type_t  type;
} value_entry_t;

typedef union tag_u {
  char    *tv_string;
  int64_t  tv_signed_int;
  uint64_t tv_unsigned_int;
  double   tv_double;
  _Bool    tv_boolean;
} tag_value_t;

typedef enum tag_type_u {
  TAG_TYPE_STRING,
  TAG_TYPE_SIGNED_INT,
  TAG_TYPE_UNSIGNED_INT,
  TAG_TYPE_DOUBLE,
  TAG_TYPE_BOOLEAN
} tag_type_t;

typedef struct tag_entry_s {
  char         *key;
  tag_value_t   value;
  tag_type_t    type;
} tag_entry_t;

typedef struct value_list_s {
  char           *metric;
  tag_entry_t    *tags;
  size_t          tags_len;
  value_entry_t  *values;
  size_t          values_len;
  cdtime_t        time;
  cdtime_t        interval;
} value_list_t;
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.verplant.org/pipermail/collectd/attachments/20161119/966edc33/attachment.html>


More information about the collectd mailing list