Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Break down incoming events to publish separately #1472

Merged
merged 6 commits into from
Apr 21, 2020

Conversation

souradeep-das
Copy link
Contributor

📋 Partly #1426

Overview

This enables to break down and send separate events to Datadog, when events consumed from Ethereum event listeners come in bulk

Changes

  • Update OMG.Watcher.DatadogEvent.ContractEventConsumer and the Childchain sibling to iterate and send received events individually
  • Update tests to check breaking into separate events

Testing

mix test test/omg_watcher/datadog_event/contract_event_consumer_test.exs
mix test test/omg_child_chain/datadog_event/contract_event_consumer_test.exs

@coveralls
Copy link

coveralls commented Apr 17, 2020

Coverage Status

Coverage decreased (-0.03%) to 77.885% when pulling d1bae27 on souradeep/breakevents into e209c46 on master.

topic_name = self() |> :erlang.pid_to_list() |> to_string()
sig = "#{topic_name}(bytes32)"
data = [%{event_signature: sig}, %{event_signature: sig}]
{:root_chain, topic_name} |> OMG.Bus.Event.new(:data, data) |> OMG.Bus.direct_local_broadcast()

assert_receive {:event, _, _}
Enum.each(data, fn _ ->
assert_receive {:event, _, _}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Now that it expect 2 events, should we check that they're indeed the two events, and not one event reported twice?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Absolutely, i'm taking the message into equation then

Copy link
Contributor

@pnowosie pnowosie left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@souradeep-das souradeep-das merged commit cab7c69 into master Apr 21, 2020
@souradeep-das souradeep-das deleted the souradeep/breakevents branch April 21, 2020 16:42
@unnawut unnawut added the enhancement New feature or request label Aug 28, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants