This is an automated email from the ASF dual-hosted git repository.
ahuber pushed a commit to branch 3975-telemetry
in repository https://gitbox.apache.org/repos/asf/causeway.git
The following commit(s) were added to refs/heads/3975-telemetry by this push:
new d2e6a388407 CAUSEWAY-3975: on interaction start provide user info
d2e6a388407 is described below
commit d2e6a388407507efb98921ed507816172a9ed0ca
Author: andi-huber <[email protected]>
AuthorDate: Mon Mar 23 09:26:39 2026 +0100
CAUSEWAY-3975: on interaction start provide user info
---
.../apache/causeway/commons/having/HasTypeSpecificAttributes.java | 5 +++++
.../causeway/core/interaction/session/CausewayInteraction.java | 4 ++--
.../core/runtimeservices/session/InteractionServiceDefault.java | 6 ++++++
3 files changed, 13 insertions(+), 2 deletions(-)
diff --git
a/commons/src/main/java/org/apache/causeway/commons/having/HasTypeSpecificAttributes.java
b/commons/src/main/java/org/apache/causeway/commons/having/HasTypeSpecificAttributes.java
index 5e4216112d3..c4563b5445a 100644
---
a/commons/src/main/java/org/apache/causeway/commons/having/HasTypeSpecificAttributes.java
+++
b/commons/src/main/java/org/apache/causeway/commons/having/HasTypeSpecificAttributes.java
@@ -18,6 +18,7 @@
*/
package org.apache.causeway.commons.having;
+import java.util.Optional;
import java.util.function.Function;
public interface HasTypeSpecificAttributes {
@@ -31,6 +32,10 @@ public interface HasTypeSpecificAttributes {
/** get type specific attribute */
<T> T getAttribute(Class<T> type);
+ default <T> Optional<T> lookupAttribute(final Class<T> type) {
+ return Optional.ofNullable(getAttribute(type));
+ }
+
/** remove type specific attribute */
void removeAttribute(Class<?> type);
diff --git
a/core/interaction/src/main/java/org/apache/causeway/core/interaction/session/CausewayInteraction.java
b/core/interaction/src/main/java/org/apache/causeway/core/interaction/session/CausewayInteraction.java
index 12b91d874ef..f1c3148f307 100644
---
a/core/interaction/src/main/java/org/apache/causeway/core/interaction/session/CausewayInteraction.java
+++
b/core/interaction/src/main/java/org/apache/causeway/core/interaction/session/CausewayInteraction.java
@@ -37,6 +37,7 @@
import org.apache.causeway.commons.internal.collections._Lists;
import org.apache.causeway.commons.internal.exceptions._Exceptions;
import org.apache.causeway.core.metamodel.execution.InteractionInternal;
+
import lombok.Getter;
import lombok.Setter;
import lombok.extern.slf4j.Slf4j;
@@ -212,9 +213,8 @@ private Execution<?,?> popAndComplete(
final ClockService clockService,
final MetricsService metricsService) {
- if(currentExecution == null) {
+ if(currentExecution == null)
throw new IllegalStateException("No current execution to pop");
- }
final Execution<?,?> popped = currentExecution;
var completedAt = clockService.getClock().nowAsJavaSqlTimestamp();
diff --git
a/core/runtimeservices/src/main/java/org/apache/causeway/core/runtimeservices/session/InteractionServiceDefault.java
b/core/runtimeservices/src/main/java/org/apache/causeway/core/runtimeservices/session/InteractionServiceDefault.java
index ca90c91139a..dbd88e2f468 100644
---
a/core/runtimeservices/src/main/java/org/apache/causeway/core/runtimeservices/session/InteractionServiceDefault.java
+++
b/core/runtimeservices/src/main/java/org/apache/causeway/core/runtimeservices/session/InteractionServiceDefault.java
@@ -47,6 +47,7 @@
import org.apache.causeway.applib.services.iactnlayer.InteractionService;
import org.apache.causeway.applib.services.inject.ServiceInjector;
import org.apache.causeway.commons.functional.ThrowingRunnable;
+import org.apache.causeway.commons.internal.base._Strings;
import org.apache.causeway.commons.internal.debug._Probe;
import org.apache.causeway.commons.internal.debug.xray.XrayUi;
import org.apache.causeway.commons.internal.exceptions._Exceptions;
@@ -153,6 +154,11 @@ public InteractionLayer openInteraction(final @NonNull
InteractionContext intera
: "Causeway Nested Interaction");
var newInteractionLayer = layerStack.push(causewayInteraction,
interactionContextToUse, obs);
+ obs.highCardinalityKeyValue("user.isImpersonating", "" +
interactionContextToUse.getUser().isImpersonating());
+
_Strings.nonEmpty(interactionContextToUse.getUser().multiTenancyToken())
+
.ifPresent(value->obs.highCardinalityKeyValue("user.multiTenancyToken", value));
+ _Strings.nonEmpty(interactionContextToUse.getUser().name())
+ .ifPresent(value->obs.highCardinalityKeyValue("user.name", value));
if(getInteractionLayerCount()>0) {
obs.highCardinalityKeyValue("stackedLayers",
""+getInteractionLayerCount());
}