format_json, format_kairosdb: Don't enable beatification of JSON.
The code depends on the last character in the buffer being ']'. If
"beautification" is enabled, it will add a newline at the end, which
breaks the "append" mechanic.
format_json: Add support for appending metric_family_t's to the buffer.
With this change, multiple metric_family_t's can be added to a buffer
sequentially. The implementation that did not use libyajl has been
removed because it was unused (it only implemented marshalling of
value_list_t).
format_stackdriver: Check for counter reset in format_time_series().
Previously, this check was done in format_typed_value() when the time
series data was already partially written to the buffer. Doing the check
there would result in invalid JSON output.
Additionally, the comparison was the wrong way around, causing the
assertion to fail for all counter metrics.
common: Create the metric_family_t and metric_t types.
A "metric family" is a set of metrics, all with the same name (but
different labels and/or label values). The identity is split between the
two types: the "metric family" holds the "name" while the "metric" holds
the labels. Likewise, the "metric family" holds the metric type, the
"metric" holds the metric value.
This commit contains all required changes to compile the daemon, but
pretty much everything else still fails to build. The tests have not yet
updated either.
The "cpu plugin" has been updated as a proof-of-concept implementation.
* Struct "metric_t": unnecessary fields "type", "plugin", "ds" have
been removed. The field "value_ds_type" has been renamed to
"value_type".
* The reference counted, multiple instance "meta_data_list_head_t" type
has been removed. Manually doing the reference counting all over the
place is error prone and it seems like premature optimization.
* The "<type>_destroy" functions must handle NULL gracefully. Removed
NULL-checks around their invocation to improve readability.
* Struct "metric_t": unnecessary fields "type", "plugin", "ds" have
been removed. The field "value_ds_type" has been renamed to
"value_type".
* The reference counted, multiple instance "meta_data_list_head_t" type
has been removed. Manually doing the reference counting all over the
place is error prone and it seems like premature optimization.
* The "<type>_destroy" functions must handle NULL gracefully. Removed
NULL-checks around their invocation to improve readability.
* Struct "metric_t": unnecessary fields "type", "plugin", "ds" have
been removed. The field "value_ds_type" has been renamed to
"value_type".
* The reference counted, multiple instance "meta_data_list_head_t" type
has been removed. Manually doing the reference counting all over the
place is error prone and it seems like premature optimization.
* The "<type>_destroy" functions must handle NULL gracefully. Removed
NULL-checks around their invocation to improve readability.
* Struct "metric_t": unnecessary fields "type", "plugin", "ds" have
been removed. The field "value_ds_type" has been renamed to
"value_type".
* The reference counted, multiple instance "meta_data_list_head_t" type
has been removed. Manually doing the reference counting all over the
place is error prone and it seems like premature optimization.
* The "<type>_destroy" functions must handle NULL gracefully. Removed
NULL-checks around their invocation to improve readability.
* Struct "metric_t": unnecessary fields "type", "plugin", "ds" have
been removed. The field "value_ds_type" has been renamed to
"value_type".
* The reference counted, multiple instance "meta_data_list_head_t" type
has been removed. Manually doing the reference counting all over the
place is error prone and it seems like premature optimization.
* The "<type>_destroy" functions must handle NULL gracefully. Removed
NULL-checks around their invocation to improve readability.
barometer, python plugins: Reworked some code in src/daemon/plugin.[ch].
Unfortunately it's all a bit messy and entangled. Since this is such
an early WIP, I didn't spend the (substantial) time needed to pick this
into separate changes. The changes in this commit are:
* Create a consistent naming schema for the identity functions:
* Rename "create_identity" to "identity_create_legacy".
* Rename "clone_identity" to "identity_clone".
* Rename "destroy_identity" to "identity_destroy".
* Add "identity_create" to allocate a new identity_t.
* Copy key and value strings within "identity_add_label".
* Make use of "identity_create" and "identity_add_label" in
"identity_clone", "identity_create_legacy" and others that used
to fiddle with the AVL tree directly.
* Remove the "_p" suffix used for pointers. This is quite unusual for
the collectd codebase.
cmds: Reworked some code in src/daemon/plugin.[ch].
Unfortunately it's all a bit messy and entangled. Since this is such
an early WIP, I didn't spend the (substantial) time needed to pick this
into separate changes. The changes in this commit are:
* Create a consistent naming schema for the identity functions:
* Rename "create_identity" to "identity_create_legacy".
* Rename "clone_identity" to "identity_clone".
* Rename "destroy_identity" to "identity_destroy".
* Add "identity_create" to allocate a new identity_t.
* Copy key and value strings within "identity_add_label".
* Make use of "identity_create" and "identity_add_label" in
"identity_clone", "identity_create_legacy" and others that used
to fiddle with the AVL tree directly.
* Remove the "_p" suffix used for pointers. This is quite unusual for
the collectd codebase.
This commit is where the major transform takes palce; the internal
representation is changed, and the read plugins use that indirectly
when they submit a value list transparently.
The baromerter read plugin has been converted to using metric_t
representation natively.
The write plugins have to be adapted to use these new single data
source metrics.
This commit is where the major transform takes palce; the internal
representation is changed, and the read plugins use that indirectly
when they submit a value list transparently.
The baromerter read plugin has been converted to using metric_t
representation natively.
The write plugins have to be adapted to use these new single data
source metrics.
This commit is where the major transform takes palce; the internal
representation is changed, and the read plugins use that indirectly
when they submit a value list transparently.
The baromerter read plugin has been converted to using metric_t
representation natively.
The write plugins have to be adapted to use these new single data
source metrics.
This commit is where the major transform takes palce; the internal
representation is changed, and the read plugins use that indirectly
when they submit a value list transparently.
The baromerter read plugin has been converted to using metric_t
representation natively.
The write plugins have to be adapted to use these new single data
source metrics.
This commit is where the major transform takes palce; the internal
representation is changed, and the read plugins use that indirectly
when they submit a value list transparently.
The baromerter read plugin has been converted to using metric_t
representation natively.
The write plugins have to be adapted to use these new single data
source metrics.
This commit is where the major transform takes palce; the internal
representation is changed, and the read plugins use that indirectly
when they submit a value list transparently.
The baromerter read plugin has been converted to using metric_t
representation natively.
The write plugins have to be adapted to use these new single data
source metrics.
src/daemon/utils_cache.c: Don't overwrite the meta data of existing entries.
The cache entry's meta data is not the same as the metric's meta data.
Overwriting the cache entry's meta data breaks a number of plugins,
including the network and write_stackdriver plugins.
daemon: Create the metric_family_t and metric_t types.
A "metric family" is a set of metrics, all with the same name (but
different labels and/or label values). The identity is split between the
two types: the "metric family" holds the "name" while the "metric" holds
the labels. Likewise, the "metric family" holds the metric type, the
"metric" holds the metric value.
This commit contains all required changes to compile the daemon, but
pretty much everything else still fails to build. The tests have not yet
updated either.
* Rename variables to fit the naming schema better.
* Improve the error message. value_to_metric() can and has failed for
other reasons than out of memory.
Florian Forster [Wed, 24 Jun 2020 20:06:11 +0000 (22:06 +0200)]
src/daemon/plugin.[ch]: Ensure that "time" and "interval" are set at enqueue time.
This also ensures that an "instance" label (as used by the Prometheus
collectd exporter) exists. This is currently essentially a placeholder
for target labels.
* Struct "metric_t": unnecessary fields "type", "plugin", "ds" have
been removed. The field "value_ds_type" has been renamed to
"value_type".
* The reference counted, multiple instance "meta_data_list_head_t" type
has been removed. Manually doing the reference counting all over the
place is error prone and it seems like premature optimization.
* The "<type>_destroy" functions must handle NULL gracefully. Removed
NULL-checks around their invocation to improve readability.
daemon: Reworked some code in src/daemon/plugin.[ch].
Unfortunately it's all a bit messy and entangled. Since this is such
an early WIP, I didn't spend the (substantial) time needed to pick this
into separate changes. The changes in this commit are:
* Create a consistent naming schema for the identity functions:
* Rename "create_identity" to "identity_create_legacy".
* Rename "clone_identity" to "identity_clone".
* Rename "destroy_identity" to "identity_destroy".
* Add "identity_create" to allocate a new identity_t.
* Copy key and value strings within "identity_add_label".
* Make use of "identity_create" and "identity_add_label" in
"identity_clone", "identity_create_legacy" and others that used
to fiddle with the AVL tree directly.
* Remove the "_p" suffix used for pointers. This is quite unusual for
the collectd codebase.
This commit is where the major transform takes palce; the internal
representation is changed, and the read plugins use that indirectly
when they submit a value list transparently.
The baromerter read plugin has been converted to using metric_t
representation natively.
The write plugins have to be adapted to use these new single data
source metrics.
[metric-label-support]: Modify write queue to use metric_t
This commit adds an updated write queue data structure, and updates
the enqueue and dequeue calling paths. Note that while this compiles
and the tests pass, thisis not a functioning collectd by itself, the
caching and networking code is a work in progress.
Manoj Srivastava [Wed, 20 Nov 2019 18:03:40 +0000 (10:03 -0800)]
[metric-label-support]: Utility to convert value_list_t to metric_t
This is another step in implementing the proposal defined in the
document "Adding Labels to Collectd Metrics"
- https://docs.google.com/document/d/173gGP3tUD3yfN2NNHxCv0BsKsacfDlSyoaQIn7MqLtQ/edit?usp=sharing
This commit adds a utility method to convert from the old metric
represetation to a the new datastructures updated as per the document:
"Compare data structures for metric labels (collectd)"
- https://docs.google.com/document/d/1RZ7YAO6lWcDDvevzxFGVDgv4UQpdgWoT7OCP9Vpb2CU/edit?usp=sharing
This method is designed to be called from plugindispatch_values during
the transition period before read plugins are amended to use the
metric_t data structure directly.
This commit adds no change in behaviour or functionality, but cleans
up a few diagnostic, updates the metrics_t data structure to add
names of the type and subtype, and fixes a space/tab anpmaly.. The
tests still work.
This is the initial commit on the proposal defined in the document
"Adding Labels to Collectd Metrics"
- https://docs.google.com/document/d/173gGP3tUD3yfN2NNHxCv0BsKsacfDlSyoaQIn7MqLtQ/edit?usp=sharing
With the datastructures updated as per the document:
"Compare data structures for metric labels (collectd)"
- https://docs.google.com/document/d/1RZ7YAO6lWcDDvevzxFGVDgv4UQpdgWoT7OCP9Vpb2CU/edit?usp=sharing
This commit adds the initial declaration and definition of the basic
data structure, and sets up the build system to add in unit testing
for the label store, the identity and metrics data streuctures.
Florian Forster [Sun, 21 Jun 2020 16:33:58 +0000 (18:33 +0200)]
src/daemon/metric.[ch]: Data types and functions representing metrics.
This implementation closely mirrors the Prometheus / OpenMetrics
protocol buffer.
A "metric family" is a set of metrics, all with the same name (but
different labels and/or label values). The identity is split between the
two types: the "metric family" holds the "name" while the "metric" holds
the labels. Likewise, the "metric family" holds the metric type, the
"metric" holds the metric value.
This commit contains all required changes to compile the daemon, but
pretty much everything else still fails to build. The tests have not yet
updated either.
The metric_marshal_text() function uses a strbuf_t* and generates the
OpenMetric exposition format.