Shutdownguard
Author: a | 2025-04-24
Automatically exported from code.google.com/p/shutdownguard - shutdownguard/shutdownguard.c at master nguyenvanhauyd/shutdownguard
ShutdownGuard Download - ShutdownGuard tries to prevents
Related Problems?No responseDescribe the solution you'd like:Presently, there is no way to invoke a flush() call through the OpenTelemetryLog Bridge or most other usages of the Logger Trait.For anyone using a Batched Processor, a properly working flush() is critical for Panic handlers or any other (graceful or not) shutdown procedures.force_flush() is implemented in the sdk::logs::LoggerProvider struct, as well as the sdk::logs::BatchLogProcessor. The LoggerProvider struct directly implements the LoggerProvider trait, and the BatchLogProcessor is wrapped by LoggerProvider to provide the Logger trait. Despite this, there is no way to actually invoke that force_flush() method on either type.If either Logger or LoggerProvider had flush as a method, one would be able to activate it from whatever container owned those types.Additionally, the log::Log trait features a flush() method, but currently, the impl of Log by OpenTelemetryLogBridge does not conform to the spec, because it has no way to execute a flush()Considered AlternativesI have been trying to figure out a way to make a ShutdownGuard with a handle to the concrete LoggerProvider struct so I could at least make a ShutdownGuard that would flush on drop. so far I've not found a straightforward way to do this without violating a bunch of encapsulation rules.Additional ContextNo response Automatically exported from code.google.com/p/shutdownguard - shutdownguard/shutdownguard.c at master nguyenvanhauyd/shutdownguard Automatically exported from code.google.com/p/shutdownguard - shutdownguard-import/shutdownguard.c at master stefansundin/shutdownguard-importComments
Related Problems?No responseDescribe the solution you'd like:Presently, there is no way to invoke a flush() call through the OpenTelemetryLog Bridge or most other usages of the Logger Trait.For anyone using a Batched Processor, a properly working flush() is critical for Panic handlers or any other (graceful or not) shutdown procedures.force_flush() is implemented in the sdk::logs::LoggerProvider struct, as well as the sdk::logs::BatchLogProcessor. The LoggerProvider struct directly implements the LoggerProvider trait, and the BatchLogProcessor is wrapped by LoggerProvider to provide the Logger trait. Despite this, there is no way to actually invoke that force_flush() method on either type.If either Logger or LoggerProvider had flush as a method, one would be able to activate it from whatever container owned those types.Additionally, the log::Log trait features a flush() method, but currently, the impl of Log by OpenTelemetryLogBridge does not conform to the spec, because it has no way to execute a flush()Considered AlternativesI have been trying to figure out a way to make a ShutdownGuard with a handle to the concrete LoggerProvider struct so I could at least make a ShutdownGuard that would flush on drop. so far I've not found a straightforward way to do this without violating a bunch of encapsulation rules.Additional ContextNo response
2025-04-17