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

[Idea] Hiding plugin instance at library mode #100

Closed
nokute78 opened this issue Aug 10, 2016 · 8 comments
Closed

[Idea] Hiding plugin instance at library mode #100

nokute78 opened this issue Aug 10, 2016 · 8 comments

Comments

@nokute78
Copy link
Collaborator

nokute78 commented Aug 10, 2016

Now, flb_output_new and flb_input_new return a pointer of plugin instance.
Would you move them to flb_ctx_t to hide from user ?

Like this.

struct flb_lib_ctx {
    struct mk_event_loop *event_loop;
    struct mk_event *event_channel;
    struct flb_config *config;
    struct flb_input_instance *in;
    struct flb_output_instance *out;
};

User specify plugin instance with plugin id (like fd).

   int in_id = 0;
   ...
   in_id = flb_input_new(ctx, "mem", NULL); /* In this function, generate a instance and set  ctx->in[in_id] to the instance */
   flb_input_set(in_id, ctx, "tag", "test", NULL); /* set ctx->in[in_id]->properties to "tag" */
   ...
   flb_destroy(ctx); /* release all of ctx->in */

Pros:

  • User takes care of only flb_ctx_t. User doesn't need to release plugin instances. Engine will do.
  • Engine can control stop and release timing of instances in flb_stop or flb_destroy. (Now, it depends on user code.)
  • User also can specify plugin with plugin id.

Cons:

  • Lose compatibility.

How about this?

@edsiper
Copy link
Member

edsiper commented Aug 11, 2016

the main reason of getting a reference to the input/output instance, is to be able to set properties or any other kind of future modification.

Note that when the end-user call flb_stop(ctx), the engine receives the message and it start releasing resources, internally it does an exit for all input/output instances associated to the main context.

The user never need to do an explicit release of the instances, all this happens in the background.

@nokute78
Copy link
Collaborator Author

nokute78 commented Aug 12, 2016

Thank you for your comment.
I noticed that flb_ctx_t already contains plugin instances.

the main reason of getting a reference to the input/output instance, is to be able to set properties or any other kind of future modification.

So, why should we expose a plugin instance ?
User passes these instances to flb_*put_set as identifier.
I think structure of instance is not necessarily need, only identifier value is needed.

The user never need to do an explicit release of the instances, all this happens in the background.

I understand. But I think it is odd from user side.
Because flb_stop(ctx) doesn't contain plugin instances at first sight.
However this function influences plugin instances.
This means fluent-bit treats these instances as part of context implicitly.

So , I proposed that plugin instances should be hid from user and modify API.
flb_input_set( input_ins, ... ) -> flb_input_set( input_id, ctx, ... )

@edsiper
Copy link
Member

edsiper commented Aug 12, 2016

I am thinking about this, no strong opinion yet, once I finish buffering/scheduling stuff I will focus on API and share more updates.

@nokute78
Copy link
Collaborator Author

I see, I'm waiting.
Thanks!

@edsiper
Copy link
Member

edsiper commented Oct 4, 2016

I am reviewing this. I think it make sense to have an integer as identifier, thanks for pointing that.

edsiper added a commit that referenced this issue Oct 4, 2016
This patch remove the notion of the input_instance references, instead
it uses an unique id that can be mapped easily in an int (similar to
file descriptors).

Signed-off-by: Eduardo Silva <[email protected]>
@edsiper
Copy link
Member

edsiper commented Oct 4, 2016

@nokute78 I have pushed the changes into api_ffd branch.

note: the remaining part are tests.

@edsiper
Copy link
Member

edsiper commented Oct 5, 2016

I just migrated all tests/examples, changes rebased on master.

If is there anything pending or something not working as suggested please add your comments to this tickets.

@edsiper edsiper closed this as completed Oct 5, 2016
@nokute78
Copy link
Collaborator Author

nokute78 commented Oct 5, 2016

Amazing!! That's what I imagined!
Thanks.

fujimotos added a commit to fujimotos/fluent-bit that referenced this issue Jul 22, 2019
I believe the feature description is not correct anymore, since we
can configure the target URI and data format through parameters.

Signed-off-by: Fujimoto Seiji <[email protected]>
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

2 participants