Skip to content

Commit

Permalink
Add tags for is QA
Browse files Browse the repository at this point in the history
  • Loading branch information
dicko2 committed Dec 12, 2024
1 parent 4050870 commit ee029bb
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 3 deletions.
8 changes: 7 additions & 1 deletion src/Agoda.DevFeedback.AspNetStartup/TimedStartupPublisher.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using Agoda.DevFeedback.Common;
using System;
using System.Collections.Generic;
using System.Reflection;

namespace Agoda.DevFeedback.AspNetStartup
Expand All @@ -9,13 +10,18 @@ internal static class TimedStartupPublisher
public static void Publish(string type, TimeSpan timeTaken)
{
var gitContext = GitContextReader.GetGitContext();

var tags = new Dictionary<string, string>();

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);
Expand Down
9 changes: 7 additions & 2 deletions src/Agoda.DevFeedback.Common/DevFeedbackData.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System;
using System.Collections.Generic;
using Newtonsoft.Json;

namespace Agoda.DevFeedback.Common
Expand Down Expand Up @@ -47,13 +48,16 @@ public class DevFeedbackData
[JsonProperty("date")]
public DateTime Date { get; set; }

[JsonProperty("tags")]
public Dictionary<string,string> Tags { get; set; }

public DevFeedbackData(
string metricsVersion,
string type,
string projectName,
string timeTaken,
GitContext gitContext
)
GitContext gitContext,
Dictionary<string,string> tags = null)
{
Id = Guid.NewGuid();
Type = type;
Expand All @@ -69,6 +73,7 @@ GitContext gitContext
RepositoryName = gitContext.RepositoryName;
Branch = gitContext.BranchName;
Date = DateTime.UtcNow;
Tags = tags;
}
}
}

0 comments on commit ee029bb

Please sign in to comment.