diff --git a/components/core/core-base/src/main/java/org/eclipse/dirigible/components/base/synchronizer/BaseSynchronizer.java b/components/core/core-base/src/main/java/org/eclipse/dirigible/components/base/synchronizer/BaseSynchronizer.java
index 5a55c82cb1a..d1284639c3d 100644
--- a/components/core/core-base/src/main/java/org/eclipse/dirigible/components/base/synchronizer/BaseSynchronizer.java
+++ b/components/core/core-base/src/main/java/org/eclipse/dirigible/components/base/synchronizer/BaseSynchronizer.java
@@ -9,6 +9,9 @@
*/
package org.eclipse.dirigible.components.base.synchronizer;
+import io.opentelemetry.api.trace.Span;
+import io.opentelemetry.api.trace.Tracer;
+import io.opentelemetry.context.Scope;
import org.eclipse.dirigible.components.base.artefact.Artefact;
import org.eclipse.dirigible.components.base.artefact.ArtefactLifecycle;
import org.eclipse.dirigible.components.base.artefact.ArtefactPhase;
@@ -16,6 +19,7 @@
import org.eclipse.dirigible.components.base.spring.BeanProvider;
import org.eclipse.dirigible.components.base.tenant.TenantContext;
import org.eclipse.dirigible.components.base.tenant.TenantResult;
+import org.eclipse.dirigible.components.open.telemetry.OpenTelemetryProvider;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -25,7 +29,6 @@
/**
* The Class BaseSynchronizer.
- *
*/
public abstract class BaseSynchronizer implements Synchronizer {
@@ -41,6 +44,41 @@ public abstract class BaseSynchronizer implements Synchr
*/
@Override
public final boolean complete(TopologyWrapper wrapper, ArtefactPhase flow) {
+ Tracer tracer = OpenTelemetryProvider.get()
+ .getTracer("eclipse-dirigible");
+
+ String synchronizerClassName = this.getClass()
+ .getSimpleName();
+ Span span = tracer.spanBuilder("synchronizer_" + synchronizerClassName + "_complete_execution")
+ .startSpan();
+
+ try (Scope scope = span.makeCurrent()) {
+ addSpanAttributes(span, wrapper, flow);
+ return completeInternal(wrapper, flow);
+
+ } catch (RuntimeException e) {
+ span.recordException(e);
+ span.setStatus(io.opentelemetry.api.trace.StatusCode.ERROR, "Exception occurred during synchronization");
+
+ throw e;
+ } finally {
+ span.end();
+ }
+ }
+
+ private void addSpanAttributes(Span span, TopologyWrapper wrapper, ArtefactPhase phase) {
+ addSpanAttributes(wrapper.getArtefact(), span);
+
+ span.setAttribute("phase", phase.getValue());
+ }
+
+ private void addSpanAttributes(A artefact, Span span) {
+ span.setAttribute("synchronizer", this.getClass()
+ .getName());
+ span.setAttribute("artefactKey", artefact.getKey());
+ }
+
+ private boolean completeInternal(TopologyWrapper wrapper, ArtefactPhase flow) {
A artefact = wrapper.getArtefact();
ArtefactLifecycle lifecycle = artefact.getLifecycle();
@@ -98,6 +136,30 @@ protected boolean isMultitenantArtefact(A artefact) {
* @param artefact the artefact
*/
public final void cleanup(A artefact) {
+ Tracer tracer = OpenTelemetryProvider.get()
+ .getTracer("eclipse-dirigible");
+
+ String synchronizerClassName = this.getClass()
+ .getSimpleName();
+ Span span = tracer.spanBuilder("synchronizer_" + synchronizerClassName + "_cleanup_execution")
+ .startSpan();
+
+ try (Scope scope = span.makeCurrent()) {
+ addSpanAttributes(artefact, span);
+
+ cleanupInternal(artefact);
+
+ } catch (RuntimeException e) {
+ span.recordException(e);
+ span.setStatus(io.opentelemetry.api.trace.StatusCode.ERROR, "Exception occurred during synchronization");
+
+ throw e;
+ } finally {
+ span.end();
+ }
+ }
+
+ private void cleanupInternal(A artefact) {
if (!multitenantExecution() || !isMultitenantArtefact(artefact)) {
logger.debug("[{} will cleanup artefact [{}]", this, artefact);
cleanupImpl(artefact);
diff --git a/components/engine/engine-bpm-flowable/src/main/java/org/eclipse/dirigible/components/engine/bpm/flowable/delegate/DirigibleCallDelegate.java b/components/engine/engine-bpm-flowable/src/main/java/org/eclipse/dirigible/components/engine/bpm/flowable/delegate/DirigibleCallDelegate.java
index 4a1d034d9bf..2609d1099b8 100644
--- a/components/engine/engine-bpm-flowable/src/main/java/org/eclipse/dirigible/components/engine/bpm/flowable/delegate/DirigibleCallDelegate.java
+++ b/components/engine/engine-bpm-flowable/src/main/java/org/eclipse/dirigible/components/engine/bpm/flowable/delegate/DirigibleCallDelegate.java
@@ -225,7 +225,6 @@ public void execute(DelegateExecution execution) {
} finally {
span.end();
}
-
}
private void addSpanAttributes(DelegateExecution execution, Span span) {