]> git.ipfire.org Git - thirdparty/collectd.git/log
thirdparty/collectd.git
5 years agocpu plugin: Convert to the new metric_family_t structure.
Florian Forster [Fri, 17 Jul 2020 11:14:09 +0000 (13:14 +0200)] 
cpu plugin: Convert to the new metric_family_t structure.

5 years agothreshold plugin: Fix a debug message.
Florian Forster [Fri, 17 Jul 2020 11:13:18 +0000 (13:13 +0200)] 
threshold plugin: Fix a debug message.

5 years agocommon: Create the metric_family_t and metric_t types.
Florian Forster [Fri, 17 Jul 2020 11:12:33 +0000 (13:12 +0200)] 
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.

# Conflicts:
# src/daemon/plugin.h

5 years agoformat_kairosdb: s/metric_t/metric_single_t/
Florian Forster [Fri, 17 Jul 2020 11:10:36 +0000 (13:10 +0200)] 
format_kairosdb: s/metric_t/metric_single_t/

5 years agoformat_json: s/metric_t/metric_single_t/
Florian Forster [Fri, 17 Jul 2020 11:10:26 +0000 (13:10 +0200)] 
format_json: s/metric_t/metric_single_t/

5 years agoformat_graphite: s/metric_t/metric_single_t/
Florian Forster [Fri, 17 Jul 2020 11:10:13 +0000 (13:10 +0200)] 
format_graphite: s/metric_t/metric_single_t/

5 years agocommon: s/metric_t/metric_single_t/
Florian Forster [Fri, 17 Jul 2020 11:10:04 +0000 (13:10 +0200)] 
common: s/metric_t/metric_single_t/

5 years agocmds: s/metric_t/metric_single_t/
Florian Forster [Fri, 17 Jul 2020 11:09:55 +0000 (13:09 +0200)] 
cmds: s/metric_t/metric_single_t/

5 years agoVarious: s/metric_t/metric_single_t/g
Florian Forster [Fri, 17 Jul 2020 11:08:51 +0000 (13:08 +0200)] 
Various: s/metric_t/metric_single_t/g

5 years agowrite_log plugin: Update to the new interfaces of format_{graphite,json}.
Florian Forster [Wed, 24 Jun 2020 20:32:31 +0000 (22:32 +0200)] 
write_log plugin: Update to the new interfaces of format_{graphite,json}.

5 years agoMakefile.am: Link libplugin_mock.la with libmetadata.la.
Florian Forster [Fri, 17 Jul 2020 11:06:38 +0000 (13:06 +0200)] 
Makefile.am: Link libplugin_mock.la with libmetadata.la.

5 years agoformat_json: Reimplement format_json_metric().
Florian Forster [Wed, 24 Jun 2020 09:08:01 +0000 (11:08 +0200)] 
format_json: Reimplement format_json_metric().

This new implementation uses the new format of the metric_t type.
It produces output that is compatible with the prometheus/prom2json
project.

5 years agocmds: Fix putval so it compiles.
Florian Forster [Tue, 23 Jun 2020 10:11:16 +0000 (12:11 +0200)] 
cmds: Fix putval so it compiles.

This is a stop-gap solution. I think we need to come up with a nicer way
of encoding the metric identity for PUTVAL commands.

5 years agoMakefile.am: Link the daemon with libmetadata.la.
Florian Forster [Tue, 23 Jun 2020 08:49:14 +0000 (10:49 +0200)] 
Makefile.am: Link the daemon with libmetadata.la.

Instead of re-compiling utils/metadata/meta_data.c.

5 years agosrc/utils/cmds/getthreshold.c: Adapt to the new metric_t structure.
Florian Forster [Sun, 21 Jun 2020 17:52:21 +0000 (19:52 +0200)] 
src/utils/cmds/getthreshold.c: Adapt to the new metric_t structure.

5 years agoVarious: Changes because src/daemon/metric.[ch] was created.
Florian Forster [Fri, 17 Jul 2020 11:21:48 +0000 (13:21 +0200)] 
Various: Changes because src/daemon/metric.[ch] was created.

