@Override public void translateTo(ReportingEvent event, long sequence, Transaction t) { event.setTransaction(t); } };
@Override public ReportingEvent newInstance() { return new ReportingEvent(); } }
@Override public void translateTo(ReportingEvent event, long sequence) { event.shutdownEvent(); } };
private void sendShutdownEvent() { final ReportingEvent reportingEvent = new ReportingEvent(); reportingEvent.shutdownEvent(); reportingEventHandler.onEvent(reportingEvent, -1, true); }
private void reportSpan() { final ReportingEvent reportingEvent = new ReportingEvent(); reportingEvent.setSpan(new Span(mock(ElasticApmTracer.class))); reportingEventHandler.onEvent(reportingEvent, -1, true); }
private void reportTransaction(IntakeV2ReportingEventHandler reportingEventHandler) { final ReportingEvent reportingEvent = new ReportingEvent(); reportingEvent.setTransaction(new Transaction(mock(ElasticApmTracer.class))); reportingEventHandler.onEvent(reportingEvent, -1, true); }
private void reportError() { final ReportingEvent reportingEvent = new ReportingEvent(); reportingEvent.setError(new ErrorCapture(MockTracer.create())); reportingEventHandler.onEvent(reportingEvent, -1, true); }
@Override public void onEvent(ReportingEvent event, long sequence, boolean endOfBatch) { if (logger.isDebugEnabled()) { logger.debug("Receiving {} event (sequence {})", event.getType(), sequence); } try { if (!shutDown) { handleEvent(event, sequence, endOfBatch); } } finally { event.resetState(); } }
@Override public void report(Span span) { if (!tryAddEventToRingBuffer(span, SPAN_EVENT_TRANSLATOR)) { span.recycle(); } if (syncReport) { waitForFlush(); } }
@Override public void translateTo(ReportingEvent event, long sequence, Span s) { event.setSpan(s); } };
@Override public void translateTo(ReportingEvent event, long sequence, ErrorCapture error) { event.setError(error); } };
@Override public boolean cancel(boolean mayInterruptIfRunning) { if (isDone()) { return false; } disruptor.get(cursor).resetState(); // the volatile write also ensures visibility of the resetState() in other threads cancelled = true; return true; }
private void trustAll(HttpsURLConnection connection) { final SSLSocketFactory sf = SslUtils.getTrustAllSocketFactory(); if (sf != null) { // using the same instances is important for TCP connection reuse connection.setHostnameVerifier(SslUtils.getTrustAllHostnameVerifyer()); connection.setSSLSocketFactory(sf); } }
@Override public void run() { // if the ring buffer is full this waits until a slot becomes available // as this happens on a different thread, // the reporting does not block and thus there is no danger of deadlocks logger.debug("Request flush because the request timeout occurred"); flush = reporter.flush(); }
public IntakeV2ReportingEventHandler(Service service, ProcessInfo process, SystemInfo system, ReporterConfiguration reporterConfiguration, ProcessorEventHandler processorEventHandler, PayloadSerializer payloadSerializer) { this(service, process, system, reporterConfiguration, processorEventHandler, payloadSerializer, shuffleUrls(reporterConfiguration)); }
@Override public void translateTo(ReportingEvent event, long sequence) { event.setFlushEvent(); } };
@Override public long getReported() { return reportingEventHandler.getReported(); }
void switchToNextServerUrl() { serverUrlIterator.next(); }
@Override public Void get() throws InterruptedException { while (!isDone()) { Thread.sleep(1); } return null; }
@Override public void report(ErrorCapture error) { if (!tryAddEventToRingBuffer(error, ERROR_EVENT_TRANSLATOR)) { error.recycle(); } if (syncReport) { waitForFlush(); } }