Class RequestTelemetry
java.lang.Object
com.microsoft.applicationinsights.telemetry.BaseTelemetry
com.microsoft.applicationinsights.telemetry.RequestTelemetry
- All Implemented Interfaces:
Telemetry
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
ConstructorDescriptionInitializes a new instance of the HttpRequestTelemetry class.RequestTelemetry
(String name, Date timestamp, long duration, 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
(String name, Date timestamp, Duration duration, 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
Modifier and TypeMethodDescriptionprotected RequestData
getData()
Gets the amount of time it took the application to handle the request.getId()
Gets the unique identifier of the request.Gets a map of application-defined request metrics.getName()
Gets or human-readable name of the requested page.Gets response code returned by the application after handling the request.Gets the source for the request telemetry object.getUrl()
Gets request url.boolean
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
Sets the unique identifier of the request.void
Sets or human-readable name of the requested page.void
setResponseCode
(String responseCode) Sets response code returned by the application after handling the request.void
Sets the source for the request telemetry object.void
setSuccess
(boolean success) Sets a value indicating whether application handled the request successfully.void
setTimestamp
(Date timestamp) Sets the StartTime.void
Sets request url.void
Sets request url.Methods inherited from class com.microsoft.applicationinsights.telemetry.BaseTelemetry
getContext, getProperties, getTimestamp, initialize
-
Constructor Details
-
RequestTelemetry
public RequestTelemetry(String name, Date timestamp, Duration duration, 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 anDuration
instance, of the request processing.responseCode
- The HTTP response code.success
- 'true' if the request was a success, 'false' otherwise.
-
RequestTelemetry
public RequestTelemetry(String name, Date timestamp, long duration, 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 Details
-
setTimestamp
Sets the StartTime.- Specified by:
setTimestamp
in interfaceTelemetry
- Overrides:
setTimestamp
in classBaseTelemetry
-
getName
Gets or human-readable name of the requested page. -
setName
Sets or human-readable name of the requested page. -
getId
Gets the unique identifier of the request. -
setId
Sets the unique identifier of the request. -
getResponseCode
Gets response code returned by the application after handling the request. -
setResponseCode
Sets response code returned by the application after handling the request. -
getSource
Gets the source for the request telemetry object. This often is an ID identifying the caller. -
setSource
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
Gets the amount of time it took the application to handle the request. -
setDuration
Sets the amount of time it took the application to handle the request. -
getUrl
Gets request url.- Throws:
MalformedURLException
-
setUrl
Sets request url. -
setUrl
Sets request url.- Throws:
MalformedURLException
-
getMetrics
Gets a map of application-defined request metrics. -
getData
- Specified by:
getData
in classBaseTelemetry
-