Package io.opentelemetry.sdk.internal
Class ThrottlingLogger
java.lang.Object
io.opentelemetry.sdk.internal.ThrottlingLogger
Will limit the number of log messages emitted, so as not to spam when problems are happening.
This class is internal and is hence not for public use. Its APIs are unstable and can change at any time.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final Logger
private final RateLimiter
private static final double
private static final TimeUnit
private final AtomicBoolean
private static final double
private final RateLimiter
-
Constructor Summary
ConstructorsConstructorDescriptionThrottlingLogger
(Logger delegate) Create a new logger which will enforce a max number of messages per minute.ThrottlingLogger
(Logger delegate, Clock clock) -
Method Summary
Modifier and TypeMethodDescriptionprivate void
boolean
isLoggable
(Level level) Returns whether the current wrapped logger is set to log at the given level.void
Log a message at the given level.void
Log a message at the given level with a throwable.
-
Field Details
-
RATE_LIMIT
private static final double RATE_LIMIT- See Also:
-
THROTTLED_RATE_LIMIT
private static final double THROTTLED_RATE_LIMIT- See Also:
-
rateTimeUnit
-
delegate
-
throttled
-
fastRateLimiter
-
throttledRateLimiter
-
-
Constructor Details
-
ThrottlingLogger
Create a new logger which will enforce a max number of messages per minute. -
ThrottlingLogger
-
-
Method Details
-
log
Log a message at the given level. -
log
Log a message at the given level with a throwable. -
doLog
-
isLoggable
Returns whether the current wrapped logger is set to log at the given level.- Returns:
- true if the logger set to log at the requested level.
-