Package io.grpc.internal
Class ChannelTracer
- java.lang.Object
-
- io.grpc.internal.ChannelTracer
-
final class ChannelTracer extends java.lang.Object
Tracks a collections of channel tracing events for a channel/subchannel.
-
-
Field Summary
Fields Modifier and Type Field Description private long
channelCreationTimeNanos
private java.util.Collection<InternalChannelz.ChannelTrace.Event>
events
private int
eventsLogged
private java.lang.Object
lock
(package private) static java.util.logging.Logger
logger
private InternalLogId
logId
-
Constructor Summary
Constructors Constructor Description ChannelTracer(InternalLogId logId, int maxEvents, long channelCreationTimeNanos, java.lang.String description)
Creates a channel tracer and log the creation event of the underlying channel.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description (package private) InternalLogId
getLogId()
(package private) boolean
isTraceEnabled()
(package private) static void
logOnly(InternalLogId logId, java.util.logging.Level logLevel, java.lang.String msg)
(package private) void
reportEvent(InternalChannelz.ChannelTrace.Event event)
(package private) void
traceOnly(InternalChannelz.ChannelTrace.Event event)
(package private) void
updateBuilder(InternalChannelz.ChannelStats.Builder builder)
-
-
-
Field Detail
-
logger
static final java.util.logging.Logger logger
-
lock
private final java.lang.Object lock
-
logId
private final InternalLogId logId
-
events
@Nullable private final java.util.Collection<InternalChannelz.ChannelTrace.Event> events
-
channelCreationTimeNanos
private final long channelCreationTimeNanos
-
eventsLogged
private int eventsLogged
-
-
Constructor Detail
-
ChannelTracer
ChannelTracer(InternalLogId logId, int maxEvents, long channelCreationTimeNanos, java.lang.String description)
Creates a channel tracer and log the creation event of the underlying channel.- Parameters:
logId
- logId will be prepended to the logs logged to Java loggermaxEvents
- maximum number of events that are retained in memory. If not a positive number no events will be retained, but they will still be sent to the Java logger.channelCreationTimeNanos
- the creation time of the entity being traceddescription
- a description of the entity being traced
-
-
Method Detail
-
reportEvent
void reportEvent(InternalChannelz.ChannelTrace.Event event)
-
isTraceEnabled
boolean isTraceEnabled()
-
traceOnly
void traceOnly(InternalChannelz.ChannelTrace.Event event)
-
logOnly
static void logOnly(InternalLogId logId, java.util.logging.Level logLevel, java.lang.String msg)
-
getLogId
InternalLogId getLogId()
-
updateBuilder
void updateBuilder(InternalChannelz.ChannelStats.Builder builder)
-
-