5 years agowrite_graphite: Update to the new format_graphite interface.
Florian Forster [Sun, 21 Jun 2020 15:09:40 +0000 (17:09 +0200)] 
write_graphite: Update to the new format_graphite interface.

5 years agoformat_graphite: Basically a rewrite for metric_t.
Florian Forster [Sun, 21 Jun 2020 14:46:02 +0000 (16:46 +0200)] 
format_graphite: Basically a rewrite for metric_t.

5 years agocommon: Simplify notification_init_metric() so it compiles.
Florian Forster [Thu, 18 Jun 2020 07:15:50 +0000 (09:15 +0200)] 
common: Simplify notification_init_metric() so it compiles.

This function is not yet complete; a bunch of TODOs have been left in
the code.

5 years agoperl plugin: More cleanups.
Florian Forster [Fri, 17 Jul 2020 10:43:49 +0000 (12:43 +0200)] 
perl plugin: More cleanups.

*   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.

# Conflicts:
# src/daemon/metrics_list_test.c

5 years agoformat_kairosdb: More cleanups.
Florian Forster [Fri, 17 Jul 2020 10:43:34 +0000 (12:43 +0200)] 
format_kairosdb: More cleanups.

*   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.

# Conflicts:
# src/daemon/metrics_list_test.c

5 years agoformat_json: More cleanups.
Florian Forster [Fri, 17 Jul 2020 10:43:13 +0000 (12:43 +0200)] 
format_json: More cleanups.

*   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.

# Conflicts:
# src/daemon/metrics_list_test.c

5 years agoformat_graphite: More cleanups.
Florian Forster [Fri, 17 Jul 2020 10:43:01 +0000 (12:43 +0200)] 
format_graphite: More cleanups.

*   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.

# Conflicts:
# src/daemon/metrics_list_test.c

5 years agocommon: More cleanups.
Florian Forster [Fri, 17 Jul 2020 10:42:42 +0000 (12:42 +0200)] 
common: More cleanups.

*   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.

# Conflicts:
# src/daemon/metrics_list_test.c

5 years agobarometer, python plugins: Reworked some code in src/daemon/plugin.[ch].
Florian Forster [Fri, 17 Jul 2020 10:29:28 +0000 (12:29 +0200)] 
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.

# Conflicts:
# src/daemon/metrics_list_test.c

5 years agocmds: Reworked some code in src/daemon/plugin.[ch].
Florian Forster [Fri, 17 Jul 2020 10:29:09 +0000 (12:29 +0200)] 
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.

# Conflicts:
# src/daemon/metrics_list_test.c

5 years agoVarious: Use metric_t internally
Florian Forster [Fri, 17 Jul 2020 10:28:07 +0000 (12:28 +0200)] 
Various: Use metric_t internally

This is a WIP

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.

Signed-off-by: Manoj Srivastava <srivasta@google.com>
Change-Id: I9bdeaa59de5c58d11c0ae0e7b55d68d9e4d77fa1

# Conflicts:
# src/daemon/metrics_list_test.c

5 years agoformat_kairosdb: Use metric_t internally
Florian Forster [Fri, 17 Jul 2020 10:27:34 +0000 (12:27 +0200)] 
format_kairosdb: Use metric_t internally

This is a WIP

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.

Signed-off-by: Manoj Srivastava <srivasta@google.com>
Change-Id: I9bdeaa59de5c58d11c0ae0e7b55d68d9e4d77fa1

# Conflicts:
# src/daemon/metrics_list_test.c

5 years agoformat_json: Use metric_t internally
Florian Forster [Fri, 17 Jul 2020 10:27:23 +0000 (12:27 +0200)] 
format_json: Use metric_t internally

This is a WIP

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.

Signed-off-by: Manoj Srivastava <srivasta@google.com>
Change-Id: I9bdeaa59de5c58d11c0ae0e7b55d68d9e4d77fa1

# Conflicts:
# src/daemon/metrics_list_test.c

5 years agoformat_graphite: Use metric_t internally
Florian Forster [Fri, 17 Jul 2020 10:26:57 +0000 (12:26 +0200)] 
format_graphite: Use metric_t internally

This is a WIP

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.

