We want to display some activities as a group in the activity feed. An example of this would be votes:
The creation of a vote should be the top-level item in the activity
Cast votes are added under this top-level item
Finally, the execution/enactment of a vote should be displayed as the last item in an activity
For this to work, we will have to correlate multiple transactions and traces to the same activity semantically. This is hard, because correlating different transactions is ultimately only possible if you know how an application works, as a possible correlation ID is application specific.
As an example, correlating multiple transactions in the voting case would be done by vote ID, which is either present in events, return values or parameters to function calls.
Proposal
We have an entity ID (like a vote ID). We can assume that this entity ID is unique for each app instance, so we can also assume that a globally unique correlation ID would be hash(appAddress + entityId).
Entity IDs can be extracted from 3 places: return values of calls (such as newVote, which returns a voteId), events (such as StartVote) or function parameters (such as castVote(voteId)).
A possible abstraction would therefore be that we decode logs, function calls and function return values for specific apps that we want to provide correlation on.
Then, we specify where to find the entity ID (e.g. in the first topic of an event log topic[0] = topicOfStartVoteEvent, or the 1st parameter of castVote).
We then store the correlation ID (the hash described above) in the activities document alongside all of the other information we have.
We want to display some activities as a group in the activity feed. An example of this would be votes:
For this to work, we will have to correlate multiple transactions and traces to the same activity semantically. This is hard, because correlating different transactions is ultimately only possible if you know how an application works, as a possible correlation ID is application specific.
As an example, correlating multiple transactions in the voting case would be done by vote ID, which is either present in events, return values or parameters to function calls.
Proposal
We have an entity ID (like a vote ID). We can assume that this entity ID is unique for each app instance, so we can also assume that a globally unique correlation ID would be
hash(appAddress + entityId)
.Entity IDs can be extracted from 3 places: return values of calls (such as
newVote
, which returns avoteId
), events (such asStartVote
) or function parameters (such ascastVote(voteId)
).A possible abstraction would therefore be that we decode logs, function calls and function return values for specific apps that we want to provide correlation on.
Then, we specify where to find the entity ID (e.g. in the first topic of an event log
topic[0] = topicOfStartVoteEvent
, or the 1st parameter ofcastVote
).We then store the correlation ID (the hash described above) in the activities document alongside all of the other information we have.