Class RequestTelemetry

  • All Implemented Interfaces:
    Telemetry

    public final class RequestTelemetry
    extends BaseTelemetry
    Encapsulates information about a web request handled by the application.

    You can send information about requests processed by your web application to Application Insights by passing an instance of this class to the 'trackRequest' method of the TelemetryClient

    • Constructor Summary

      Constructors 
      Constructor Description
      RequestTelemetry()
      Initializes a new instance of the HttpRequestTelemetry class.
      RequestTelemetry​(java.lang.String name, java.util.Date timestamp, long duration, java.lang.String responseCode, boolean success)
      Creates a new instance of the HttpRequestTelemetry class with the given name, time stamp, duration, HTTP response code and success property values.
      RequestTelemetry​(java.lang.String name, java.util.Date timestamp, Duration duration, java.lang.String responseCode, boolean success)
      Creates a new instance of the HttpRequestTelemetry class with the given name, time stamp, duration, HTTP response code and success property values.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      protected RequestData getData()  
      Duration getDuration()
      Gets the amount of time it took the application to handle the request.
      java.lang.String getId()
      Gets the unique identifier of the request.
      java.util.concurrent.ConcurrentMap<java.lang.String,​java.lang.Double> getMetrics()
      Gets a map of application-defined request metrics.
      java.lang.String getName()
      Gets or human-readable name of the requested page.
      java.lang.String getResponseCode()
      Gets response code returned by the application after handling the request.
      java.lang.String getSource()
      Gets the source for the request telemetry object.
      java.net.URL getUrl()
      Gets request url.
      boolean isSuccess()
      Gets a value indicating whether application handled the request successfully.
      void setDuration​(Duration duration)
      Sets the amount of time it took the application to handle the request.
      void setId​(java.lang.String id)
      Sets the unique identifier of the request.
      void setName​(java.lang.String name)
      Sets or human-readable name of the requested page.
      void setResponseCode​(java.lang.String responseCode)
      Sets response code returned by the application after handling the request.
      void setSource​(java.lang.String value)
      Sets the source for the request telemetry object.
      void setSuccess​(boolean success)
      Sets a value indicating whether application handled the request successfully.
      void setTimestamp​(java.util.Date timestamp)
      Sets the StartTime.
      void setUrl​(java.lang.String url)
      Sets request url.
      void setUrl​(java.net.URL url)
      Sets request url.
      • Methods inherited from class java.lang.Object

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

      • RequestTelemetry

        public RequestTelemetry​(java.lang.String name,
                                java.util.Date timestamp,
                                Duration duration,
                                java.lang.String responseCode,
                                boolean success)
        Creates a new instance of the HttpRequestTelemetry class with the given name, time stamp, duration, HTTP response code and success property values.
        Parameters:
        name - A user-friendly name for the request.
        timestamp - The time of the request.
        duration - The duration, as an Duration instance, of the request processing.
        responseCode - The HTTP response code.
        success - 'true' if the request was a success, 'false' otherwise.
      • RequestTelemetry

        public RequestTelemetry​(java.lang.String name,
                                java.util.Date timestamp,
                                long duration,
                                java.lang.String responseCode,
                                boolean success)
        Creates a new instance of the HttpRequestTelemetry class with the given name, time stamp, duration, HTTP response code and success property values.
        Parameters:
        name - A user-friendly name for the request.
        timestamp - The time of the request.
        duration - The duration, in milliseconds, of the request processing.
        responseCode - The HTTP response code.
        success - 'true' if the request was a success, 'false' otherwise.
      • RequestTelemetry

        public RequestTelemetry()
        Initializes a new instance of the HttpRequestTelemetry class.
    • Method Detail

      • getName

        public java.lang.String getName()
        Gets or human-readable name of the requested page.
      • setName

        public void setName​(java.lang.String name)
        Sets or human-readable name of the requested page.
      • getId

        public java.lang.String getId()
        Gets the unique identifier of the request.
      • setId

        public void setId​(java.lang.String id)
        Sets the unique identifier of the request.
      • getResponseCode

        public java.lang.String getResponseCode()
        Gets response code returned by the application after handling the request.
      • setResponseCode

        public void setResponseCode​(java.lang.String responseCode)
        Sets response code returned by the application after handling the request.
      • getSource

        public java.lang.String getSource()
        Gets the source for the request telemetry object. This often is an ID identifying the caller.
      • setSource

        public void setSource​(java.lang.String value)
        Sets the source for the request telemetry object. This often is an ID identifying the caller.
      • isSuccess

        public boolean isSuccess()
        Gets a value indicating whether application handled the request successfully.
      • setSuccess

        public void setSuccess​(boolean success)
        Sets a value indicating whether application handled the request successfully.
      • getDuration

        public Duration getDuration()
        Gets the amount of time it took the application to handle the request.
      • setDuration

        public void setDuration​(Duration duration)
        Sets the amount of time it took the application to handle the request.
      • getUrl

        @Nullable
        public java.net.URL getUrl()
                            throws java.net.MalformedURLException
        Gets request url.
        Throws:
        java.net.MalformedURLException
      • setUrl

        public void setUrl​(java.net.URL url)
        Sets request url.
      • setUrl

        public void setUrl​(java.lang.String url)
                    throws java.net.MalformedURLException
        Sets request url.
        Throws:
        java.net.MalformedURLException
      • getMetrics

        public java.util.concurrent.ConcurrentMap<java.lang.String,​java.lang.Double> getMetrics()
        Gets a map of application-defined request metrics.