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

Add telemetry for embedded database #327

Closed
4 tasks done
ghost opened this issue May 18, 2022 · 2 comments
Closed
4 tasks done

Add telemetry for embedded database #327

ghost opened this issue May 18, 2022 · 2 comments
Assignees
Labels
core team Assigned to the core team DB Involve database feature New feature request

Comments

@ghost
Copy link

ghost commented May 18, 2022

Problem to solve

We want to have a better monitoring of the database, to detect bottlenecks or area of improvements

Solution

We have to leverage telemetry for:

  • Write transaction
  • Read transaction
  • Read transaction chain
  • Indexing
@ghost ghost added the DB Involve database label May 18, 2022
@apoorv-2204
Copy link
Contributor

apoorv-2204 commented May 19, 2022

hello Team,
I think , we might have to add this only ,maybe.
It might also cause regression in Metrics.Poller.
Whaty'all think?

 start =System.monotonic_time()
:telemetry.execute([:archethic, :db], %{duration: System.monotonic_time() - start}, %{
        query: "write_transaction_chain"
      })
@spec write_transaction_chain(list(Transaction.t())) :: :ok
  def write_transaction_chain(chain) do
    start =System.monotonic_time()

    sorted_chain = Enum.sort_by(chain, & &1.validation_stamp.timestamp, {:asc, DateTime})

    first_tx = List.first(sorted_chain)
    genesis_address = Transaction.previous_address(first_tx)

    Enum.each(sorted_chain, fn tx ->
      unless ChainIndex.transaction_exists?(tx.address, db_path()) do
        ChainWriter.append_transaction(genesis_address, tx)
      end
    end)
:telemetry.execute([:archethic, :db], %{duration: System.monotonic_time() - start}, %{
        query: "write_transaction_chain"
      })
  end

@ghost ghost added feature New feature request DB Involve database core team Assigned to the core team and removed DB Involve database labels May 19, 2022
@AmodD
Copy link

AmodD commented May 20, 2022

Hey team! Please add your planning poker estimate with ZenHub @apoorv-2204 @blackode @Neylix @samuel-uniris @nilesh-uniris

This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
core team Assigned to the core team DB Involve database feature New feature request
Projects
None yet
Development

No branches or pull requests

2 participants