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 is used to augment telemetry you send.
|
boolean |
isDisabled()
Checks whether tracking is enabled.
|
void |
track(Telemetry telemetry)
This method is part of the Application Insights infrastructure.
|
void |
trackDependency(RemoteDependencyTelemetry telemetry)
Sends a dependency record to Application Insights.
|
void |
trackDependency(java.lang.String dependencyName,
java.lang.String commandName,
Duration duration,
boolean success) |
void |
trackEvent(EventTelemetry telemetry)
Sends a custom event record to Application Insights.
|
void |
trackEvent(java.lang.String name)
Sends a custom event record to Application Insights.
|
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 a custom event record to Application Insights.
|
void |
trackException(java.lang.Exception exception)
Sends an exception record to Application Insights.
|
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 exception record to Application Insights.
|
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 request record to Application Insights.
|
void |
trackMetric(MetricTelemetry telemetry)
Sends a numeric metric to Application Insights.
|
void |
trackMetric(java.lang.String name,
double value)
Sends a numeric metric to Application Insights.
|
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 numeric metric to Application Insights.
|
void |
trackPageView(PageViewTelemetry telemetry)
Send information about the page viewed in the application.
|
void |
trackPageView(java.lang.String name)
Sends a page view record to Application Insights.
|
void |
trackRequest(RequestTelemetry request)
Sends a request record to Application Insights.
|
void |
trackSessionState(SessionState sessionState)
Deprecated.
This method will be deprecated in version 2.0.0 of the Java SDK.
|
void |
trackTrace(java.lang.String message)
Sends a TraceTelemetry record to Application Insights.
|
void |
trackTrace(java.lang.String message,
SeverityLevel severityLevel)
Sends a TraceTelemetry record.
|
void |
trackTrace(java.lang.String message,
SeverityLevel severityLevel,
java.util.Map<java.lang.String,java.lang.String> properties)
Sends a TraceTelemetry record to Application Insights.
|
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()
@Deprecated public void trackSessionState(SessionState sessionState)
trackEvent(String name)
as this method will be deprecated.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. Max length 150.properties
- Named string values you can use to search and filter events.metrics
- Numeric measurements associated with this event. Appear under Custom Metrics in Metrics Explorer.public void trackEvent(java.lang.String name)
name
- A name for the event. Max length 150.public void trackEvent(EventTelemetry telemetry)
telemetry
- An event telemetry item.public void trackTrace(java.lang.String message, SeverityLevel severityLevel, java.util.Map<java.lang.String,java.lang.String> properties)
message
- A log message. Max length 10000.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. Max length 10000.public void trackTrace(java.lang.String message, SeverityLevel severityLevel)
message
- A log message. Max length 10000.severityLevel
- The severity level.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 metric. Max length 150.value
- The value of the metric. Average if based on more than one sample count. Should be greater than 0.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 metric. Max length 150.value
- The value of the metric. Should be greater than 0.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. Appear in "custom metrics" in Metrics Explorer.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 or operation.timestamp
- The time of the request.duration
- The duration, in milliseconds, of the request processing.responseCode
- The HTTP response code.success
- true to record the operation as a successful request, false as a failed request.public void trackRequest(RequestTelemetry request)
request
- requestpublic void trackDependency(java.lang.String dependencyName, java.lang.String commandName, Duration duration, boolean success)
public void trackDependency(RemoteDependencyTelemetry telemetry)
telemetry
- telemetrypublic void trackPageView(java.lang.String name)
name
- The name of the page.public void trackPageView(PageViewTelemetry telemetry)
telemetry
- The telemetry to sendpublic void track(Telemetry telemetry)
telemetry
- The Telemetry
instance.public void flush()