Browse Source

Refactor telemetry activity initialization in AddModuleCommand

Moved solutionFile assignment to after telemetry activity tracking and removed passing solutionFile as a telemetry property. This streamlines the activity initialization and improves code clarity.
pull/24395/head
SALİH ÖZKARA 2 months ago
parent
commit
b8abda6800
  1. 7
      framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/AddModuleCommand.cs

7
framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/AddModuleCommand.cs

@ -69,14 +69,10 @@ public class AddModuleCommand : IConsoleCommand, ITransientDependency
}
var newTemplate = commandLineArgs.Options.ContainsKey(Options.NewTemplate.Long);
var solutionFile = GetSolutionFile(commandLineArgs);
await using var _ = TelemetryService.TrackActivityAsync(newTemplate
? ActivityNameConsts.AbpCliCommandsInstallLocalModule
: ActivityNameConsts.AbpCliCommandsInstallModule, o =>
{
o[ActivityPropertyNames.SolutionPath] = solutionFile;
});
: ActivityNameConsts.AbpCliCommandsInstallModule);
var template = commandLineArgs.Options.GetOrNull(Options.Template.Short, Options.Template.Long);
var newProTemplate = !string.IsNullOrEmpty(template) && template == ModuleProTemplate.TemplateName;
@ -84,6 +80,7 @@ public class AddModuleCommand : IConsoleCommand, ITransientDependency
var addSourceCodeToSolutionFile = withSourceCode && commandLineArgs.Options.ContainsKey("add-to-solution-file");
var skipOpeningDocumentation = commandLineArgs.Options.ContainsKey(Options.SkipOpeningDocumentation.Long);
var skipDbMigrations = newTemplate || newProTemplate || commandLineArgs.Options.ContainsKey(Options.DbMigrations.Skip);
var solutionFile = GetSolutionFile(commandLineArgs);
var version = commandLineArgs.Options.GetOrNull(Options.Version.Short, Options.Version.Long);
if (version == null)

Loading…
Cancel
Save