From 4c554da501c74550d3de8cb1d265b2f00d5890c7 Mon Sep 17 00:00:00 2001 From: Fraser Molyneux Date: Tue, 7 Nov 2023 22:46:45 +0000 Subject: [PATCH] Updating apim policy --- src/abstractions/Models/ApimCustomEvent.cs | 2 +- src/func-app-sub/AppInsightsCustomEvents.cs | 5 ++++- terraform/api-management-api-func.tf | 7 +++---- 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/src/abstractions/Models/ApimCustomEvent.cs b/src/abstractions/Models/ApimCustomEvent.cs index 5f542d4..4ecc031 100644 --- a/src/abstractions/Models/ApimCustomEvent.cs +++ b/src/abstractions/Models/ApimCustomEvent.cs @@ -7,7 +7,7 @@ namespace Company.Abstractions.Models { public class ApimCustomEvent { + public string InterfaceId { get; set; } public string EventName { get; set; } - public Dictionary AdditionalProperties { get; set; } } } \ No newline at end of file diff --git a/src/func-app-sub/AppInsightsCustomEvents.cs b/src/func-app-sub/AppInsightsCustomEvents.cs index dcd1858..6540506 100644 --- a/src/func-app-sub/AppInsightsCustomEvents.cs +++ b/src/func-app-sub/AppInsightsCustomEvents.cs @@ -38,7 +38,10 @@ public async Task RunAppInsightsCustomEventsTrigger([EventHubTrigger("appinsight continue; } - TelemetryClient.TrackEvent(messageData.EventName, messageData?.AdditionalProperties); + TelemetryClient.TrackEvent(messageData.EventName, new Dictionary() + { + {"InterfaceId", messageData.InterfaceId} + }); } } } diff --git a/terraform/api-management-api-func.tf b/terraform/api-management-api-func.tf index 96eb713..844621e 100644 --- a/terraform/api-management-api-func.tf +++ b/terraform/api-management-api-func.tf @@ -100,11 +100,10 @@ resource "azurerm_api_management_api_policy" "funcapp_backend" { @{ return new JObject( + new JProperty("InterfaceId", "ID_VehicleTollBooth"), new JProperty("EventName", context.Operation.Name), - new JProperty("AdditionalProperties", new Dictionary(){ - {"EventTime", DateTime.UtcNow.ToString()}, - {"ServiceName", context.Deployment.ServiceName} - }) + new JProperty("EventTime", DateTime.UtcNow.ToString()), + new JProperty("ServiceName", context.Deployment.ServiceName) ).ToString(); }