That's quite the list of technical challenges. Can you tell us why we're doing this? Maybe I skimmed over it.
All the best, Matt Op ma 23 nov 2026, 22:55 schreef Romain Manni-Bucau via dev < [email protected]>: > Hi Hans, > > Thanks a lot for your feedback. > > Makes sense to try to reuse what exists even if it can be weird to use > logging for that (maybe just semantically). > > What about this refined proposal (will update the PR and made it rephrased > by chatgpt to try to avoid any phrasing ambiguity): > > Package: org.apache.hop.execution.context. > > - ExecutionContexts.addListener(ExecutionContextListener): registration > returning an ExecutionScope for unregistering that registration. > - ExecutionContexts.activate(String logChannelId): activate existing > correlation identity on the current thread and return a restoration scope. > - ExecutionContextListener.activate(String logChannelId): callback > returning an ExecutionScope owned by that activation; null means no > restoration is needed. > - ExecutionScope: AutoCloseable with a non-throwing close signature. > > Listeners own their tracing/logging context. Hop owns only registration > and pairing of returned scopes. No independent execution identities, parent > discovery, execution outcomes, or per-execution context store are > introduced. Activation is distinct from execution start/completion. Scopes > close on their opening thread in reverse order and restore context after > errors. Callback dispatch occurs outside registration locks. Listener > failures must not prevent execution or remaining scope cleanup. The > no-listener path is a cheap no-op. Registration changes affect later > activations; already opened scopes retain their cleanup callbacks. > > Activation boundaries: transform initialization, RunThread processing > through disposal, single-threaded transform batches/bundles/disposal, > workflow execution after channel initialization, actual executable action > clones, and necessary pipeline execution/cleanup boundaries. No per-row > dispatch in the normal local engine. > > > Cheers, > Romain > > On 2026/11/22 13:41:04 [email protected] wrote: > > Hi Romain, > > > > Thank you fir this. I finally found some time to review this mail. > > I think that the things you need can be fetched from the current model. > The only gap I see is the worker thread activation. This part we genuinly > do not have. > > > > Invocation identity: every pipeline, workflow, transform copy and action > run already has a unique logChannelId. Execution in execution info > locations has an id and a parentId (Execution.java:74-80). > > > > Parentage: ILoggingObject.getParent() and the LoggingRegistry hierarchy > already give the actual launching object, not a guess from names. > > > > Lifecycle events: PipelineStart, PipelineFinish, PipelineCompleted, > PipelineFailed, WorkflowBefore/AfterActionExecution, TransformBeforeStart, > TransformFinished, TransformFailed and ActionFailed already exist. > > > > I do no really see the need to introduce a new UUID which can't be > linked back to the current logging and metrics. We already hold a unique > identifier up to the transform/action level and it's entire parentage. > > > > Our naming and documentation might not be perfect in the current system. > > it might be interesting to have a cleaned up model and better naming and > wrap our current events into the new naming. > > > > So to answer the questions your proposal starts with: > > Which action launched this pipeline? > > > > ILoggingObject.getParent() / LoggingRegistry, with each run's > logChannelId as its id. The parent is set when the child is built, before > it is handed to another thread, so async runs keep the right parent. > > > > Which transform copy is running: > > TransformMetaDataCombi (copy number, logChannelId) through > TransformBeforeStart and TransformFinished > > > > -> these fire on teh coordinating thread so that might be a gap > > > > When it's really finished, including cleanup: > > PipelineCompleted already fires after everything has settled. That's the > reason it exists, to flush lineage (Pipeline.java:1662). Actions have > WorkflowAfterActionExecution and ActionFailed. > > > > Like I said there might be some gaps, but not sure if it warants a > completely separate system > > > > Kr, > > Hans > > > > > > On 16/11/26 10:08, Romain Manni-Bucau <[email protected]> wrote: > > > Hi everyone, > > > > > > I'd like to discuss the execution observation API proposed in: > > > https://github.com/apache/hop/pull/9481 > > > > > > Following Matt's feedback, I'm bringing the public API design here for > > > agreement before proceeding with the PR. > > > > > > The goal is to let integrations observe a complete local execution, > > > identify its actual launching parent, and activate integration-specific > > > context on the threads doing the work. The proposal is generic as a > first > > > step: it adds no OpenTelemetry, MDC, exporter or other > monitoring/specific > > > dependency to the engine. > > > > > > Motivation > > > ---------- > > > > > > An integration may need to answer questions such as: > > > > > > - Which workflow action launched this pipeline? > > > - Which actual transform copy is currently executing? > > > - When has an invocation really finished, including cleanup? > > > - How can context be restored correctly when a worker switches between > > > executions? > > > > > > Thread-local context alone cannot describe these relationships. An > > > asynchronous child can start after its launching action has finished, > and > > > an execution can use several threads during its lifetime. > > > > > > The central design choice is therefore to separate execution lifetime > from > > > thread-local activation. > > > > > > Proposed API > > > ------------ > > > > > > The types live in *org.apache.hop.execution.lifecycle*. > > > > > > *ExecutionHandle* > > > > > > Describes one invocation or actual runtime action/transform copy. It > > > exposes: > > > > > > - An opaque UUID identifying that invocation. > > > - An immutable parent handle. > > > - The runtime subject, compared by object identity rather than name or > > > equality. > > > - Its kind, name and copy number. > > > - A thread-safe attachment store for observer-owned context. > > > > > > The kinds are PIPELINE, WORKFLOW, ACTION and TRANSFORM. > > > > > > Attachments use observer-owned identity keys, allowing independent > > > integrations to keep their state separate. A child retains its exact > parent > > > handle even after that parent leaves the active registry. > > > > > > *ExecutionObserver* > > > > > > An integration implements three callbacks: > > > > > > > > > > > > > > > > > > > > > > > > > > > * void started(ExecutionHandle handle); ExecutionScope > > > activate(ExecutionHandle handle); void finished( ExecutionHandle > > > handle, ExecutionState state, Throwable failure);* > > > > > > Only started() is mandatory; the other methods have defaults. > > > > > > - started() creates integration-specific state for the invocation. > > > - activate() installs that state on the calling thread and returns a > > > restoration scope. > > > - finished() completes the integration's observation with SUCCEEDED, > FAILED > > > or CANCELLED, and an optional failure. > > > > > > For example, a tracing adapter could create a span in started(), make > its > > > context current in activate(), and end it in finished(). An MDC adapter > > > could instead install and restore logging attributes. > > > > > > *ExecutionScope* > > > > > > A closeable scope without checked exceptions. > > > > > > Activation scopes must close on the thread that opened them (generally > > > otherwise a lot of integration would be broken), in reverse nesting > order, > > > ideally using try-with-resources. They restore the previous context; > they > > > do not end the execution. > > > > > > *ExecutionLifecycle* > > > > > > Provides the registration and engine-side operations: > > > > > > - *addObserver(observer)* registers an observer and returns a closeable > > > registration. > > > - *begin(subject, parentSubject, kind, name, copy)* opens an execution. > > > - *get(subject) *looks up an active handle. > > > - *current()* returns the calling thread's activated handle. > > > - *activate(subject)* opens a thread-local activation scope. > > > - *finish(subject, state, failure)* removes the active execution and > > > notifies observers. > > > - *associate(child, launcher)* captures parentage before asynchronous > > > dispatch. > > > > > > Intended usage > > > -------------- > > > > > > Most integration authors would register an observer, not manually wrap > > > pipeline or workflow execution: > > > > > > > > > * final ExecutionScope registration = > > > ExecutionLifecycle.addObserver(new MyExecutionObserver());* > > > > > > The integration owns that registration and closes it when it no longer > > > wants to observe new invocations. Closing it does not discard finish > > > notifications for executions the observer has already successfully > started. > > > > > > The engine owns the execution boundaries. Conceptually, its use is: > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > * ExecutionLifecycle.begin( subject, parentSubject, > > > ExecutionKind.PIPELINE, name, 0); try { try (ExecutionScope scope = > > > ExecutionLifecycle.activate(subject)) { // Execute the invocation. > > > } } finally { // Publish the actual terminal outcome after > execution > > > and cleanup settle. ExecutionLifecycle.finish(subject, > terminalState, > > > failure); }* > > > This is a simplified illustration: the implementation accounts for > > > preparation failures, worker completion, disposal and asynchronous > > > execution rather than treating a lexical block or stop request as > proof of > > > completion. > > > > > > Observers can keep transportable context in handle attachments and > retrieve > > > it through the parent handle when creating child observations. > Attachments > > > should not contain live thread-affine scopes, and integrations should > avoid > > > retaining handles longer than needed. > > > > > > Asynchronous parentage > > > ---------------------- > > > > > > Before dispatching a child, a launcher calls: > > > > > > * ExecutionLifecycle.associate(child, launchingActionOrTransform);* > > > > > > When the child begins, it consumes that captured parent association. > > > > > > This avoids reconstructing parentage from names or whatever happens to > be > > > current on the worker thread. It also preserves the launching parent's > > > identity if the parent has already finished. > > > > > > The PR wires this into ActionPipeline, ActionWorkflow, > PipelineExecutor and > > > WorkflowExecutor. > > > > > > Parentage describes the invocation hierarchy, not data-flow hops > between > > > transforms. Ending a parent does not implicitly end an asynchronous > child. > > > > > > Concurrency and failure semantics > > > --------------------------------- > > > > > > Observer callbacks run outside the registry lock. Different executions > may > > > call the same observer concurrently, so implementations must be > > > thread-safe. Callbacks are synchronous on the invoking thread and > should > > > remain short; slow exporting or other I/O should generally be handed > off by > > > the integration. > > > > > > If finish races with startup, the active entry is removed immediately, > but > > > finish notification is deferred until startup callbacks return. > > > Successfully started observers receive their matching finish > notification; > > > an observer whose startup throws must clean up its partial work and > > > receives no subsequent callbacks for that execution. > > > > > > Observer failures are isolated from business execution. This does not > > > change the existing failure semantics of Hop extension points. > > > > > > One explicit concurrency rule is that the handle is published before > > > startup notification completes. A concurrent or reentrant begin() for > the > > > same subject returns that handle without waiting. The caller opening > the > > > invocation must let its initial begin() return before dispatching > execution > > > or activation to other threads. > > > > > > Relationship to extension points and lineage > > > --------------------------------------------- > > > > > > The intent is not to replace either mechanism: > > > > > > - Extension points remain the hooks for their existing named events, > with > > > their existing payloads and behavior. > > > - Lineage remains responsible for lineage event content, dataset > > > relationships, delivery and flushing. > > > - This proposal adds invocation identity, exact launching parentage, > and > > > scoped activation/restoration on executing threads. > > > > > > Execution handle IDs are not intended to replace existing lineage run > > > identifiers. There is no automatic lineage bridge or additional lineage > > > event emission in this PR. > > > > > > An important question for this discussion is whether these guarantees > > > justify a separate contract, or whether they should instead be > incorporated > > > into existing hooks. > > > > > > Scope and overhead > > > ------------------ > > > > > > The proposal covers local workflows and local > multithreaded/single-threaded > > > pipelines, including actual action clones and transform copies. > > > > > > It does not claim support for remote execution, Hop Server request > context, > > > Beam/Spark workers, or arbitrary third-party threads. > > > > > > Without registered observers, no execution identities or active > registry > > > entries are created. There are no per-row execution identities or > lifecycle > > > notifications. Multithreaded transform processing uses an activation > around > > > the processing loop; single-threaded interleaving activates the > existing > > > copy execution as each copy is visited. > > > > > > Next steps > > > ------------- > > > > > > As Matt mentionned in the PR, since it is about creating a new API it > makes > > > sense to get an agreement there before any merge. > > > > > > I'd particularly appreciate feedback on: > > > > > > 1. The overall approach. > > > 2. The API names, ownership and lifetime/activation split. > > > 3. Process-wide registration and concurrent callback semantics > (alternative > > > we should forward the pipeline/workflow ref but it might be very hard > in > > > some case and a blocker when if we with beam abstraction at some > point). > > > 4. How this should coexist with, or eventually be consumed by, lineage > > > integrations (I'm fine we do another iteration on it but at some point > > > lineage should integrate with these identifiers). > > > 5. Whether the local-only initial scope is appropriate (to have done > it in > > > Spark and Beam it can be way more tricky and make the PR bloated so I > > > preferred a light approach for now covering the local engine). > > > > > > Any feedback is welcomed so do not hesitate. > > > > > > Thanks, > > > Romain Manni-Bucau > > > @rmannibucau <https://x.com/rmannibucau> | .NET Blog > > > <https://dotnetbirdie.github.io/> | Blog < > https://rmannibucau.github.io/> | Old > > > Blog <http://rmannibucau.wordpress.com> | Github > > > <https://github.com/rmannibucau> | LinkedIn > > > <https://www.linkedin.com/in/rmannibucau> | Book > > > < > https://www.packtpub.com/en-us/product/java-ee-8-high-performance-9781788473064 > > > > > Javaccino <https://javaccino.dev/> founder (Java/.NET service - > contact via > > > linkedin) > > > > > >
