Sending telemetry about actions usage. (#1688)

* Sending telemetry about actions usage.

* .

* L0 tests.

* .
This commit is contained in:
Tingluo Huang
2022-02-16 12:18:21 -05:00
committed by GitHub
parent f2578529b0
commit 882f36dcf8
13 changed files with 476 additions and 73 deletions

View File

@@ -22,7 +22,7 @@ namespace GitHub.Runner.Worker.Handlers
{
public ScriptActionExecutionData Data { get; set; }
public override void PrintActionDetails(ActionRunStage stage)
protected override void PrintActionDetails(ActionRunStage stage)
{
if (stage == ActionRunStage.Post)
@@ -145,13 +145,6 @@ namespace GitHub.Runner.Worker.Handlers
var githubContext = ExecutionContext.ExpressionValues["github"] as GitHubContext;
ArgUtil.NotNull(githubContext, nameof(githubContext));
// Add Telemetry to JobContext to send with JobCompleteMessage
if (stage == ActionRunStage.Main)
{
ExecutionContext.StepTelemetry.IsEmbedded = ExecutionContext.IsEmbedded;
ExecutionContext.StepTelemetry.Type = "run";
}
var tempDirectory = HostContext.GetDirectory(WellKnownDirectory.Temp);
Inputs.TryGetValue("script", out var contents);
@@ -219,6 +212,11 @@ namespace GitHub.Runner.Worker.Handlers
}
}
if (!string.IsNullOrEmpty(shellCommand))
{
ExecutionContext.StepTelemetry.Action = shellCommand;
}
// No arg format was given, shell must be a built-in
if (string.IsNullOrEmpty(argFormat) || !argFormat.Contains("{0}"))
{