dd-sdk-android icon indicating copy to clipboard operation
dd-sdk-android copied to clipboard

Unable to log custom actions

Open cmtanko opened this issue 1 year ago • 1 comments

Describe the bug

    @Kroll.method
    public void startAction(String actionName, KrollDict actionAttributes) {
        // Convert KrollDict to HashMap
        HashMap<String, Object> attributes = (HashMap<String, Object>) actionAttributes;
    
        GlobalRumMonitor.get().addAction(RumActionType.TAP, actionName, attributes);
    }

So, I have this addAction to record tap event , but on using I am getting this error and my tap event is not logged. Any thoughts ?

[WARN] Datadog: [_dd.sdk_core.default]: RUM Action (TAP on ) was dropped, because another action is still active for the same view [WARN] Datadog: [_dd.sdk_core.default]: RUM Action (TAP on myAction) was dropped, because another action is still active for the same view

Reproduction steps

    @Kroll.method
    public void startAction(String actionName, KrollDict actionAttributes) {
        // Convert KrollDict to HashMap
        HashMap<String, Object> attributes = (HashMap<String, Object>) actionAttributes;
    
        GlobalRumMonitor.get().addAction(RumActionType.TAP, actionName, attributes);
    }
	```
var actionType = 'TAP';
		var actionName = 'myAction';
		var actionAttributes = {
			attribute1: 'value1',
			attribute2: 'value2'
		};

		Datadog.startAction(actionName, actionAttributes);

### Logcat logs

[WARN]  Datadog: [_dd.sdk_core.default]: RUM Action (TAP on ) was dropped, because another action is still active for the same view
[WARN]  Datadog: [_dd.sdk_core.default]: RUM Action (TAP on myAction) was dropped, because another action is still active for the same view

### Expected behavior

Its expected to log MyAction action on the tap 

### Affected SDK versions

2.7.1

### Latest working SDK version

2.8.0

### Did you confirm if the latest SDK version fixes the bug?

Yes

### Kotlin / Java version

_No response_

### Gradle / AGP version

_No response_

### Other dependencies versions

_No response_

### Device Information

_No response_

### Other relevant information

_No response_

cmtanko avatar Apr 14 '24 05:04 cmtanko

Hi @cmtanko, thanks for opening this ticket.

This behaviour is working on purpose, any non custom action stays alive for a short while to be linked with the following errors or resources.

Sending a custom action can be done at any time, by using the type RumActionType.CUSTOM instead of RumActionType.TAP, e.g.:

GlobalRumMonitor.get().addAction(RumActionType.CUSTOM, actionName, attributes);

xgouchet avatar Apr 15 '24 07:04 xgouchet

Hello @cmtanko! I hope that your question was answered and I'm closing this issue. Please feel free to re-open it if needed.

0xnm avatar Sep 17 '24 08:09 0xnm