Add os_signpost logs for render() and Workflow and Worker lifecycle - #1134
Conversation
@dhavalshreyas Do we need to bump the spm tests to iOS 10? |
| .start { [weak self] event in | ||
| switch event { | ||
| case .value(let output): | ||
| self?.handle(output: output) |
There was a problem hiding this comment.
Does it make sense to log an event to indicate a worker emitted a value and it's about to be handled? So you would see that the worker emitted the event, and then it was mapped and handled by a sink?
There was a problem hiding this comment.
Maybe move the logging to a different function. logWorkerState(event:)?
There was a problem hiding this comment.
I'm exploring using .on(…) in the stream (similar to what .logEvents does). I'll update this soon.
There was a problem hiding this comment.
Did the .on(..) work out?
|
|
||
| import os.signpost | ||
|
|
||
| extension OSLog { |
There was a problem hiding this comment.
Nit: Should this file be called OSLog+Workflow or OSLog+LogSubsystems or something other than just "Log"?
|
Sorry about the false close, I accidentally hit the button when I tried to cancel a comment. |
Yes! Bumped it up here #1135 |
|
This is awesome @AquaGeek! Thank you for getting this in! |
| .start { [weak self] event in | ||
| switch event { | ||
| case .value(let output): | ||
| self?.handle(output: output) |
There was a problem hiding this comment.
Maybe move the logging to a different function. logWorkerState(event:)?
|
OK. Everything is on this branch now. I think the last open question is: should we remove the event logging (i.e. sink and worker events) or make them more generic for now? One option would be to log the related Workflow/Worker type instead of the event type (as that's essentially useless, e.g. |
8a73d32 to
935f09f
Compare
I would vote for making them more generic "Action" along with a comment and a follow up task to log the more detail once we get the sign off from Mosec over removing the logging altogether. |
To clarify, when I say remove logging I mean remove event logging (for sink events and worker outputs). All the lifecycle stuff can stay. |
| .start { [weak self] event in | ||
| switch event { | ||
| case .value(let output): | ||
| self?.handle(output: output) |
There was a problem hiding this comment.
Did the .on(..) work out?
| func makeSink<Action>(of actionType: Action.Type) -> Sink<Action> where Action: WorkflowAction, WorkflowType == Action.WorkflowType { | ||
| let reusableSink = sinkStore.findOrCreate(actionType: Action.self) | ||
|
|
||
| let signpostRef = NSObject() |
There was a problem hiding this comment.
Wonder if we should create a type which has the log... events and acts as a ref instead of creating an arbitrary object to act as ref.
There was a problem hiding this comment.
🤷 I'm not overly-concerned about it. We could make the log... calls member functions instead of static functions (and use the object as the object we use to look up the signpost ID. We'd have to figure out how to plumb that object around to the various places that need it.
I think this is fine for now. Thoughts?
There was a problem hiding this comment.
I meant, creating something like:
class SignpostRef: AnyObject {
func log(...)
}But, this is just a nit, feel free to ship as-is!
|
Regarding the actions, I'm fine with either way as long as someone takes DRI to try and get the approval to add them in. I think it's very valuable, and likely that we'll get approval. My vote would be to keep them in with a comment to the followup work. |
|
I changed the event logging to log the Pros:
Cons:
|

Fixes #1083
We are logging:
Workflowcreation and destruction*Workercreation and destruction*Workflowrender()callsSinkevents — note: The format strings specified for these does not include the "public" specifier, so they shouldn't show up in logs unless a debugger is attached. This is important, as you don't want to e.g. log password entry in text fields.*Note: We're not instrumenting the
Workflows orWorkers themselves; we're instrumenting the infrastructure that gets created to hold onto them.