Package 

Class EventListener


  • 
    public abstract class EventListener
    
                        

    Listener for metrics events. Extend this class to monitor the quantity, size, and duration of your application's HTTP calls.

    All start/connect/acquire events will eventually receive a matching end/release event, either successful (non-null parameters), or failed (non-null throwable). The first common parameters of each event pair are used to link the event in case of concurrent or repeated events e.g. dnsStart(call, domainName) -> dnsEnd(call, domainName, inetAddressList).

    Nesting is as follows

    • call -> (dns -> connect -> secure connect)* -> request events
    • call -> (connection acquire/release)*

    Request events are ordered: requestHeaders -> requestBody -> responseHeaders -> responseBody

    Since connections may be reused, the dns and connect events may not be present for a call, or may be repeated in case of failure retries, even concurrently in case of happy eyeballs type scenarios. A redirect cross domain, or to use https may cause additional connection and request events.

    All event methods must execute fast, without external locking, cannot throw exceptions, attempt to mutate the event parameters, or be reentrant back into the client. Any IO - writing to files or network should be done asynchronously.

    • Method Summary

      Modifier and Type Method Description
      void callStart(TdsHttp.Call call) Invoked as soon as a call is enqueued or executed by a client.
      void callEnd(String url) Invoked immediately after a call has completely ended.
      void callFailed(String url, IOException ioe) Invoked when a call fails permanently.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • callStart

         void callStart(TdsHttp.Call call)

        Invoked as soon as a call is enqueued or executed by a client. In case of thread or streamlimits, this call may be executed well before processing the request is able to begin.

        This will be invoked only once for a single Call. Retries of different routesor redirects will be handled within the boundaries of a single callStart and /callFailed pair.

      • callEnd

         void callEnd(String url)

        Invoked immediately after a call has completely ended. This includes delayed consumptionof response body by the caller.

        This method is always invoked after callStart.