Adopting Elixir

B
THANK YOU
@BGMARX
ADOPTING
ELIXIR
BEN MARX
@bgmarx
ARCHITECT
TEMPER
EXPECTATIONS
START
SMALL
BUILDING
A TEAM
CONSISTENT
CODE
MONITORING
NON-ZERO
GAME
TEMPER
EXPECTATIONS
HONEST
CONVERSATION
REGULAR
UPDATES
START
SMALL
IMMEDIATE
NEED
SERVICE-
BASED
TERRAFORM
https://github.com/poteto/terraform
DIVERT
TRAFFIC
def call(conn, _options) do
ghost? = Application.get_env(:faust, :ghost)[:enabled]
ghost_traffic(conn, conn.method, ghost?)
conn
end
def ghost_traffic(conn, "GET", "true") do
host = Application.get_env(:my_app, :ghost)[:host]
url = Enum.join([host, conn.request_path])
Task.start(fn -> HTTPoison.get(url) end)
end
def ghost_traffic(_, _, _), do: nil
BUILDING
A TEAM
WHO’S
INTERESTED?
VARYING
INTEREST
EXCITED
CURIOUS
AMBIVALENT
OPPOSED
EXPECT
RESISTANCE
SET UP FOR
SUCCESS
CONSISTENT
CODE
CODIFY
STANDARDS
CREDO
https://github.com/rrrene/credo
DOCUMENT
CODE
https://github.com/elixir-lang/ex_doc
@doc “””
Attempts to fetch and extract embed data for a url
and format it according to the defined content type
“””
@spec fetch_and_extract_embed(String.t) :: embed
def fetch_and_extract_embed(url) do
url
|> get_embed_data
|> format_by_content_type
end
DIALYZER
http://erlang.org/doc/man/dialyzer.html
(FROM THE
BEGINNING)
@type embed :: map()
@spec fetch_and_extract_embed(String.t) :: embed
def fetch_and_extract_embed(url) do
url
|> parse_response
|> format_by_content_type
end
USE THE
FORMATTER
.formatter.exs
[
inputs: ["mix.exs", "{config,lib,test}/**/*.
{ex,exs}"]
]
https://hexdocs.pm/mix/master/Mix.Tasks.Format.html
CODE
REVIEWS
CONTINUOUS
INTEGRATION
…snip…
- run: mix coveralls.json
- run: mix credo --strict
- run: mix format --check-formatted
- run: { shell: '/bin/bash', command: 'bash <(curl -s
https://codecov.io/bash)' }
MONITORING
CODIFY
METRICS
response run queue
query time atoms
memory latency
EXOMETER
https://github.com/Feuerlabs/exometer
STATIX
https://github.com/lexmag/statix
Wombat AppSignal
Scout Datadog
New Relic Bugsnag
TEST
LIMITS
defp multiply_traffic(multiplier, url) do
multiplier = String.to_integer(multiplier)
range = 1..multiplier
Enum.each(range, fn _elem ->
Task.start(fn ->
request_headers = %{"x-request-id" => Logger.metadata()[:request_id]}
hackney_options = [recv_timeout: 5_000, timeout: 1_000, pool: false]
HTTPoison.get(url, request_headers, hackney: hackney_options)
end)
end)
end
NON-ZERO
GAME
IDEAL
SITUATION
LIBRARY
SUPPORT
Adopting Elixir
IMPERFECT
TARGETED
REFACTORING
“BUT LET US
CULTIVATE OUR
GARDEN”
Candide,Voltaire
HAVE
FUN
Adopting Elixir
QUESTIONS?
@bgmarx
1 of 54

More Related Content

What's hot(9)

Adopting Elixir