From ee029bb1fbfa50dd0195fa13a806eff9f780ddba Mon Sep 17 00:00:00 2001 From: jdickson Date: Thu, 12 Dec 2024 16:16:29 +0700 Subject: [PATCH] Add tags for is QA --- .../TimedStartupPublisher.cs | 8 +++++++- src/Agoda.DevFeedback.Common/DevFeedbackData.cs | 9 +++++++-- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/src/Agoda.DevFeedback.AspNetStartup/TimedStartupPublisher.cs b/src/Agoda.DevFeedback.AspNetStartup/TimedStartupPublisher.cs index afa951b..8fc0ada 100644 --- a/src/Agoda.DevFeedback.AspNetStartup/TimedStartupPublisher.cs +++ b/src/Agoda.DevFeedback.AspNetStartup/TimedStartupPublisher.cs @@ -1,5 +1,6 @@ using Agoda.DevFeedback.Common; using System; +using System.Collections.Generic; using System.Reflection; namespace Agoda.DevFeedback.AspNetStartup @@ -9,13 +10,18 @@ internal static class TimedStartupPublisher public static void Publish(string type, TimeSpan timeTaken) { var gitContext = GitContextReader.GetGitContext(); + + var tags = new Dictionary(); + + if(Environment.GetEnvironmentVariable("DISABLE_QA") != null) tags.Add("isDisableQa", Environment.GetEnvironmentVariable("DISABLE_QA")); var result = new DevFeedbackData( metricsVersion: Assembly.GetExecutingAssembly().GetName().Version?.ToString(), type: type, projectName: Assembly.GetEntryAssembly()?.GetName().Name, timeTaken: timeTaken.TotalMilliseconds.ToString(), - gitContext: gitContext + gitContext: gitContext, + tags: tags ); DevFeedbackPublisher.Publish(apiEndpoint: null, result, DevLocalDataType.Build); diff --git a/src/Agoda.DevFeedback.Common/DevFeedbackData.cs b/src/Agoda.DevFeedback.Common/DevFeedbackData.cs index e59efa5..fb27863 100644 --- a/src/Agoda.DevFeedback.Common/DevFeedbackData.cs +++ b/src/Agoda.DevFeedback.Common/DevFeedbackData.cs @@ -1,4 +1,5 @@ using System; +using System.Collections.Generic; using Newtonsoft.Json; namespace Agoda.DevFeedback.Common @@ -47,13 +48,16 @@ public class DevFeedbackData [JsonProperty("date")] public DateTime Date { get; set; } + [JsonProperty("tags")] + public Dictionary Tags { get; set; } + public DevFeedbackData( string metricsVersion, string type, string projectName, string timeTaken, - GitContext gitContext - ) + GitContext gitContext, + Dictionary tags = null) { Id = Guid.NewGuid(); Type = type; @@ -69,6 +73,7 @@ GitContext gitContext RepositoryName = gitContext.RepositoryName; Branch = gitContext.BranchName; Date = DateTime.UtcNow; + Tags = tags; } } }