Today we are going to integrate prom_ex for Prometheus instrumentation.

Create a new Phoenix project

Let’s create a new phoenix project.

mix tracker

Configure and add library

then just add the following dependency in mix.exs .

defp deps do[
{:prom_ex, "~> 1.0.1"}

Then run the following command

mix prom_ex.gen.config --datasource Prometheus

Here data source should be the name of the Prometheus name configured in the Grafana data source.

The command generates required files, now we have to just add some lines into our code and we’ll be done.

Add the following line into endpoint.ex having TrackerWeb.Endpoint module.

Today we are going to discuss a very important topic when we come to discuss microservices architecture, i.e. Distributed tracing across the system when we have so many small applications running and each application has one or many microservices. In this kind of architecture, there are applications talking to each other and passing data around.

So today’s agenda would be to

  • Setup an application and check the traces via Zipkin.
  • Set up multiple microservices.
  • Set up communication between them.
  • Show the traces of the applications in the UI.
  • Set up Zipkin and configure elastic search as the backend to persist…

In this part, we are going to move further from our previous post and build our own blockchain and now we are going to validate our chain if it is valid and whatever we are doing is right & we are going into the right path.

So there are two very basic fundamental properties of blocks in a chain, i.e. next block should have the hash of the previous block and the current hash should be valid and not contains any tempered data. …

So we are building a blockchain in Elixir, in case you have jumped here directly please make sure you have read the part-1.

I did some refactoring before we proceed to write code for the modules to make a bit cleaner. So you can make changes accordingly.

part-1 we created a block now let’s focus on connecting those block into a chain so let’s create a new file lib/blockchain.ex and test/blockchain_test.exs

Let’s write the test for blockchain_test.exs then we will write code to make our test cases pass, in our tests, we will test 2 functionalities first block should…

Blockchain is a technology that allows data to be stored and exchanged on a peer-to-peer (P2P) basis. Structurally, blockchain data can be consulted, shared, and secured thanks to consensus-based algorithms. It is used in a decentralized manner and removes the need for intermediaries, or “trusted third parties”

In simple words, Blockchain is a database. What is a database? A database is an organized collection of data. Or, you can say, a data structure that stores the data. Therefore, Blockchain is just a data structure that stores the data. As the name hinted, there will be a chain of blocks.

coding guy

I write code

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store