-
Notifications
You must be signed in to change notification settings - Fork 77
feat: Refactor IIS to use LoggingProcessorMacro
#2014
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
base: master
Are you sure you want to change the base?
feat: Refactor IIS to use LoggingProcessorMacro
#2014
Conversation
31303da to
8adee32
Compare
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.
@Caleb-Hurshman This is a good "rough draft". It really brings to light all the technical considerations around refactoring IIS. I added some comments. Thank you for the effort in this so far!
transformation_test/testdata/logging_processor-iis_access/output_otel.yaml
Outdated
Show resolved
Hide resolved
transformation_test/testdata/logging_processor-iis_access/output_otel.yaml
Outdated
Show resolved
Hide resolved
8adee32 to
816ca88
Compare
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.
After further thought, i think we shouldn't add CustomLuaFunc / CustomOTTLFunc to ModifyFields. Some reasons for this :
ModifyFieldscurrent abstraction is to work with the fields<dest>,<source>, but this new features extend this to an arbitrary list of fields.ModifyFieldsis also a feature exposed to users.- This is required by only the
IISprocessor so adding complexity here is unnecessary for only one case. - The only required operation missing from ModifyFields is string concatenation. Using
CustomConvertFunc + Concat1 we can do this in Otel. - For
fluent-bitwe can keep a similar Lua script for the string concatenation and simplify the steps that can be done with ModifyFields (e.g. ommiting fields).
Please remove CustomLuaFunc / CustomOTTLFunc and do the following instead :
- Create an
InternalLoggingProcessor(interface) calledIISConcatFieldswhich implements the methodsComponents(fluent-bit) andProcessors(otel). - Use
ModifyFields + CustomConvertFunc + Concat1 for the Otel implementation.CustomConvertFunccan access any field in the log. - Use
LuaFilterComponentsfor fluent-bit implementation of concatenation. - Simplify/remove the existing LuaScripts if possible.
Let me know if this is possible or if there any specific limitations.
Footnotes
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.
@franciscovalentecastro Most of this sounds good, but the otel output has not been working properly after changing to Processors:
- config_error: "processor \"processor0\" has invalid configuration: unimplemented"
I believe there might be a mismatch with the processor interface in OTel, let me know what you think.
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 think the reason of that failure is that the signature of the Processors method should return ([]otel.Component, error) :
ops-agent/confgenerator/config.go
Lines 799 to 803 in c6005d9
| } | |
| type InternalOTelProcessor interface { | |
| Processors(context.Context) ([]otel.Component, error) | |
| } | |
For this particular implementation it seems you would be able to call the Processors method of the modifyFields processor defined within the IISConcatFields.Processors method and "return" the result.
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 did try the return that way, but encountered the same result. I'll change the return type back, but there's more to this issue. I'll dig in further once the rest of the receivers are up to date.
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.
Yes, you are right, there is more to this issue. This is a bug i've encountered before, but failed to fix in other PR's. I can fix this in a separate PR or we can do it here. Let me know what do you think its best.
[Optional]
In logging_macros.go, all the Pipelines () / Processors() methods should use InternalOtelReceiver / InternalOtelProcessor instead of OtelReceiver / OtelProcessor. This should fix the unimplemented error.
ops-agent/confgenerator/logging_macros.go
Lines 64 to 66 in 5171236
| receiver, processors := cr.Expand(ctx) | |
| if r, ok := any(receiver).(OTelReceiver); ok { | |
| rps, err := r.Pipelines(ctx) |
ops-agent/confgenerator/logging_macros.go
Lines 71 to 73 in 5171236
| for _, p := range processors { | |
| if p, ok := p.(OTelProcessor); ok { | |
| c, err := p.Processors(ctx) |
ops-agent/confgenerator/logging_macros.go
Lines 126 to 128 in 5171236
| for _, lp := range cp.Expand(ctx) { | |
| if p, ok := any(lp).(OTelProcessor); ok { | |
| c, err := p.Processors(ctx) |
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'm glad to hear you know what the issue is! I think a separate PR would be good since a lot is going on in this PR already.
811d2d3 to
75332f6
Compare
deda40c to
11bade5
Compare
|
This PR was marked stale due to lack of activity. It will be closed in 14 days. |
Description
Refactor the IIS receiver logging to be sub-agent agnostic.
I am considering this a "rough draft". I believe the Lua functionality has been preserved. IIS is Windows-only, but the
RegisterLoggingFilesProcessorMacrofunction doesn't handle a platform argument yet.Related issue
How has this been tested?
Updated
transformation_testandconfgenerator_test, confirmed the output ofoutput_fluentbit.yamlwas unchanged after refactoring the receiver.Checklist: