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
ConstructorsConstructorDescriptionInitializes 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 RequestDatagetData()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.booleanGets a value indicating whether application handled the request successfully.voidsetDuration(Duration duration) Sets the amount of time it took the application to handle the request.voidSets the unique identifier of the request.voidSets or human-readable name of the requested page.voidsetResponseCode(String responseCode) Sets response code returned by the application after handling the request.voidSets the source for the request telemetry object.voidsetSuccess(boolean success) Sets a value indicating whether application handled the request successfully.voidsetTimestamp(Date timestamp) Sets the StartTime.voidSets request url.voidSets 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 anDurationinstance, 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:
setTimestampin interfaceTelemetry- Overrides:
setTimestampin 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:
getDatain classBaseTelemetry
-