trailblazer-activity icon indicating copy to clipboard operation
trailblazer-activity copied to clipboard

When using task wrap you have no way to access the ID of the step

Open ChrisHampel opened this issue 3 years ago • 1 comments

When using custom macros that return a Proc/Lambda, you have no access to the id when applying a task wrap. Because of this, the only way you can try and derive a name/id of that step is to inspect the Proc, which is neither convenient nor produces a good name. In contrast, the custom macro would usually know a name to begin with. As such, it would be more convenient if the wrap context also contained the id so that you could use it. I want this feature so that I can have a name to log for each set for instrumentation purposes.

Thank you for your time in reading and considering this.

ChrisHampel avatar Oct 14 '21 10:10 ChrisHampel

Sorry for the late official response, you probably dropped TRB already :sweat_smile: Here's an example how you can get the ID: https://github.com/trailblazer/trailblazer-developer/blob/c8ff6f68e6c4d9b2fcf99a7ad9877d3e1f511bd4/lib/trailblazer/developer/trace.rb#L66

def my_task_wrap_task(wrap_config, ((ctx, flow), circuit_options))
  task = wrap_config[:task]
  activity = circuit_options[:activity]
 
  id = Trailblazer::Activity::Introspect::TaskMap(activity)[task].id
end  

Is that what you mean, @ChrisHampel ?

Note that this is per trailblazer-activity 0.15.0.

apotonick avatar Nov 10 '22 07:11 apotonick