Skip to content
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

Add Support For Metrics #54

Open
logston opened this issue Apr 25, 2022 · 2 comments
Open

Add Support For Metrics #54

logston opened this issue Apr 25, 2022 · 2 comments

Comments

@logston
Copy link

logston commented Apr 25, 2022

The basic metrics afforded to each plugin (ie. dropped_records, errors_total, etc) are quite powerful but are sometimes not enough. For example, when developing a custom GCS plugin, we've found the lack of a visibility into metrics like the frequencies of types of errors, objects created, etc to be blockers. We would like the ability to add custom metrics to the flbgo plugin.

From a high level, this seems possible. Typically, a plugin's custom metrics are attached to its plugin struct. However, this does not seem strictly necessary. Instead, as long as a pointer to the metrics object is held and freed appropriately, then binding the metric object to the struct seems unneeded. Decoupling the plugin struct and the metric pointer is required for this issue's proposed change. Decoupling is necessary because the library needs to service all possible plugins (and associated metrics) and updating the flbgo_output_plugin for each plugin is a non-starter.

Could something to the effect of ...

struct cmt_counter *create_counter_metric(void *plugin)
{
    struct flbgo_output_plugin *p = plugin;
    struct cmt_counter *counter;

    counter = cmt_counter_create(p->o_ins->cmt,
                                 "fluentbit",
                                 "my_plugin",
                                 "requests_total",
                                 "Total number of requests.",
                                  1,
			         (char *[]) {"status"});

	return counter;
}

be added to the flb_output.h file? And then when FluentBit collects metrics, the metrics stored under a given flb_output_instance's cmt attribute can be fetched?

@jeongukjae
Copy link

+1

@edsiper
Copy link
Member

edsiper commented Oct 3, 2022

pretty good idea. +1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants