/** Adds timing to the histograms. */ private void publish(RPCContext context, Stopwatch t) { Message message = context.getMessage(); if (message == null) throw new IllegalArgumentException(); synchronized(methodTimings) { FloatHistogram<?> h = methodTimings.get(context.getMessage()); if (h == null) { h = createNewFloatHistogram(); methodTimings.put(context.getMessage(), h); } h.add(nanosToMillis(t.elapsedNanos())); } }
@Override public void serverReceiveRequest(RPCContext context) { Stopwatch t = new Stopwatch(ticks); t.start(); this.activeRpcs.put(context, t); synchronized(receivePayloads) { IntegerHistogram<?> h = receivePayloads.get(context.getMessage()); if (h == null) { h = createNewIntegerHistogram(); receivePayloads.put(context.getMessage(), h); } h.add(getPayloadSize(context.getRequestPayload())); } }
@Override public void serverSendResponse(RPCContext context) { Stopwatch t = this.activeRpcs.remove(context); t.stop(); publish(context, t); synchronized(sendPayloads) { IntegerHistogram<?> h = sendPayloads.get(context.getMessage()); if (h == null) { h = createNewIntegerHistogram(); sendPayloads.put(context.getMessage(), h); } h.add(getPayloadSize(context.getResponsePayload())); } }
@Override public void clientReceiveResponse(RPCContext context) { Stopwatch t = this.activeRpcs.remove(context); t.stop(); publish(context, t); synchronized(receivePayloads) { IntegerHistogram<?> h = receivePayloads.get(context.getMessage()); if (h == null) { h = createNewIntegerHistogram(); receivePayloads.put(context.getMessage(), h); } h.add(getPayloadSize(context.getRequestPayload())); } }
@Override public void clientSendRequest(RPCContext context) { Stopwatch t = new Stopwatch(ticks); t.start(); this.activeRpcs.put(context, t); synchronized(sendPayloads) { IntegerHistogram<?> h = sendPayloads.get(context.getMessage()); if (h == null) { h = createNewIntegerHistogram(); sendPayloads.put(context.getMessage(), h); } h.add(getPayloadSize(context.getRequestPayload())); } }
private String renderActiveRpc(RPCContext rpc, Stopwatch stopwatch) throws IOException { String out = new String(); out += rpc.getMessage().getName() + ": " + formatMillis(StatsPlugin.nanosToMillis(stopwatch.elapsedNanos())); return out; }
@Override public void serverReceiveRequest(RPCContext context) { Map<String,ByteBuffer> meta = context.requestCallMeta(); Assert.assertNotNull(meta); Assert.assertNotNull(context.getMessage()); Assert.assertNull(context.getResponsePayload()); if (!meta.containsKey(key)) return; ByteBuffer buf = meta.get(key); Assert.assertNotNull(buf); Assert.assertNotNull(buf.array()); String partialstr = new String(buf.array()); Assert.assertNotNull(partialstr); Assert.assertEquals("partial string mismatch", "ap", partialstr); buf = ByteBuffer.wrap((partialstr + "a").getBytes()); Assert.assertTrue(buf.remaining() > 0); meta.put(key, buf); }
@Override public void clientSendRequest(RPCContext context) { ByteBuffer buf = ByteBuffer.wrap("ap".getBytes()); context.requestCallMeta().put(key, buf); Assert.assertNotNull(context.getMessage()); Assert.assertNotNull(context.getRequestPayload()); Assert.assertNull(context.getResponsePayload()); }
/** Adds timing to the histograms. */ private void publish(RPCContext context, Stopwatch t) { Message message = context.getMessage(); if (message == null) throw new IllegalArgumentException(); synchronized(methodTimings) { FloatHistogram<?> h = methodTimings.get(context.getMessage()); if (h == null) { h = createNewFloatHistogram(); methodTimings.put(context.getMessage(), h); } h.add(nanosToMillis(t.elapsedNanos())); } }
/** Adds timing to the histograms. */ private void publish(RPCContext context, Stopwatch t) { Message message = context.getMessage(); if (message == null) throw new IllegalArgumentException(); synchronized(methodTimings) { FloatHistogram<?> h = methodTimings.get(context.getMessage()); if (h == null) { h = createNewHistogram(); methodTimings.put(context.getMessage(), h); } h.add(nanosToMillis(t.elapsedNanos())); } }
/** Adds timing to the histograms. */ private void publish(RPCContext context, Stopwatch t) { Message message = context.getMessage(); if (message == null) throw new IllegalArgumentException(); synchronized(methodTimings) { FloatHistogram<?> h = methodTimings.get(context.getMessage()); if (h == null) { h = createNewFloatHistogram(); methodTimings.put(context.getMessage(), h); } h.add(nanosToMillis(t.elapsedNanos())); } }
private void writeActiveRpc(Writer w, RPCContext rpc, Stopwatch stopwatch) throws IOException { w.append("<li>").append(rpc.getMessage().getName()).append(": "); w.append(formatMillis(StatsPlugin.nanosToMillis(stopwatch.elapsedNanos()))); w.append("</li>"); }
@Override public void serverSendResponse(RPCContext context) { Stopwatch t = this.activeRpcs.remove(context); t.stop(); publish(context, t); synchronized(sendPayloads) { IntegerHistogram<?> h = sendPayloads.get(context.getMessage()); if (h == null) { h = createNewIntegerHistogram(); sendPayloads.put(context.getMessage(), h); } h.add(getPayloadSize(context.getResponsePayload())); } }
@Override public void serverSendResponse(RPCContext context) { Stopwatch t = this.activeRpcs.remove(context); t.stop(); publish(context, t); synchronized(sendPayloads) { IntegerHistogram<?> h = sendPayloads.get(context.getMessage()); if (h == null) { h = createNewIntegerHistogram(); sendPayloads.put(context.getMessage(), h); } h.add(getPayloadSize(context.getResponsePayload())); } }
@Override public void clientReceiveResponse(RPCContext context) { Stopwatch t = this.activeRpcs.remove(context); t.stop(); publish(context, t); synchronized(receivePayloads) { IntegerHistogram<?> h = receivePayloads.get(context.getMessage()); if (h == null) { h = createNewIntegerHistogram(); receivePayloads.put(context.getMessage(), h); } h.add(getPayloadSize(context.getRequestPayload())); } }
@Override public void serverReceiveRequest(RPCContext context) { Stopwatch t = new Stopwatch(ticks); t.start(); this.activeRpcs.put(context, t); synchronized(receivePayloads) { IntegerHistogram<?> h = receivePayloads.get(context.getMessage()); if (h == null) { h = createNewIntegerHistogram(); receivePayloads.put(context.getMessage(), h); } h.add(getPayloadSize(context.getRequestPayload())); } }
private String renderActiveRpc(RPCContext rpc, Stopwatch stopwatch) throws IOException { String out = new String(); out += rpc.getMessage().getName() + ": " + formatMillis(StatsPlugin.nanosToMillis(stopwatch.elapsedNanos())); return out; }
@Override public void clientSendRequest(RPCContext context) { if (this.childSpan.get() != null) { Span child = this.childSpan.get(); Util.addEvent(child, SpanEvent.CLIENT_SEND); child.messageName = new Utf8( context.getMessage().getName()); child.requestPayloadSize = Util.getPayloadSize( context.getRequestPayload()); } }
private String renderActiveRpc(RPCContext rpc, Stopwatch stopwatch) throws IOException { String out = new String(); out += rpc.getMessage().getName() + ": " + formatMillis(StatsPlugin.nanosToMillis(stopwatch.elapsedNanos())); return out; }
@Override public void serverReceiveRequest(RPCContext context) { if (this.currentSpan.get() != null) { Span current = this.currentSpan.get(); Util.addEvent(current, SpanEvent.SERVER_RECV); current.messageName = new Utf8( context.getMessage().getName()); current.requestPayloadSize = Util.getPayloadSize( context.getRequestPayload()); } }