Skip to content

Instantly share code, notes, and snippets.

View yatender-oktalk's full-sized avatar
✌️
Focusing

Yatender Singh yatender-oktalk

✌️
Focusing
View GitHub Profile
@yatender-oktalk
yatender-oktalk / alpha---application.ex
Created July 13, 2020 05:32
open-telemetry-demo---apps---application.ex
defmodule Alpha.Application do
...
def start(_type, _start) do
_ = OpenTelemetry.register_application_tracer(:alpha)
children = [
# Starts a worker by calling: Alpha.Worker.start_link(arg)
# {Alpha.Worker, arg}
]
@yatender-oktalk
yatender-oktalk / main-alpha.ex
Created July 13, 2020 06:38
open_telemetry_demo_umbrellla RPC
defmodule Alpha do
@moduledoc """
Documentation for `Alpha`.
"""
require OpenTelemetry.Tracer
def start_call() do
OpenTelemetry.Tracer.with_span "alpha-span" do
delay = 100
defmodule ExChain.BlockChain.Block do
@moduledoc """
This module is the single block struct in a blockchain
"""
defstruct ~w(timestamp last_hash hash data)a
end
defmodule ExChain.BlockChain.Block do
@moduledoc """
This module is the single block struct in a blockchain
"""
alias __MODULE__
@type t :: %Block{
timestamp: pos_integer(),
last_hash: String.t(),
hash: String.t(),
defmodule ExChain.Blockchain.BlockTest do
@moduledoc """
This module contains test related to a block
"""
use ExUnit.Case
alias ExChain.BlockChain.Block
describe "block" do
test "genesis is valid" do
defmodule ExChain.BlockChain.Block do
@moduledoc """
This module is the single block struct in a blockchain
"""
alias __MODULE__
@type t :: %Block{
timestamp: pos_integer(),
last_hash: String.t(),
defmodule ExChain.BlockChain.Block do
@moduledoc """
This module is the single block struct in a blockchain
"""
alias __MODULE__
@type t :: %Block{
timestamp: pos_integer(),
last_hash: String.t(),
defmodule ExChain.Blockchain.BlockTest do
@moduledoc """
This module contains test related to a block
"""
use ExUnit.Case
alias ExChain.Blockchain.Block
describe "block" do
test "genesis is valid" do
defmodule ExChain.BlockchainTest do
@moduledoc """
This module contains test related to a blockchain
"""
use ExUnit.Case
alias ExChain.Blockchain
alias ExChain.Blockchain.Block
defmodule ExChain.Blockchain do
@moduledoc """
This module contains the blockchain related functions
"""
alias __MODULE__
alias ExChain.Blockchain.Block
defstruct ~w(chain)a
@type t :: %Blockchain{