public class TelemetryClient
extends java.lang.Object
Constructor and Description |
---|
TelemetryClient()
Initializes a new instance of the TelemetryClient class, configured from the active configuration.
|
TelemetryClient(TelemetryConfiguration configuration)
Initializes a new instance of the TelemetryClient class.
|
Modifier and Type | Method and Description |
---|---|
void |
flush()
Flushes possible pending Telemetries in the channel.
|
TelemetryContext |
getContext()
Gets the current context that will be used to augment telemetry you send.
|
boolean |
isDisabled()
Checks whether tracking is enabled or not.
|
void |
track(Telemetry telemetry)
This method is part of the Application Insights infrastructure.
|
void |
trackDependency(RemoteDependencyTelemetry telemetry) |
void |
trackDependency(java.lang.String dependencyName,
java.lang.String commandName,
Duration duration,
boolean success) |
void |
trackEvent(EventTelemetry telemetry)
Sends an EventTelemetry record for display in Diagnostic Search and aggregation in Metrics Explorer.
|
void |
trackEvent(java.lang.String name)
Sends an EventTelemetry record for display in Diagnostic Search and aggregation in Metrics Explorer.
|
void |
trackEvent(java.lang.String name,
java.util.Map<java.lang.String,java.lang.String> properties,
java.util.Map<java.lang.String,java.lang.Double> metrics)
Sends an EventTelemetry record for display in Diagnostic Search and aggregation in Metrics Explorer.
|
void |
trackException(java.lang.Exception exception)
Sends an ExceptionTelemetry record for display in Diagnostic Search.
|
void |
trackException(java.lang.Exception exception,
java.util.Map<java.lang.String,java.lang.String> properties,
java.util.Map<java.lang.String,java.lang.Double> metrics)
Sends an ExceptionTelemetry record for display in Diagnostic Search.
|
void |
trackException(ExceptionTelemetry telemetry)
Sends an ExceptionTelemetry record for display in Diagnostic Search.
|
void |
trackHttpRequest(java.lang.String name,
java.util.Date timestamp,
long duration,
java.lang.String responseCode,
boolean success)
Sends a HttpRequestTelemetry record for display in Diagnostic Search.
|
void |
trackMetric(MetricTelemetry telemetry)
Send a MetricTelemetry record for aggregation in Metric Explorer.
|
void |
trackMetric(java.lang.String name,
double value)
Sends a MetricTelemetry record for aggregation in Metric Explorer.
|
void |
trackMetric(java.lang.String name,
double value,
int sampleCount,
double min,
double max,
java.util.Map<java.lang.String,java.lang.String> properties)
Sends a MetricTelemetry record for aggregation in Metric Explorer.
|
void |
trackPageView(PageViewTelemetry telemetry)
Send information about the page viewed in the application.
|
void |
trackPageView(java.lang.String name) |
void |
trackRequest(RequestTelemetry request) |
void |
trackSessionState(SessionState sessionState)
Sends the specified state of a user session to Application Insights.
|
void |
trackTrace(java.lang.String message)
Sends a TraceTelemetry record for display in Diagnostic Search.
|
void |
trackTrace(java.lang.String message,
SeverityLevel severityLevel) |
void |
trackTrace(java.lang.String message,
SeverityLevel severityLevel,
java.util.Map<java.lang.String,java.lang.String> properties)
Sends a TraceTelemetry record for display in Diagnostic Search.
|
void |
trackTrace(TraceTelemetry telemetry)
Sends a TraceTelemetry record for display in Diagnostic Search.
|
public TelemetryClient(TelemetryConfiguration configuration)
configuration
- The configuration this instance will work with.public TelemetryClient()
public TelemetryContext getContext()
public boolean isDisabled()
public void trackSessionState(SessionState sessionState)
sessionState
- SessionState
value indicating the state of a user session.public void trackEvent(java.lang.String name, java.util.Map<java.lang.String,java.lang.String> properties, java.util.Map<java.lang.String,java.lang.Double> metrics)
name
- A name for the event.properties
- Named string values you can use to search and classify events.metrics
- Measurements associated with this event.public void trackEvent(java.lang.String name)
name
- A name for the event.public void trackEvent(EventTelemetry telemetry)
telemetry
- An event log item.public void trackTrace(java.lang.String message, SeverityLevel severityLevel, java.util.Map<java.lang.String,java.lang.String> properties)
message
- A log message.severityLevel
- The severity level.properties
- Named string values you can use to search and classify trace messages.public void trackTrace(java.lang.String message)
message
- A log message.public void trackTrace(java.lang.String message, SeverityLevel severityLevel)
public void trackTrace(TraceTelemetry telemetry)
telemetry
- The Telemetry
instance.public void trackMetric(java.lang.String name, double value, int sampleCount, double min, double max, java.util.Map<java.lang.String,java.lang.String> properties)
name
- The name of the measurementvalue
- The value of the measurement. Average if based on more than one sample count.sampleCount
- The sample count.min
- The minimum value of the sample.max
- The maximum value of the sample.properties
- Named string values you can use to search and classify trace messages.public void trackMetric(java.lang.String name, double value)
name
- The name of the measurementvalue
- The value of the measurement.public void trackMetric(MetricTelemetry telemetry)
telemetry
- The Telemetry
instance.public void trackException(java.lang.Exception exception, java.util.Map<java.lang.String,java.lang.String> properties, java.util.Map<java.lang.String,java.lang.Double> metrics)
exception
- The exception to log information about.properties
- Named string values you can use to search and classify trace messages.metrics
- Measurements associated with this exception event.public void trackException(java.lang.Exception exception)
exception
- The exception to log information about.public void trackException(ExceptionTelemetry telemetry)
telemetry
- An already constructed exception telemetry record.public void trackHttpRequest(java.lang.String name, java.util.Date timestamp, long duration, java.lang.String responseCode, boolean success)
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.public void trackRequest(RequestTelemetry request)
public void trackDependency(java.lang.String dependencyName, java.lang.String commandName, Duration duration, boolean success)
public void trackDependency(RemoteDependencyTelemetry telemetry)
public void trackPageView(java.lang.String name)
public void trackPageView(PageViewTelemetry telemetry)
telemetry
- The telemetry to sendpublic void track(Telemetry telemetry)
telemetry
- The Telemetry
instance.public void flush()