Skip to content

Commit 4149db7

Browse files
committed
remove ids
1 parent 42ea6ef commit 4149db7

File tree

2 files changed

+34
-8
lines changed

2 files changed

+34
-8
lines changed

shell/agents/Microsoft.Azure.Agent/AzureAgent.cs

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,7 @@ public void Initialize(AgentConfig config)
124124
public void OnUserAction(UserActionPayload actionPayload) {
125125
// Send telemetry about the user action.
126126
bool isUserFeedback = false;
127+
bool allowIdsForCorrelation = false;
127128
string details = null;
128129
UserAction action = actionPayload.Action;
129130

@@ -141,7 +142,14 @@ public void OnUserAction(UserActionPayload actionPayload) {
141142
allowIdsForCorrelation = like.ShareConversation;
142143
}
143144

144-
Telemetry.Trace(AzTrace.UserAction(action.ToString(), _copilotResponse, details, isUserFeedback));
145+
if (isUserFeedback)
146+
{
147+
Telemetry.Trace(AzTrace.Feedback(action.ToString(), _copilotResponse, details, allowIdsForCorrelation));
148+
}
149+
else
150+
{
151+
Telemetry.Trace(AzTrace.UserAction(action.ToString(), _copilotResponse, details));
152+
}
145153
}
146154

147155
public async Task RefreshChatAsync(IShell shell, bool force)

shell/agents/Microsoft.Azure.Agent/Telemetry.cs

Lines changed: 25 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -86,20 +86,40 @@ internal static void Initialize()
8686
internal object Details { get; set; }
8787

8888
internal static AzTrace UserAction(
89+
string shellCommand,
90+
CopilotResponse response,
91+
object details)
92+
{
93+
if (Telemetry.Enabled)
94+
{
95+
return new()
96+
{
97+
TopicName = response.TopicName,
98+
ShellCommand = shellCommand,
99+
EventType = "UserAction",
100+
Details = details
101+
};
102+
}
103+
104+
// Don't create an object when telemetry is disabled.
105+
return null;
106+
}
107+
108+
internal static AzTrace Feedback(
89109
string shellCommand,
90110
CopilotResponse response,
91111
object details,
92-
bool isFeedback = false)
112+
bool allowIdsForCorrelation)
93113
{
94114
if (Telemetry.Enabled)
95115
{
96116
return new()
97117
{
98-
QueryId = response.ReplyToId,
118+
QueryId = allowIdsForCorrelation ? response.ReplyToId : null,
99119
TopicName = response.TopicName,
100-
ConversationId = response.ConversationId,
120+
ConversationId = allowIdsForCorrelation ? response.ConversationId : null,
101121
ShellCommand = shellCommand,
102-
EventType = isFeedback ? "Feedback" : "UserAction",
122+
EventType = "Feedback",
103123
Details = details
104124
};
105125
}
@@ -115,9 +135,7 @@ internal static AzTrace Chat(CopilotResponse response)
115135
return new()
116136
{
117137
EventType = "Chat",
118-
QueryId = response.ReplyToId,
119-
TopicName = response.TopicName,
120-
ConversationId = response.ConversationId
138+
TopicName = response.TopicName
121139
};
122140
}
123141

0 commit comments

Comments
 (0)