Marketing Yourself Using the 4 Ps and Cs

In some of the courses I’m teaching, as an adjunct, we spend the last week of class focused on careers. We look at jobs in the industries we’ve been studying, select a job online, and go through a…

Smartphone

独家优惠奖金 100% 高达 1 BTC + 180 免费旋转




Tracing

Adopting Elixir — by Ben Marx, José Valim, Bruce Tate (81 / 85)

👈 SASL Reports | TOC | Using Other Advanced Tools 👉

When it comes to debugging, Elixir developers have two main options: use the debugger GUI[134] that ships with Erlang or the new IEx.break![135] Elixir tools. Debuggers let you stop the execution of one or more processes and inspect their environment, but debugging is clearly not a good match for a production system. If you interrupt an important process in your application while debugging, you could start to accumulate requests, leading to timeouts or even restarts. In the end, your email inbox may begin to rapidly fill.

Because the risks of interacting with live systems and security concerns are acute, many companies simply do not give developers access to production nodes except under special circumstances. Even if you work at one of those companies, these next few useful lessons can help you debug systems in staging environments or under load tests.

To debug such systems, we need tools that are light-weight and have little to no effect in the system operations. And as one would expect from a technology that has been battle-tested for decades, the Erlang VM has some good options available. One of those options is :erlang.trace/3.[136] Tracing allows you to ask the VM to send a message to a chosen process whenever some event happens. Let’s take an example. We’ll use the API to trace all of the messages to a process:

We started an agent, asked the VM to track all messages received by that agent, and then invoked Agent.get/2. Since Agent.get/2 sends a message to the agent to retrieve its state, the tracing system sent the IEx process a message. We then call flush() to immediately deliver it. This example is just a small subset of what’s available. In fact, this much power needs structure so you won’t usually invoke those functions directly.

Instead, you’ll use modules and libraries with more accessible APIs. One such tool is the marvelously inappropriately named :dbg module[137] that ships with Erlang/OTP as part of the…

Add a comment

Related posts:

self.deprecate

Learning that Ruby is a self.aware programming language has been one of the highlights of my experience with the Flatiron curriculum. Not only does this concept provide for a nice, deep dive into…

Refactor Every Time You Touch Code or Tests

You think agile techniques might be for you, but your projects and organization are unique. An "out-of-the-box" agile approach won't work. Instead, unite agile and lean principles for your project. See how to design a custom approach, reap the benefits of collaboration, and deliver value. For project managers who want to use agi

Getting a driving licence in London!

Getting a driving licence in London!, a Medium series by Nicusor Vatafu