-
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
[DRAFT] custom: Go plugin support for custom plugins to support OTel extensions #9470
base: master
Are you sure you want to change the base?
Conversation
…sions Signed-off-by: Rob Skillington <[email protected]>
8d46b52
to
ff1482f
Compare
|
||
# !! TODO: move to a Makefile | ||
|
||
CGO_CFLAGS="-I${HOME}/src/fluent-bit/include -I${HOME}/src/fluent-bit/lib/monkey/include -I${HOME}/src/fluent-bit/build/lib/monkey/include/monkey -I${HOME}/src/fluent-bit/lib/cfl/include -I${HOME}/src/fluent-bit/lib/cfl/lib/xxhash -I${HOME}/src/fluent-bit/lib/cmetrics/include -I${HOME}/src/fluent-bit/lib/flb_libco -I${HOME}/src/fluent-bit/lib/c-ares-1.33.1/include -I${HOME}/src/fluent-bit/lib/msgpack-c/include -I${HOME}/src/fluent-bit/lib/ctraces/include -I${HOME}/src/fluent-bit/lib/ctraces/lib/mpack/src" CGO_LDFLAGS="-L${HOME}/src/fluent-bit/build/lib -lfluent-bit" sh -c 'echo CGO_CFLAGS=${CGO_CFLAGS}; echo CGO_LDFLAGS=${CGO_LDFLAGS}; go build -buildmode=c-shared -o build/bin/custom_extensions_go.so github.com/fluent/fluent-bit/plugins/custom_extensions_go' |
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.
let's avoid adding extra dev files to the repo.
@@ -0,0 +1,3 @@ | |||
module github.com/fluent/fluent-bit |
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.
let's avoid adding extra dev files to the repo.
@@ -41,7 +42,7 @@ | |||
* | |||
* - name: shortname of the plugin. | |||
* - description: plugin description. | |||
* - type: input, output, filter, whatever. | |||
* - type: input, output, filter, processor, custom. |
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.
I am not sure if processors can be written in Go today cc: @cosmo0920
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.
Currently, we can't do that. If processors can be written in Go, there is huge opportunity to handle various type of payloads including otel payloads which are belongs to traces type of events.
if the interface is only for OpenTelemetry Collector extensions I would suggest to rename the custom plugin |
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.
For me, this PR is going to the right direction for implementing as custom plugins interface.
To handle/create Golang plugins, we manage this extension module here:
https://github.com/chronosphereio/calyptia-plugin
The committed Golang related stuffs should be handled there.
func FLBPluginConfigKey(plugin unsafe.Pointer, key string) string { | ||
k := C.CString(key) | ||
p := plugin | ||
v := C.GoString(C.flb_custom_get_property(k, (*C.struct_flb_custom_instance)(p))) |
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.
We need to implement flb_custom_get_property as an API here if we create custom plugin interface like as input and output:
https://github.com/fluent/fluent-bit/blob/master/src/flb_api.c#L47-L48
Opening this for feedback on implementation. Have this working end-to-end.
Since OpenTelemetry extensions do not require telemetry processing (unlike plugins/extensions for input/output/filter/processing/etc that do require it in FluentBit) they are relatively simple to support since they just need to be "started" and "stopped" at process boot and config hot reloads.
One primary extension that tracing end users frequently require is the ability to dynamically set head sampling on a per-service and operation combination. This is achieved by hosting a jaeger remote sampling endpoint on a collector which with Go custom plugins being able to host OpenTelemetry Go extensions becomes trivial to have FluentBit expose the same functionality (plus reduces re-implementation and helps leverage existing mature community extensions where others can contribute to easily).
As per OpenTelemetry collector documentation:
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
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.