protected AsyncReporter.Builder getZipkinReporterBuilder(StagemonitorPlugin.InitArguments initArguments) { final ZipkinPlugin zipkinPlugin = initArguments.getPlugin(ZipkinPlugin.class); final AsyncReporter.Builder reporterBuilder = AsyncReporter .builder(getSender(zipkinPlugin)) .messageTimeout(zipkinPlugin.getZipkinFlushInterval(), TimeUnit.MILLISECONDS); final Integer zipkinMaxQueuedBytes = zipkinPlugin.getZipkinMaxQueuedBytes(); if (zipkinMaxQueuedBytes != null) { reporterBuilder.queuedMaxBytes(zipkinMaxQueuedBytes); } if (initArguments.getPlugin(CorePlugin.class).isInternalMonitoringActive()) { reporterBuilder.metrics(new StagemonitorReporterMetrics(initArguments.getMetricRegistry())); } return reporterBuilder; }
@Override public Tracer getTracer(StagemonitorPlugin.InitArguments initArguments) { final Tracing braveTracer = Tracing.newBuilder() .localServiceName(initArguments.getMeasurementSession().getApplicationName()) .reporter(getZipkinReporterBuilder(initArguments).build()) .sampler(getSampler()) .build(); return BraveTracer.newBuilder(braveTracer) .textMapPropagation(B3HeaderFormat.INSTANCE, Propagation.B3_STRING) .build(); }
@Override public final void flush() { flush(new BufferNextMessage(sender, messageMaxBytes, 0)); }
/** Builds an async reporter that encodes zipkin spans as they are reported. */ public AsyncReporter<Span> build() { switch (sender.encoding()) { case JSON: return build(Encoder.JSON); case THRIFT: return build(Encoder.THRIFT); default: throw new UnsupportedOperationException(sender.encoding().name()); } }
@Override public void onFailure(Call call, IOException e) { delegate.onError(e); }
StreamingRequestBody(Encoding encoding, MediaType contentType, List<byte[]> values) { this.contentType = contentType; this.values = values; this.contentLength = encoding.listSizeInBytes(values); }
@Override public void incrementMessageBytes(int quantity) { increment(MetricKey.messageBytes, quantity); }
public long queuedSpans() { return get(MetricKey.spansPending); }
@Override public void updateQueuedBytes(int update) { update(MetricKey.spanBytesPending, update); }
@Override public void incrementMessagesDropped(Throwable cause) { increment(messagesDropped, cause, 1); }
public long messages() { return get(MetricKey.messages); }
@Override public void incrementMessages() { increment(MetricKey.messages, 1); }
public long messageBytes() { return get(MetricKey.messageBytes); }
@Override public void incrementSpanBytes(int quantity) { increment(MetricKey.spanBytes, quantity); }
public long queuedBytes() { return get(MetricKey.spanBytesPending); }