Signed-off-by: Manoj Srivastava <srivasta@google.com>
Change-Id: I9bdeaa59de5c58d11c0ae0e7b55d68d9e4d77fa1

# Conflicts:
# src/daemon/metrics_list_test.c

5 years agocommon: Use metric_t internally
Florian Forster [Fri, 17 Jul 2020 10:26:37 +0000 (12:26 +0200)] 
common: Use metric_t internally

This is a WIP

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.

Signed-off-by: Manoj Srivastava <srivasta@google.com>
Change-Id: I9bdeaa59de5c58d11c0ae0e7b55d68d9e4d77fa1

# Conflicts:
# src/daemon/metrics_list_test.c

5 years agocmds: Use metric_t internally
Florian Forster [Fri, 17 Jul 2020 10:26:16 +0000 (12:26 +0200)] 
cmds: Use metric_t internally

This is a WIP

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.

Signed-off-by: Manoj Srivastava <srivasta@google.com>
Change-Id: I9bdeaa59de5c58d11c0ae0e7b55d68d9e4d77fa1

# Conflicts:
# src/daemon/metrics_list_test.c

5 years agocmds: Quick fix to get "getval" to compile.
Florian Forster [Wed, 29 Jul 2020 07:57:16 +0000 (09:57 +0200)] 
cmds: Quick fix to get "getval" to compile.

5 years agocmds: Quick fix to let "getthreshold" to compile.
Florian Forster [Wed, 29 Jul 2020 07:56:45 +0000 (09:56 +0200)] 
cmds: Quick fix to let "getthreshold" to compile.

5 years agoformat_stackdriver: Use the "uc_meta_data_{add,get}_…_vl" dummy functions.
Florian Forster [Wed, 29 Jul 2020 07:57:59 +0000 (09:57 +0200)] 
format_stackdriver: Use the "uc_meta_data_{add,get}_…_vl" dummy functions.

5 years agodaemon: Add uc_meta_data_{add,get}_…_vl dummy functions.
Florian Forster [Wed, 29 Jul 2020 07:55:20 +0000 (09:55 +0200)] 
daemon: Add uc_meta_data_{add,get}_…_vl dummy functions.

Their only purpose is to make the "format_stackdriver" utility compile.
They will be removed once the utility is updated to use metric_t instead.

5 years agodaemon: Add "plugin_instance" and "type_instance" back to threshold_t.
Florian Forster [Wed, 29 Jul 2020 07:56:05 +0000 (09:56 +0200)] 
daemon: Add "plugin_instance" and "type_instance" back to threshold_t.

5 years agodaemon: Add "plugin_instance" and "type_instance" back to identifier_t.
Florian Forster [Wed, 29 Jul 2020 07:53:41 +0000 (09:53 +0200)] 
daemon: Add "plugin_instance" and "type_instance" back to identifier_t.

5 years agoTree wide: uc_get_rate → uc_get_rate_vl
Florian Forster [Tue, 28 Jul 2020 19:14:02 +0000 (21:14 +0200)] 
Tree wide: uc_get_rate → uc_get_rate_vl

5 years agoMakefile.am: Compile "utils_llist" only once.
Florian Forster [Fri, 17 Jul 2020 15:48:08 +0000 (17:48 +0200)] 
Makefile.am: Compile "utils_llist" only once.

5 years agosrc/daemon/plugin.c: Refactor plugin_register_flush().
Florian Forster [Wed, 8 Jul 2020 21:07:26 +0000 (23:07 +0200)] 
src/daemon/plugin.c: Refactor plugin_register_flush().

5 years agosrc/daemon/utils_cache.c: Don't overwrite the meta data of existing entries.
Florian Forster [Thu, 2 Jul 2020 10:09:13 +0000 (12:09 +0200)] 
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.

5 years agosrc/daemon/utils_cache_mock.c: Migrate from "metric_single_t" to "metric_t".
Florian Forster [Thu, 16 Jul 2020 16:20:00 +0000 (18:20 +0200)] 
src/daemon/utils_cache_mock.c: Migrate from "metric_single_t" to "metric_t".

