1
1
using Agoda . DevFeedback . Common ;
2
2
using System ;
3
+ using System . Collections ;
4
+ using System . Collections . Generic ;
5
+ using System . Linq ;
3
6
using System . Reflection ;
4
7
5
8
namespace Agoda . DevFeedback . AspNetStartup
@@ -8,14 +11,28 @@ internal static class TimedStartupPublisher
8
11
{
9
12
public static void Publish ( string type , TimeSpan timeTaken )
10
13
{
14
+ const string TagPrefix = "DEVFEEDBACK_TAG_" ;
15
+
11
16
var gitContext = GitContextReader . GetGitContext ( ) ;
12
17
18
+ // Use LINQ and dictionary comprehension for cleaner tag collection
19
+ var tags = Environment . GetEnvironmentVariables ( )
20
+ . Cast < DictionaryEntry > ( )
21
+ . Select ( entry => ( Key : entry . Key . ToString ( ) ! , Value : entry . Value ? . ToString ( ) ) )
22
+ . Where ( entry => entry . Key . StartsWith ( TagPrefix , StringComparison . OrdinalIgnoreCase )
23
+ && ! string . IsNullOrEmpty ( entry . Value ) )
24
+ . ToDictionary (
25
+ entry => entry . Key [ TagPrefix . Length ..] . ToLowerInvariant ( ) ,
26
+ entry => entry . Value !
27
+ ) ;
28
+
13
29
var result = new DevFeedbackData (
14
30
metricsVersion : Assembly . GetExecutingAssembly ( ) . GetName ( ) . Version ? . ToString ( ) ,
15
31
type : type ,
16
32
projectName : Assembly . GetEntryAssembly ( ) ? . GetName ( ) . Name ,
17
33
timeTaken : timeTaken . TotalMilliseconds . ToString ( ) ,
18
- gitContext : gitContext
34
+ gitContext : gitContext ,
35
+ tags : tags
19
36
) ;
20
37
21
38
DevFeedbackPublisher . Publish ( apiEndpoint : null , result , DevLocalDataType . Build ) ;
0 commit comments