Skip to content

Commit

Permalink
Include step context name and start/finish time in step telemetry (#2069
Browse files Browse the repository at this point in the history
)

* Include step context name in telemetry.

* .
  • Loading branch information
TingluoHuang authored Aug 23, 2022
1 parent 42c8666 commit 1cb1779
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/Runner.Worker/ExecutionContext.cs
Original file line number Diff line number Diff line change
Expand Up @@ -369,6 +369,7 @@ public IExecutionContext CreateChild(
child.StepTelemetry.StepId = recordId;
child.StepTelemetry.Stage = stage.ToString();
child.StepTelemetry.IsEmbedded = isEmbedded;
child.StepTelemetry.StepContextName = child.GetFullyQualifiedContextName(); ;

return child;
}
Expand Down Expand Up @@ -959,6 +960,8 @@ public void PublishStepTelemetry()
_record.StartTime != null)
{
StepTelemetry.ExecutionTimeInSeconds = (int)Math.Ceiling((_record.FinishTime - _record.StartTime)?.TotalSeconds ?? 0);
StepTelemetry.StartTime = _record.StartTime;
StepTelemetry.FinishTime = _record.FinishTime;
}

if (!IsEmbedded &&
Expand Down
9 changes: 9 additions & 0 deletions src/Sdk/DTWebApi/WebApi/ActionsStepTelemetry.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,9 @@ public ActionsStepTelemetry()
[DataMember(EmitDefaultValue = false)]
public Guid StepId { get; set; }

[DataMember(EmitDefaultValue = false)]
public string StepContextName { get; set; }

[DataMember(EmitDefaultValue = false)]
public bool? HasRunsStep { get; set; }

Expand Down Expand Up @@ -57,6 +60,12 @@ public ActionsStepTelemetry()
[DataMember(EmitDefaultValue = false)]
public int? ExecutionTimeInSeconds { get; set; }

[DataMember(EmitDefaultValue = false)]
public DateTime? StartTime { get; set; }

[DataMember(EmitDefaultValue = false)]
public DateTime? FinishTime { get; set; }

[DataMember(EmitDefaultValue = false)]
public string ContainerHookData { get; set; }
}
Expand Down

0 comments on commit 1cb1779

Please sign in to comment.