fluent-bit: Public-consumable fluent-bit.h should not reference unnecessary dependencies

I’m attempting to use libfluent-bit.so as per this example The instructions don’t say where to get fluent-bit.h but I found it in the package “fluent-bit-headers” which was added to my debian sources via the fluent-bit install process.

My problem is that fluent-bit.h includes <monkey/mk_core.h> and (assuming this is the monkey http server) that package is not available from debian, making it look like I have to manually install the monkey project just to be able to use the headers of libfluent-bit. Meanwhile I have no way of knowing if the version I install is the same that was used to compile libfluent-bit.so from your repos.

I also don’t know how deep this rabbit hole goes, because you have over a hundred headers that reference all kinds of things and hopefully I don’t need to install headers for dependencies for every single one of them?

Meanwhile, the public api in flb_lib.h does not make any reference to these other libraries, so I ought to be able to have just the public structs declared in a standalone file and skip all the mess. Are there reasons why you can’t just have a “public-only” header file, or is this just an oversight in the tooling?

I worked around it using this custom header:

#ifndef FLB_LIB_H
#define FLB_LIB_H

#define FLB_EXPORT extern

/* Lib engine status */
#define FLB_LIB_ERROR     -1
#define FLB_LIB_NONE       0
#define FLB_LIB_OK         1
#define FLB_LIB_NO_CONFIG_MAP 2


/* Used on out_lib to define a callback and further opaque data */
struct flb_lib_out_cb {
    int (*cb) (void *record, size_t size, void *data);
    void *data;
};

/* For Fluent Bit library callers, we only export the following symbols */
struct flb_lib_ctx;
typedef struct flb_lib_ctx         flb_ctx_t;

FLB_EXPORT void flb_init_env();
FLB_EXPORT flb_ctx_t *flb_create();
FLB_EXPORT void flb_destroy(flb_ctx_t *ctx);
FLB_EXPORT int flb_input(flb_ctx_t *ctx, const char *input, void *data);
FLB_EXPORT int flb_output(flb_ctx_t *ctx, const char *output, struct flb_lib_out_cb *cb);
FLB_EXPORT int flb_filter(flb_ctx_t *ctx, const char *filter, void *data);
FLB_EXPORT int flb_input_set(flb_ctx_t *ctx, int ffd, ...);
FLB_EXPORT int flb_input_property_check(flb_ctx_t *ctx, int ffd, char *key, char *val);
FLB_EXPORT int flb_output_property_check(flb_ctx_t *ctx, int ffd, char *key, char *val);
FLB_EXPORT int flb_filter_property_check(flb_ctx_t *ctx, int ffd, char *key, char *val);
FLB_EXPORT int flb_output_set(flb_ctx_t *ctx, int ffd, ...);
FLB_EXPORT int flb_output_set_test(flb_ctx_t *ctx, int ffd, char *test_name,
                                   void (*out_callback) (void *, int, int,
                                                         void *, size_t, void *),
                                   void *out_callback_data,
                                   void *test_ctx);
FLB_EXPORT int flb_output_set_callback(flb_ctx_t *ctx, int ffd, char *name,
                                       void (*cb)(char *, void *, void *));

FLB_EXPORT int flb_filter_set(flb_ctx_t *ctx, int ffd, ...);
FLB_EXPORT int flb_service_set(flb_ctx_t *ctx, ...);
FLB_EXPORT int  flb_lib_free(void *data);
FLB_EXPORT double flb_time_now();

/* start stop the engine */
FLB_EXPORT int flb_start(flb_ctx_t *ctx);
FLB_EXPORT int flb_stop(flb_ctx_t *ctx);
FLB_EXPORT int flb_loop(flb_ctx_t *ctx);

/* data ingestion for "lib" input instance */
FLB_EXPORT int flb_lib_push(flb_ctx_t *ctx, int ffd, const void *data, size_t len);
FLB_EXPORT int flb_lib_config_file(flb_ctx_t *ctx, const char *path);

#endif

About this issue

  • Original URL
  • State: closed
  • Created a year ago
  • Comments: 15 (6 by maintainers)

Commits related to this issue

Most upvoted comments

I should be able to get a PR soon. I got distracted by also wanting an output plugin for pure json output, but I’ll get back to a branch with just this change in it.