Skip to content

Commit

Permalink
make changes
Browse files Browse the repository at this point in the history
  • Loading branch information
dicko2 committed Dec 12, 2024
1 parent ee029bb commit 7946309
Showing 1 changed file with 19 additions and 2 deletions.
21 changes: 19 additions & 2 deletions 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;
using System.Collections.Generic;
using System.Reflection;

Expand All @@ -10,10 +11,26 @@ internal static class TimedStartupPublisher
public static void Publish(string type, TimeSpan timeTaken)
{
var gitContext = GitContextReader.GetGitContext();

var tags = new Dictionary<string, string>();
const string TAG_PREFIX = "DEVFEEDBACK_TAG_";

// Get all environment variables and filter for ones starting with DEVFEEDBACK_TAG_
foreach (DictionaryEntry de in Environment.GetEnvironmentVariables())
{
string key = de.Key.ToString();
if (key.StartsWith(TAG_PREFIX, StringComparison.OrdinalIgnoreCase))
{
// Remove the prefix to get the clean tag name
string tagName = key.Substring(TAG_PREFIX.Length).ToLowerInvariant();
string tagValue = de.Value?.ToString() ?? string.Empty;

if(Environment.GetEnvironmentVariable("DISABLE_QA") != null) tags.Add("isDisableQa", Environment.GetEnvironmentVariable("DISABLE_QA"));
if (!string.IsNullOrEmpty(tagValue))
{
tags.Add(tagName, tagValue);
}
}
}

var result = new DevFeedbackData(
metricsVersion: Assembly.GetExecutingAssembly().GetName().Version?.ToString(),
Expand Down

0 comments on commit 7946309

Please sign in to comment.