5 years agosrc/daemon/identity.[ch]: Remove; superseded by metric_family_t and metric_t.
Florian Forster [Mon, 29 Jun 2020 08:57:14 +0000 (10:57 +0200)] 
src/daemon/identity.[ch]: Remove; superseded by metric_family_t and metric_t.

5 years agosrc/daemon/plugin.c: Check argument to plugin_dispatch_metric_family().
Florian Forster [Mon, 29 Jun 2020 08:42:32 +0000 (10:42 +0200)] 
src/daemon/plugin.c: Check argument to plugin_dispatch_metric_family().

5 years agosrc/daemon/plugin.c: Migrate from "metric_list_add" to "metric_family_metric_append".
Florian Forster [Thu, 16 Jul 2020 16:18:34 +0000 (18:18 +0200)] 
src/daemon/plugin.c: Migrate from "metric_list_add" to "metric_family_metric_append".

5 years agosrc/daemon/{plugin,utils_threshold}.c: Replace "label_set_get" with "metric_label_get".
Florian Forster [Thu, 16 Jul 2020 16:17:03 +0000 (18:17 +0200)] 
src/daemon/{plugin,utils_threshold}.c: Replace "label_set_get" with "metric_label_get".

5 years agodaemon: migrate to metric_parse_identity().
Florian Forster [Tue, 21 Jul 2020 17:00:53 +0000 (19:00 +0200)] 
daemon: migrate to metric_parse_identity().

5 years agodaemon: Create the metric_family_t and metric_t types.
Florian Forster [Fri, 17 Jul 2020 11:11:57 +0000 (13:11 +0200)] 
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.

5 years agodaemon: s/metric_t/metric_single_t/g
Florian Forster [Fri, 17 Jul 2020 11:09:28 +0000 (13:09 +0200)] 
daemon: s/metric_t/metric_single_t/g

5 years agosrd/daemon/utils_cache.c: Fix an invalid variable name in a DEBUG() statement.
Florian Forster [Wed, 24 Jun 2020 20:12:28 +0000 (22:12 +0200)] 
srd/daemon/utils_cache.c: Fix an invalid variable name in a DEBUG() statement.

5 years agosrc/daemon/plugin.c: Refactor plugin_convert_values_to_metrics().
Florian Forster [Wed, 24 Jun 2020 20:11:45 +0000 (22:11 +0200)] 
src/daemon/plugin.c: Refactor plugin_convert_values_to_metrics().

*   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.

5 years agosrc/daemon/plugin.c: Implement plugin_valuelist_to_identity().
Florian Forster [Wed, 24 Jun 2020 20:08:50 +0000 (22:08 +0200)] 
src/daemon/plugin.c: Implement plugin_valuelist_to_identity().

This new function maps a value_list_t to a identity_t, using the same
logic as the Prometheus collectd exporter and the write_prometheus plugin.

This should, eventually, replace identity_create_legacy().

5 years agosrc/daemon/plugin.[ch]: Ensure that "time" and "interval" are set at enqueue time.
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.

5 years agosrc/daemon/utils_cache.c: Add uc_meta_data_add_unsigned_int_vl().
Florian Forster [Wed, 24 Jun 2020 10:51:59 +0000 (12:51 +0200)] 
src/daemon/utils_cache.c: Add uc_meta_data_add_unsigned_int_vl().

With this change, the daemon (without plugins) compiles!

5 years agosrc/daemon/utils_cache.c: Update to the new identity_marshal_text() API.
Florian Forster [Tue, 23 Jun 2020 08:47:32 +0000 (10:47 +0200)] 
src/daemon/utils_cache.c: Update to the new identity_marshal_text() API.

5 years agodaemon: Changes because src/daemon/metric.[ch] was created.
Florian Forster [Thu, 16 Jul 2020 16:12:25 +0000 (18:12 +0200)] 
daemon: Changes because src/daemon/metric.[ch] was created.

5 years agosrc/daemon/utils_threshold.c: Remove access to obsolete metric_t fields.
Florian Forster [Thu, 18 Jun 2020 11:26:34 +0000 (13:26 +0200)] 
src/daemon/utils_threshold.c: Remove access to obsolete metric_t fields.

threshold_get() is mostly a placeholder for now; appropriate TODOs have
been left in the code.

