Dear community,

*Context: *
I'm trying to implement an OpenTelemetry instrumentation of Jenkins, 
starting injecting distributed traces in job executions. 
See https://github.com/cyrille-leclerc/opentelemetry-plugin

*Question: *
*What is the recommended way to listen to the end of the execution of a 
step and to collect its result?*
I would like to listen the end of execution of `stage`and `git` steps to 
end a trace span reporting the result of the step.

I found the `GraphListener#onNewHead(FlowNode)` API and I identify the end 
of stage steps with `StepEndNode` containing a   whose descriptor is a 
`StageStep.DescriptorImpl` but

   - I am not clear on if I should track the `StepEndNode` containing a 
   `LabelAction` or an `ArgumentsAction`
   - On none of the StepEndNode give me access to the error thrown during 
   the execution to indicate a failure,  `StepEndNode#getError()` and 
   `StepEndNode.getExecution.getCauseOfFailure()` return null 
   during  `GraphListener#onNewHead(FlowNode)`

I'm wondering if I have to add a `BodyExecutionCallback` to the `
CpsBodyInvoker` but I didn't find an API to do this implementing a listener 
of the pipeline executions.

I have a similar request for `git` steps that don't even have a  
`StepEndNode`, how can I intercept the end of execution and the 
result/error of the execution of a `git` step.

I hope my question is detailed enough.

Cyrille

-- 
You received this message because you are subscribed to the Google Groups 
"Jenkins Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-dev/db5376b1-3888-46f0-9429-9b34e3940ed9n%40googlegroups.com.

Reply via email to