<turbo-stream action="append" target="posts_list"><template>    <div class="postbit" id="309791" data-post-id="309791">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="christhekeele" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/christhekeele/120/1039_2.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  christhekeele
                    <span class="op-star" title="Thread Starter">
                      <img alt="OP" class="op-star-icon" src="/assets/thread-icons/thread-icon-thread-starter-df91e872.png" />
                    </span>
                  </h3>
		          </div>
						
						</div>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<h1><a name="p-309791-devlogmd-2023-12-03-1" class="anchor" href="#p-309791-devlogmd-2023-12-03-1" aria-label="Heading link" rel="nofollow"></a>DEVLOG.md 2023-12-03</h1>
<p>Wanted to post an update on the final feature I’m letting cook before I’m ready to release Matcha v0.2.0: a custom tracing engine!</p>
<hr>
<p>On the <code>latest</code> branch, I’ve completely removed the <code>:recon</code> dependency, in favor of bespoke implementation of tracing function calls. This is not done lightly! <code>:recon</code> is a battle-tested project and I’ve benefited from it a lot, including by using it for <code>Matcha</code> up til now.</p>
<p>However, <code>Matcha</code> has a few goals incompatible with it.</p>
<h2><a name="p-309791-recon-tracing-2" class="anchor" href="#p-309791-recon-tracing-2" aria-label="Heading link" rel="nofollow"></a>Recon Tracing</h2>
<blockquote>
<p><a href="https://ferd.github.io/recon/recon.html" rel="noopener nofollow ugc">Recon is a library to be dropped into any other Erlang project, to be used to assist DevOps people diagnose problems in production nodes.</a></p>
</blockquote>
<p>Recon’s goal is to be diagnostic tool, and offers tracing functionality to that end. However,</p>
<ul>
<li><code>:recon_trace</code> does not support process send/receive tracing
<ul>
<li>only function call tracing</li>
</ul>
</li>
<li><code>:recon_trace</code> does not support unlimited tracing
<ul>
<li>every trace must have a hard limit or rate limit</li>
</ul>
</li>
<li><code>:recon_trace</code> does not support reacting to trace messages with arbitrary code
<ul>
<li>only sending a formatted string to an io device</li>
</ul>
</li>
<li><code>:recon_trace</code> does not support customization of the supervision tree it uses</li>
</ul>
<p>Some of these limitations are circumventable if you write your own matchspecs, but are intentionally inaccessible.</p>
<p>Note that these are all smart design decisions for its goals, not limitations! <code>:recon</code> provides several production diagnostic tools, and <code>:recon_trace</code> is but one of them. As a tool used to analyze critical issues in live production systems, however—it must be completely safe to use in all circumstances, and by necessity limit some of the power of <code>:erlang</code>’s tracing.</p>
<h2><a name="p-309791-matcha-tracing-3" class="anchor" href="#p-309791-matcha-tracing-3" aria-label="Heading link" rel="nofollow"></a>Matcha Tracing</h2>
<p>Matcha’s goal has always been to make the power of difficult-to-use erlang features involving match specifications more accessible to Elixir developers.</p>
<p>Originally, this was focused on <em>composing</em> them, but over time, my ambition has come to envelope tracing as well. Match specifications are only a small part of tracing, just as they are a small part of <code>:ets</code>. However, outside of match specifications, <code>:ets</code> is pretty approachable. This is not true of tracing in general.</p>
<p>As such, I have been working on giving <code>Matcha.Trace</code> these abilities that <code>:recon_trace</code> lacks, with more feature parity with all of Erlang’s tracing capabilities. My goals are to offer:</p>
<ul>
<li>high-level APIs for tracing calls that mirror the safety guarantees of <code>:recon_trace</code> by default</li>
<li>high-level APIs for tracing sends and receives with similar guarantees</li>
<li>non-default options to selectively do less “safe” things with them</li>
<li>tools to react to trace messages with arbitrary code, rather than just printing information</li>
<li>tools to mount the tracing engine into your running application as a first-class component, rather than just a diagnostic sidecar</li>
</ul>
<p>The implementation in the <code>latest</code> branch does not preserve <code>:recon_trace.calls</code>’s safety features, but it sets the stage for doing so while still allowing for overriding them. It provides an abstraction around tracing calls in particular, so that receive and send can be easily added to it. It is also implemented with a modular supervision tree—when the documentation catches up, it will describe their usage such that you can integrate tracing within your own application’s supervision tree to accomplish whatever your heart desires.</p>
<p>Ultimately, this should lead me to a system that is as safe as <code>:recon</code> by default, but empowers developers with even more cool capabilities!</p>
<h2><a name="p-309791-deprecations-4" class="anchor" href="#p-309791-deprecations-4" aria-label="Heading link" rel="nofollow"></a>Deprecations</h2>
<p>While I’m eyeing a minor <code>&lt; 1.0.0</code> version bump, I thought I’d mention some planned deprecations that will come in <code>0.2.0</code>:</p>
<ul>
<li>Elixirs <code>&lt; 1.14.0</code> will not be supported
<ul>
<li>the new <code>Matcha.Trace</code> supervision trees use <a href="https://hexdocs.pm/elixir/PartitionSupervisor.html" rel="noopener nofollow ugc"><code>PartitionSupervisor</code></a> which is fairly new</li>
<li>supporting all the ways back to elixir <code>1.11.0</code> has caused some friction in how we interact with the Eilxir compiler I am eager to eliminate, <code>1.14.0</code> is a good fresh slate</li>
</ul>
</li>
<li>As such, <a href="https://hexdocs.pm/elixir/compatibility-and-deprecations.html" rel="noopener nofollow ugc">per the compatability docs</a> Erlang/OTP <code>&lt; 23.0</code> support will be dropped
<ul>
<li>this enables the Matcha compiler to do less special-casing around match spec features introduced in <code>23.0</code> and up, too</li>
</ul>
</li>
<li><code>Matcha.{Pattern, Spec}.source/1</code> is now <code>raw/1</code>
<ul>
<li>a “raw” spec is a much better term for this concept</li>
<li>on <code>latest</code>, the underlying struct field is still called <code>:source</code> but this may change at any time</li>
</ul>
</li>
</ul>
<hr>
<p>As always, thanks for reading! <img src="https://forum.elixirforum.com/images/emoji/apple/tea.png?v=15" title=":tea:" class="emoji" alt=":tea:" loading="lazy" width="20" height="20"></p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="309791" data-batch-url="/posts/batch_likers">
                        2
                      </span>
                      <!-- <span class="thread-count js-solved-indicator" title="Marked as solution"></span> -->
	                </div>
	                <div class="go-to-post">
	                  <a title="Go to post" alt="Go to post" href="https://forum.elixirforum.com/t/matcha-first-class-match-specifications-for-elixir/52182/32">Post #31</a>
	                </div>
	            </div>
              <div id="likers-container-309791" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="309791"
                     data-batch-url="/posts/batch_likers">
                  <div class="post-likers"></div>
                </div>
              </div>
	        </div>
			

    </div>

    <div class="triangle-top-right type-last-post cat-last-post" title="Last post!"></div>
  </section>
</div>
</template></turbo-stream><turbo-stream action="replace" target="load-more-container"><template><div id="load-more-container" class="load-more-container">
    <span class="all-loaded">— All posts loaded —</span>
</div></template></turbo-stream>