amplitude / amplitude/Amplitude-Android

Events logged in close succession sometimes get logged in the wrong order.

Abierto
#152 8 comentarios 1 reacción 0 asignados Ver en GitHub
Lenguaje dominante
Java
Estrellas
169
Forks
87
Métricas de merge de PR
Sin PR fusionados en 30 d

Descripción

### Setup
Android, `implementation 'com.amplitude:android-sdk:2.15.0'` in `build.gradle`
Two activities:`FirstActivity` and `SecondActivity`.
`FirstActivity` has a button that opens `SecondActivity`

Thee events:
* `FirstActivity opened` logged in `FirstActivity.onCreate()`
* `FirstActivity button pressed` logged in `OnClickListener.OnClick()` that is set to the button in `FirstActivity`
* `SecondActivity opened` logged in `SecondActivity.onCreate()`

### What is wrong
On https://analytics.amplitude.com `SecondActivity opened` sometimes appears before `FirstActivity button pressed`.
Example:
screen shot 2017-11-02 at 09 31 38
This complicates funnel analysis on funnels that depend on the order of events.

Setting `enableLogging(true).setLogLevel(Log.VERBOSE)` shows these events being logged in correct order
```
11-02 02:51:31.253 5722-5741/com.makaroffandrey.amplitudetest D/com.amplitude.api.AmplitudeClient: Logged event to Amplitude: FirstActivity opened
11-02 02:51:35.477 5722-5741/com.makaroffandrey.amplitudetest D/com.amplitude.api.AmplitudeClient: Logged event to Amplitude: FirstActivity button pressed
11-02 02:51:35.541 5722-5741/com.makaroffandrey.amplitudetest D/com.amplitude.api.AmplitudeClient: Logged event to Amplitude: SecondActivity opened
```
On the website these events have
`"client_event_time"` and `"event_id"` values indicate correct order.
`"_time"` and `"event_time"` values indicate incorrect order.

Increasing the time between events by logging in `onResume()` instead of `onCreate()` does not help.

I will publish an [MCVE](https://stackoverflow.com/help/mcve) shortly.

### Edit
MCVE is [here](https://github.com/makaroffandrey/Amplitude_issue_152_MCVE)

Guía de contribución

No hay ninguna guía de contribución indexada para este repositorio

Evaluación

Este issue todavía no se ha evaluado.

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.