-
Notifications
You must be signed in to change notification settings - Fork 230
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
supporting scaffolders having multiple categories (#3035)
* supporting scaffolders having multiple categories * updated IScaffolder interface to use IEnumerable * small fix * hashing the category related telemetry values.
- Loading branch information
1 parent
31947f6
commit 424243b
Showing
13 changed files
with
71 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
10 changes: 8 additions & 2 deletions
10
src/dotnet-scaffolding/dotnet-scaffold/Telemetry/CommandExecuteTelemetryEvent.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,27 @@ | ||
// Licensed to the .NET Foundation under one or more agreements. | ||
// The .NET Foundation licenses this file to you under the MIT license. | ||
using Microsoft.DotNet.Scaffolding.Core.ComponentModel; | ||
using Microsoft.DotNet.Scaffolding.Internal.Extensions; | ||
using Microsoft.DotNet.Scaffolding.Internal.Telemetry; | ||
|
||
namespace Microsoft.DotNet.Tools.Scaffold.Telemetry; | ||
|
||
internal class CommandExecuteTelemetryEvent : TelemetryEventBase | ||
{ | ||
private const string TelemetryEventName = "CommandExecute"; | ||
public CommandExecuteTelemetryEvent(DotNetToolInfo dotnetToolInfo, CommandInfo commandInfo, int? exitCode) : base(TelemetryEventName) | ||
public CommandExecuteTelemetryEvent(DotNetToolInfo dotnetToolInfo, CommandInfo commandInfo, int? exitCode, string? chosenCategory = null) : base(TelemetryEventName) | ||
{ | ||
SetProperty("PackageName", dotnetToolInfo.PackageName); | ||
SetProperty("Version", dotnetToolInfo.Version); | ||
SetProperty("ToolName", dotnetToolInfo.Command); | ||
SetProperty("ToolLevel", dotnetToolInfo.IsGlobalTool ? TelemetryConstants.GlobalTool : TelemetryConstants.LocalTool); | ||
SetProperty("CommandName", commandInfo.Name); | ||
SetProperty("CommandCategory", commandInfo.DisplayCategory); | ||
SetProperty("AllCommandCategories", string.Join(",", commandInfo.DisplayCategories).Hash()); | ||
if (!string.IsNullOrEmpty(chosenCategory)) | ||
{ | ||
SetProperty("ChosenCategory", chosenCategory.Hash()); | ||
} | ||
|
||
SetProperty("Result", exitCode is null ? TelemetryConstants.Unknown : exitCode == 0 ? TelemetryConstants.Success : TelemetryConstants.Failure); | ||
} | ||
} |