5 years agosrc/daemon/utils_cache_mock.c: Fix function definitions to match the header file.
Florian Forster [Thu, 18 Jun 2020 09:22:09 +0000 (11:22 +0200)] 
src/daemon/utils_cache_mock.c: Fix function definitions to match the header file.

5 years agodaemon: Remove identity functions.
Florian Forster [Fri, 17 Jul 2020 10:57:35 +0000 (12:57 +0200)] 
daemon: Remove identity functions.

5 years agosrc/daemon/plugin.c: Add a bunch of TODOs to plugin_format_metric().
Florian Forster [Wed, 17 Jun 2020 13:25:21 +0000 (15:25 +0200)] 
src/daemon/plugin.c: Add a bunch of TODOs to plugin_format_metric().

Minor cleanups:
*   Replace "metric_p" with "m".
*   Use "identity_get_label" instead of "c_avl_get".
*   Declare variables late.

5 years agosrc/daemon/plugin.[ch]: Add stub for identity_parse().
Florian Forster [Wed, 17 Jun 2020 13:20:47 +0000 (15:20 +0200)] 
src/daemon/plugin.[ch]: Add stub for identity_parse().

No implementation yet; just trying to get the existing code to compile.

5 years agosrc/daemon/plugin.[ch]: Implement identity_compare().
Florian Forster [Wed, 17 Jun 2020 08:48:37 +0000 (10:48 +0200)] 
src/daemon/plugin.[ch]: Implement identity_compare().

5 years agodaemon: More cleanups.
Florian Forster [Fri, 17 Jul 2020 10:42:25 +0000 (12:42 +0200)] 
daemon: More cleanups.

*   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.

# Conflicts:
# src/daemon/metrics_list_test.c

5 years agodaemon: Reworked some code in src/daemon/plugin.[ch].
Florian Forster [Fri, 17 Jul 2020 10:28:49 +0000 (12:28 +0200)] 
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.

# Conflicts:
# src/daemon/metrics_list_test.c

5 years agodaemon: Use metric_t internally
Florian Forster [Fri, 17 Jul 2020 10:25:36 +0000 (12:25 +0200)] 
daemon: Use metric_t internally

This is a WIP

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.

Signed-off-by: Manoj Srivastava <srivasta@google.com>
Change-Id: I9bdeaa59de5c58d11c0ae0e7b55d68d9e4d77fa1

# Conflicts:
# src/daemon/metrics_list_test.c

5 years ago[metric-label-support]: Modify write queue to use metric_t
Manoj Srivastava [Tue, 3 Dec 2019 22:33:27 +0000 (14:33 -0800)] 
[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.

Signed-off-by: Manoj Srivastava <srivasta@google.com>
Change-Id: I7f41f9271abc481067b9bcdedf88d2c5b5da9bc9

5 years ago[metric-label-support]: Utility functions for the new data structure
Manoj Srivastava [Mon, 2 Dec 2019 17:11:47 +0000 (09:11 -0800)] 
[metric-label-support]: Utility functions for the new data structure

This commit adds utility function to clone and destroy identity and
metrics objects introduced earlier, and adds unit testing for them.

Signed-off-by: Manoj Srivastava <srivasta@google.com>
Change-Id: I87ffe1e4b8393be7a5a6e1c5714cd28e2cf0a355

5 years ago[metric-label-support]: Utility to convert value_list_t to metric_t
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.

The unit test serves as a example usage.

Signed-off-by: Manoj Srivastava <srivasta@google.com>
Change-Id: Iecfaf06355a53c1ad2951775ee3f331a852ef14d

5 years ago[metric-label-support]: Code cleanup
Manoj Srivastava [Tue, 8 Oct 2019 21:08:33 +0000 (14:08 -0700)] 
[metric-label-support]: Code cleanup

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.

Signed-off-by: Manoj Srivastava <srivasta@google.com>
Change-Id: I9e2d7283f2aaf5b7d67747bae7eb781b87fb4595

5 years ago[metric-label-support]: Initial setup
Manoj Srivastava [Thu, 26 Sep 2019 21:32:18 +0000 (14:32 -0700)] 
[metric-label-support]: Initial setup

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.

Signed-off-by: Manoj Srivastava <srivasta@google.com>
Change-Id: I29673ab36f75db2ac487ee6a22907e3deba2f965

5 years agosrc/daemon/metric.[ch]: Add metric_label_{get,set,reset}().
Florian Forster [Sun, 28 Jun 2020 19:07:27 +0000 (21:07 +0200)] 
src/daemon/metric.[ch]: Add metric_label_{get,set,reset}().

label_set_{get,add,reset} have been made static, providing the calling
code with a nicer API.

5 years agosrc/daemon/metric.[ch]: Data types and functions representing metrics.
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.

5 years agoMerge pull request #3508 from octo/metric_t
Florian Forster [Wed, 22 Jul 2020 04:48:05 +0000 (06:48 +0200)] 
Merge pull request #3508 from octo/metric_t

Implement metric_t and metric_family_t.

5 years agosrc/daemon/metric.[ch]: Improve doc comments. 3508/head
Florian Forster [Mon, 20 Jul 2020 19:30:05 +0000 (21:30 +0200)] 
src/daemon/metric.[ch]: Improve doc comments.

5 years agostatsd plugin: Rename "metric_type_t" to avoid a name clash.
Florian Forster [Fri, 17 Jul 2020 08:48:32 +0000 (10:48 +0200)] 
statsd plugin: Rename "metric_type_t" to avoid a name clash.

5 years agoformat_json: Rename "label_t" to "keyval_t" in test.
Florian Forster [Fri, 17 Jul 2020 08:36:52 +0000 (10:36 +0200)] 
format_json: Rename "label_t" to "keyval_t" in test.

This is to avoid a name clash with the type defined in "metric.h".

5 years agosrc/testing.h: Support NULL pointers in EXPECT_EQ_STR().
Florian Forster [Thu, 16 Jul 2020 16:20:27 +0000 (18:20 +0200)] 
src/testing.h: Support NULL pointers in EXPECT_EQ_STR().

Changes in "format_graphite" fix the following error:

./src/testing.h:77:56: error: the address of ‘want’ will always evaluate as ‘true’ [-Werror=address]
   77 |              #actual, got__ ? got__ : "(null)", expect ? expect : "(null)");   \

5 years agosrc/testing.h: Support const pointers in CHECK_NOT_NULL().
Florian Forster [Fri, 17 Jul 2020 08:33:14 +0000 (10:33 +0200)] 
src/testing.h: Support const pointers in CHECK_NOT_NULL().

5 years agosrc/daemon/metric.[ch]: Implement metric_family_append().
Florian Forster [Tue, 7 Jul 2020 07:52:57 +0000 (09:52 +0200)] 
src/daemon/metric.[ch]: Implement metric_family_append().

5 years agosrc/daemon/metric.[ch]: Add metric_family_metric_reset().
Florian Forster [Sun, 28 Jun 2020 19:41:47 +0000 (21:41 +0200)] 
src/daemon/metric.[ch]: Add metric_family_metric_reset().

This and metric_family_metric_append() replace the metric_list_{add,reset}
functions.

5 years agosrc/daemon/metric.[ch]: Add metric_label_{get,set,reset}().
Florian Forster [Sun, 28 Jun 2020 19:07:27 +0000 (21:07 +0200)] 
src/daemon/metric.[ch]: Add metric_label_{get,set,reset}().

label_set_{get,add,reset} have been made static, providing the calling
code with a nicer API.

5 years agosrc/daemon/metric.[ch]: Implement metric_parse_identity().
Florian Forster [Tue, 21 Jul 2020 14:43:42 +0000 (16:43 +0200)] 
src/daemon/metric.[ch]: Implement metric_parse_identity().

5 years agosrc/daemon/metric.[ch]: Data types and functions representing metrics.
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.

5 years agoMerge pull request #3509 from octo/avltree
Florian Forster [Mon, 20 Jul 2020 16:36:27 +0000 (18:36 +0200)] 
Merge pull request #3509 from octo/avltree

avltree: Return errno values; unify argument handling.

5 years agoavltree: Return errno values; unify argument handling. 3509/head
Florian Forster [Thu, 2 Jul 2020 18:52:05 +0000 (20:52 +0200)] 
avltree: Return errno values; unify argument handling.

5 years agoMerge pull request #3507 from octo/remove-absolute
Florian Forster [Fri, 17 Jul 2020 08:12:25 +0000 (10:12 +0200)] 
Merge pull request #3507 from octo/remove-absolute

Tree-wide: Remove support for "absolute" metric values.

5 years agoTree-wide: Remove support for "absolute" metric values. 3507/head
Florian Forster [Thu, 16 Jul 2020 16:55:13 +0000 (18:55 +0200)] 
Tree-wide: Remove support for "absolute" metric values.

5 years agoMerge pull request #3481 from octo/strbuf
Florian Forster [Thu, 16 Jul 2020 18:11:31 +0000 (20:11 +0200)] 
Merge pull request #3481 from octo/strbuf

strbuf: Library that implements printing to a dynamically allocated buffer.

5 years agostrbuf: Update buf->size if realloc succeeds. 3481/head
Florian Forster [Thu, 9 Jul 2020 10:33:09 +0000 (12:33 +0200)] 
strbuf: Update buf->size if realloc succeeds.

5 years agostrbuf: Implenet "strbuf_printn" and "strbuf_print_escaped".
Florian Forster [Sun, 21 Jun 2020 19:23:22 +0000 (21:23 +0200)] 
strbuf: Implenet "strbuf_printn" and "strbuf_print_escaped".

5 years agocommon: Use the strbuf library in format_values().
Florian Forster [Fri, 19 Jun 2020 09:35:19 +0000 (11:35 +0200)] 
common: Use the strbuf library in format_values().

5 years agocommon: Add test for format_values().
Florian Forster [Fri, 19 Jun 2020 09:31:35 +0000 (11:31 +0200)] 
common: Add test for format_values().

5 years agostrbuf: Add STRBUF_CREATE_FIXED, unify naming.
Florian Forster [Fri, 19 Jun 2020 08:14:53 +0000 (10:14 +0200)] 
strbuf: Add STRBUF_CREATE_FIXED, unify naming.

This changes the macro and function name to use "fixed" when a buffer and
its size are provided, and "static" if `sizeof()` is used to determine the
size.

The macros now return and expect a `strbuf_t`, i.e. *not* a pointer. This
makes it easier to see that the buffer is allocated on the stack and may
go out of scope.

The buffer size in the tests has been changed to 9, so that `sizeof(array)`
and `sizeof(pointer)` return different values.

5 years agostrbuf: Improve documentation of exported functions.
Florian Forster [Fri, 19 Jun 2020 07:41:35 +0000 (09:41 +0200)] 
strbuf: Improve documentation of exported functions.

5 years agostrbuf: Add tests for stack allocation.
Florian Forster [Fri, 19 Jun 2020 07:41:19 +0000 (09:41 +0200)] 
strbuf: Add tests for stack allocation.

Add tests for the STRBUF_CREATE[_STATIC] macros. This surfaced a bug with
the STRBUF_DESTROY macro, which was missing `… while (0)` at the end.

5 years agostrbuf: Library that implements printing to a dynamically allocated buffer.
Florian Forster [Mon, 18 Sep 2017 14:35:51 +0000 (16:35 +0200)] 
strbuf: Library that implements printing to a dynamically allocated buffer.

5 years agoMerge pull request #3493 from octo/configfile
Florian Forster [Thu, 9 Jul 2020 15:11:57 +0000 (17:11 +0200)] 
Merge pull request #3493 from octo/configfile

src/daemon/configfile.c: Remove special case for the "libvirt" plugin.

5 years agosrc/daemon/configfile.c: Remove special case for the "libvirt" plugin. 3493/head
Florian Forster [Thu, 2 Jul 2020 18:55:21 +0000 (20:55 +0200)] 
src/daemon/configfile.c: Remove special case for the "libvirt" plugin.

5 years agoMerge pull request #3263 from duckfez/http_output_fix
Matthias Runge [Sat, 6 Jun 2020 17:37:17 +0000 (19:37 +0200)] 
Merge pull request #3263 from duckfez/http_output_fix

write_http no longer writes http response to stdout