I am submitting custom metrics from my Java application to Azure Application Insights. Every few seconds a thread wakes up, gets the metrics from the application, and pushes them to Azure. Here is some sample code for how I am doing this:
TelemetryClient telemetryClient = new TelemetryClient();
MetricTelemetry telemetry = new MetricTelemetry();
telemetry.setTimestamp(metricbean.getMetricTimestamp());
telemetry.setName("My custom metric");
telemetry.setValue( metricbean.getValue());
telemetry.setCount(1);
telemetryClient.trackMetric(telemetry);
I am seeing the metrics on the Azure portal which is good. Azure is supposed to support Dimensions and Namespaces. How can I set this using the TelemetryClient API in Java?
Also, is there anyway to check a return code? The "trackMetric()" method is void and does not throw any checked exceptions?