-
Notifications
You must be signed in to change notification settings - Fork 1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Move JobTelemetry and StepsTelemetry into GlobalContext. #1680
Conversation
@@ -52,8 +52,7 @@ public interface IExecutionContext : IRunnerService | |||
Dictionary<string, string> IntraActionState { get; } | |||
Dictionary<string, VariableValue> JobOutputs { get; } | |||
ActionsEnvironmentReference ActionsEnvironment { get; } | |||
List<ActionsStepTelemetry> ActionsStepsTelemetry { get; } | |||
List<JobTelemetry> JobTelemetry { get; } | |||
ActionsStepTelemetry StepTelemetry { get; } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Each ExecutionContext
will hold a single ActionsStepTelemetry
object, the object will get append to the GlobalContext.ActionsStepsTelemetry
when ExecutionContext.Complete()
is called.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For composite child steps we don't call complete()
so I don't think you will be getting that data currently
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks for pointing this out, i will take a look.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like we only call .Complete()
in one place under composite action.
https://github.com/actions/runner/blob/main/src/Runner.Worker/Handlers/CompositeActionHandler.cs#L296
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am adding a new PublishStepTelemetry()
to executionContext, so composite actions can use that to publish step telemetry.
|
||
var jobCompletedEvent = new JobCompletedEvent(message.RequestId, message.JobId, result, jobContext.JobOutputs, jobContext.ActionsEnvironment, jobContext.Global.StepsTelemetry, jobContext.Global.JobTelemetry); | ||
Trace.Info($"Raising job completed event: {StringUtil.ConvertToJson(jobCompletedEvent)}"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
revert the trace after testing...
@@ -150,6 +118,40 @@ public override void Initialize(IHostContext hostContext) | |||
ActionCommandManager = hostContext.CreateService<IActionCommandManager>(); | |||
} | |||
|
|||
protected string GetActionRef() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this method is only get moved down and changed from public virtual
to protected
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
We introduced
GlobalContext
toExecutionContext
for holding shared objects of allExecutionContext
(Job + Steps).Both
ActionsStepsTelemetry
andJobTelemetry
fail into thisshared objects
category, so I am moving both into theGlobalContext
.Moving forward, you will not need to worry about which context (job vs. step) to use in order to get the right object.