diff --git a/elide-core/src/main/java/com/yahoo/elide/core/RequestScope.java b/elide-core/src/main/java/com/yahoo/elide/core/RequestScope.java index 4ef788cbfe..8811e5f31a 100644 --- a/elide-core/src/main/java/com/yahoo/elide/core/RequestScope.java +++ b/elide-core/src/main/java/com/yahoo/elide/core/RequestScope.java @@ -36,6 +36,7 @@ import java.util.Map; import java.util.Optional; import java.util.Set; +import java.util.UUID; import java.util.function.Function; import javax.ws.rs.core.MultivaluedHashMap; @@ -66,7 +67,7 @@ public class RequestScope implements com.yahoo.elide.security.RequestScope { //TODO - this ought to be read only and set in the constructor. @Getter @Setter private EntityProjection entityProjection; - + private final String requestId; private final Map expressionsByType; private PublishSubject lifecycleEvents; @@ -118,6 +119,7 @@ public RequestScope(String path, this.newPersistentResources = new LinkedHashSet<>(); this.dirtyResources = new LinkedHashSet<>(); this.deletedResources = new LinkedHashSet<>(); + this.requestId = UUID.randomUUID().toString(); Function permissionExecutorGenerator = elideSettings.getPermissionExecutor(); this.permissionExecutor = (permissionExecutorGenerator == null) @@ -204,6 +206,7 @@ protected RequestScope(String path, String apiVersion, this.distinctLifecycleEvents = outerRequestScope.distinctLifecycleEvents; this.updateStatusCode = outerRequestScope.updateStatusCode; this.queuedLifecycleEvents = outerRequestScope.queuedLifecycleEvents; + this.requestId = outerRequestScope.requestId; } public Set getNewResources() {