I'm new to Azure and I'm some problems with the custom metrics feature in Azure. My app is sending custom metrics signals to the Azure Application Insights. If I go to the logs in Azure I can clearly see the signal with the content represented in form of customDimentions. This signal is captured by an Azure Alert, that sends a payload to a specified webhook. The issue is that I couldn't find add the customDImentions obj to the Alert payload. I know that Alerts have custom properties, but those are static.
Does anyone know a solution or a workaround?
After sending the signal from my application I can get some information in my alert like the signal name and the value, but not its properties
TelemetryClient
. Make sure to replace "CustomProperty1"
and "CustomProperty2"
with your actual custom dimension namesimport com.microsoft.applicationinsights.TelemetryClient;
import com.microsoft.applicationinsights.telemetry.MetricTelemetry;
public class MyApp {
private static TelemetryClient telemetry = new TelemetryClient();
public static void main(String[] args) {
// Your custom telemetry object
MyTelemetryObject customTelemetry = new MyTelemetryObject();
// Track custom metric
telemetry.trackMetric(new MetricTelemetry("MetricName", customTelemetry.getValue()));
// Add custom dimensions
telemetry.getContext().getProperties().put("CustomProperty1", customTelemetry.getCustomProperty1());
telemetry.getContext().getProperties().put("CustomProperty2", customTelemetry.getCustomProperty2());
// Flush telemetry data
telemetry.flush();
}
}
customDimensions.CustomProperty1 == "Value1" and customDimensions.CustomProperty2 == "Value2"
We need to check that the Log Analytics query includes the necessary custom dimensions in the result set.