Skip to content

Add Support For MetricsΒ #54

@logston

Description

@logston

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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions