/** * Convert the abstract tracing state to its implementation. * * Expired states are not put in the sessions but the check is for extra safety. * * @return the state converted to its implementation, or null */ private TraceStateImpl getStateImpl() { TraceState state = get(); if (state == null) return null; if (state instanceof ExpiredTraceState) { ExpiredTraceState expiredTraceState = (ExpiredTraceState) state; state = expiredTraceState.getDelegate(); } if (state instanceof TraceStateImpl) { return (TraceStateImpl)state; } assert false : "TracingImpl states should be of type TraceStateImpl"; return null; }
public TraceState begin(final String request, final InetAddress client, final Map<String, String> parameters) { assert isTracing(); final TraceStateImpl state = getStateImpl(); assert state != null; final long startedAt = System.currentTimeMillis(); final ByteBuffer sessionId = state.sessionIdBytes; final String command = state.traceType.toString(); final int ttl = state.ttl; state.executeMutation(TraceKeyspace.makeStartSessionMutation(sessionId, client, parameters, request, startedAt, command, ttl)); return state; }
public void stopSessionImpl() { final TraceStateImpl state = getStateImpl(); if (state == null) return; int elapsed = state.elapsed(); ByteBuffer sessionId = state.sessionIdBytes; int ttl = state.ttl; state.executeMutation(TraceKeyspace.makeStopSessionMutation(sessionId, elapsed, ttl)); }
public enum TraceType { NONE, QUERY, REPAIR; private static final TraceType[] ALL_VALUES = values(); public static TraceType deserialize(byte b) { if (b < 0 || ALL_VALUES.length <= b) return NONE; return ALL_VALUES[b]; } public static byte serialize(TraceType value) { return (byte) value.ordinal(); } private static final int[] TTLS = { DatabaseDescriptor.getTracetypeQueryTTL(), DatabaseDescriptor.getTracetypeQueryTTL(), DatabaseDescriptor.getTracetypeRepairTTL() }; public int getTTL() { return TTLS[ordinal()]; } }
public void stopSessionImpl() { final TraceStateImpl state = getStateImpl(); if (state == null) return; int elapsed = state.elapsed(); ByteBuffer sessionId = state.sessionIdBytes; int ttl = state.ttl; state.executeMutation(TraceKeyspace.makeStopSessionMutation(sessionId, elapsed, ttl)); }
public enum TraceType { NONE, QUERY, REPAIR; private static final TraceType[] ALL_VALUES = values(); public static TraceType deserialize(byte b) { if (b < 0 || ALL_VALUES.length <= b) return NONE; return ALL_VALUES[b]; } public static byte serialize(TraceType value) { return (byte) value.ordinal(); } private static final int[] TTLS = { DatabaseDescriptor.getTracetypeQueryTTL(), DatabaseDescriptor.getTracetypeQueryTTL(), DatabaseDescriptor.getTracetypeRepairTTL() }; public int getTTL() { return TTLS[ordinal()]; } }
public TraceState begin(final String request, final InetAddress client, final Map<String, String> parameters) { assert isTracing(); final TraceStateImpl state = getStateImpl(); assert state != null; final long startedAt = System.currentTimeMillis(); final ByteBuffer sessionId = state.sessionIdBytes; final String command = state.traceType.toString(); final int ttl = state.ttl; state.executeMutation(TraceKeyspace.makeStartSessionMutation(sessionId, client, parameters, request, startedAt, command, ttl)); return state; }
public void stopSessionImpl() { final TraceStateImpl state = getStateImpl(); if (state == null) return; int elapsed = state.elapsed(); ByteBuffer sessionId = state.sessionIdBytes; int ttl = state.ttl; state.executeMutation(TraceKeyspace.makeStopSessionMutation(sessionId, elapsed, ttl)); }
public enum TraceType { NONE, QUERY, REPAIR; private static final TraceType[] ALL_VALUES = values(); public static TraceType deserialize(byte b) { if (b < 0 || ALL_VALUES.length <= b) return NONE; return ALL_VALUES[b]; } public static byte serialize(TraceType value) { return (byte) value.ordinal(); } private static final int[] TTLS = { DatabaseDescriptor.getTracetypeQueryTTL(), DatabaseDescriptor.getTracetypeQueryTTL(), DatabaseDescriptor.getTracetypeRepairTTL() }; public int getTTL() { return TTLS[ordinal()]; } }
/** * Convert the abstract tracing state to its implementation. * * Expired states are not put in the sessions but the check is for extra safety. * * @return the state converted to its implementation, or null */ private TraceStateImpl getStateImpl() { TraceState state = get(); if (state == null) return null; if (state instanceof ExpiredTraceState) { ExpiredTraceState expiredTraceState = (ExpiredTraceState) state; state = expiredTraceState.getDelegate(); } if (state instanceof TraceStateImpl) { return (TraceStateImpl)state; } assert false : "TracingImpl states should be of type TraceStateImpl"; return null; }
public TraceState begin(final String request, final InetAddress client, final Map<String, String> parameters) { assert isTracing(); final TraceStateImpl state = getStateImpl(); assert state != null; final long startedAt = System.currentTimeMillis(); final ByteBuffer sessionId = state.sessionIdBytes; final String command = state.traceType.toString(); final int ttl = state.ttl; state.executeMutation(TraceKeyspace.makeStartSessionMutation(sessionId, client, parameters, request, startedAt, command, ttl)); return state; }
/** * Convert the abstract tracing state to its implementation. * * Expired states are not put in the sessions but the check is for extra safety. * * @return the state converted to its implementation, or null */ private TraceStateImpl getStateImpl() { TraceState state = get(); if (state == null) return null; if (state instanceof ExpiredTraceState) { ExpiredTraceState expiredTraceState = (ExpiredTraceState) state; state = expiredTraceState.getDelegate(); } if (state instanceof TraceStateImpl) { return (TraceStateImpl)state; } assert false : "TracingImpl states should be of type TraceStateImpl"; return null; }