Closed ghost closed 2 years ago
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
Hey team! Please add your planning poker estimate with ZenHub @apoorv-2204 @blackode @Neylix @samuel-uniris @nilesh-uniris
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: