-
Notifications
You must be signed in to change notification settings - Fork 780
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
[bug] BaseProcessor<LogRecord>.OnStart not being called #6022
Comments
Logs has no notion of start and end. Only OnEnd is called for Logs. (For Span(Activity), both start and end are invoked.) |
How would a Processor filter out logs then? On the |
For basic filter, ILogger has native support. https://github.com/open-telemetry/opentelemetry-dotnet/tree/main/docs/logs#log-filtering But for anything more advanced, only option currently is to wrap the exporting processor in your custom processor, and have the custom processor call/not-call the exporting-processor depending on whether LogRecord should be filtered out or not. This is not documented, but the below issue has some hints on how to do it. |
@cijothomas Shouldn't we make |
Not sure I understand the comment. Could you elaborate? |
If it was up to me, the extensibility model provided by "BaseProcessor" would be more robust. Like, With these changes, Log Processors would have complete independence to handle log specific logic/rules. Don't get me wrong, Exporters should continue to have such capacities, we would just encourage these to be moved to the processors for separation of concerns sake. |
I still don't follow what is the exact proposal...
This is already the case. OTel SDK never talks to exporter directly, it only hands over telemetry (LogRecord) to the Processor, and it is unto the processor to drop it or enrich it or pass it another process or pass it to exporter or do the export inside the processor or anything else.
OTel Spec for Logs don't support it, and I don't see a reason why it should be supported. Log signal is different from other signals, in the sense OTel integrates with existing logging libraries rather than build full fledged logging library - we expect most capabilities like filtering is already natively supported by the existing Logging library (ILogger, in this case), and OTel can compensate for anything missing there or offer OTel specific functionalities.
Again, I am not sure if I follow this. Exporters only has one responsibility - serialize the data in a format understood by its target backend and send the data there (handling endpoint specific retry etc/ as needed), and nothing more. |
Package
OpenTelemetry
Package Version
Runtime Version
net9.0
Description
When I register a processor such as
it doesn't go boom!
OnEnd
gets called all the time though...I want to create a filter processor that will inspect and possibly redact logs before they are sent outwards.
Steps to Reproduce
Expected Result
that the log
OnStart
method would be called so I can prevent the log from moving forward "as-is" in certain conditionsActual Result
Only
OnEnd
gets calledAdditional Context
No response
The text was updated successfully, but these errors were encountered: