-
Notifications
You must be signed in to change notification settings - Fork 1.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
in_node_exporter: more pluggable structure #8077
Conversation
How to add new collector
1. Create common sourcee.g. #ifdef __linux__
#include "ne_new_linux.c"
#elif __APPLE__
#include "ne_new_darwin.c"
#else
/* Not supported */
struct flb_ne_collector new_collector = {
.name = "new",
.cb_init = NULL,
.cb_update = NULL,
.cb_exit = NULL
};
#endif 2. Create common header#ifndef FLB_IN_NE_NEW_H
#define FLB_IN_NE_NEW_H
#include "ne.h"
extern struct flb_ne_collector new_collector;
#endif 4. Add mk_list_addne.c: mk_list_add(&systemd_collector._head, &ctx->collectors);
mk_list_add(&processes_collector._head, &ctx->collectors);
mk_list_add(&new_collector._head, &ctx->collectors); // add here !
mk_list_foreach(head, &ctx->collectors) {
coll = mk_list_entry(head, struct flb_ne_collector, _head);
collectors_common_init(coll);
} 5. Define config mapProperty name should be ne.c: {
FLB_CONFIG_MAP_TIME, "collector.new.scrape_interval", "0",
0, FLB_FALSE, 0,
"scrape interval to collect new metrics from the node."
},
Modify plugins/in_node_exporter_metrics/CMakeLists.txt to add |
85aa10b
to
38fa888
Compare
38fa888
to
17dc64e
Compare
Signed-off-by: Takahiro Yamashita <[email protected]>
17dc64e
to
a150551
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It would be really good to have! I love this patch.
I confirmed that this patch does not have any side effect on macOS. Everything is working as expected.
This patch is make more pluggable structure.
It is to remove similar codes for maintainability.
flb_ne_collector
ne_filefd.[ch]
,ne_stat.[ch]
andne_vmstat.[ch]
ne_systemd.[ch]
->ne_systemd_linux.[ch]
.struct flb_ne_collector
This struct represents common collector like plugin instance.
cpufreq
collector.%name%.scrape_interval
is defined on config map, this value is set by the value of config map. Default :scrape_interval
flb_input_set_collector_time
Enter
[N/A]
in the box, if an item is not applicable to your change.Testing
Before we can approve your change; please submit the following in a comment:
If this is a change to packaging of containers or native binaries then please confirm it works for all targets.
ok-package-test
label to test for all targets (requires maintainer to do).Documentation
Backporting
Configuration
Debug/Valgrind output
Fluent Bit is licensed under Apache 2.0, by submitting this pull request I understand that this code will be released under the terms of that license.