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


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="cmkarlsson" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/cmkarlsson/120/23000_2.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  cmkarlsson
                  </h3>
		          </div>
						
						</div>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<aside class="quote no-group" data-username="chrisstpierre" data-post="11" data-topic="12376">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/chrisstpierre/48/14387_2.png" class="avatar"> chrisstpierre:</div>
<blockquote>
<p>It seems that the issue here is that the process management built into the packages makes it hard to see what is really going on with the process, and therefore using :timer is not timing what you think it is.</p>
</blockquote>
</aside>
<p>Correct</p>
<aside class="quote no-group" data-username="chrisstpierre" data-post="11" data-topic="12376">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/chrisstpierre/48/14387_2.png" class="avatar"> chrisstpierre:</div>
<blockquote>
<p>, or is Erlang required for http calls?</p>
</blockquote>
</aside>
<p>Well, the tcp stack is implemented in erlang so you need it. I don’t there are any HTTP clients implemented in elixir yet though but all go through erlang ones.</p>
<aside class="quote no-group" data-username="chrisstpierre" data-post="11" data-topic="12376">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/chrisstpierre/48/14387_2.png" class="avatar"> chrisstpierre:</div>
<blockquote>
<p>I think it would be really great if somebody with experience with this could explain whats the idiomatic way to handle this problem.</p>
</blockquote>
</aside>
<p>The key is to do the measurement on the actual TCP request, not the HTTP client abstraction. As I mentioned before Hackney (erlang HTTP client) has metric doing this measurement. This is not to say that there are functionality further below that skews the metric but I think that is the best we can get for now. The tcp uses async model too.</p>
<aside class="quote no-group" data-username="chrisstpierre" data-post="11" data-topic="12376">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/chrisstpierre/48/14387_2.png" class="avatar"> chrisstpierre:</div>
<blockquote>
<p>e elixir async model is making it hard to measure the actual http… and it seems that making http requests maybe should be part of the standard library.</p>
</blockquote>
</aside>
<p>Erlang has got an HTTP client in the standard “distribution”. It also has got HTTP packet parsers in the tcp handling which is part of the standard library.</p>
<p>If you mean the elixir standard library I can’t see it being any different than a separate OTP application distributed with elixir rather than being built-in to the standard library (which doesn’t make sense to me)</p>
<p>As a final alternative, I know that the OTP team is working on improving tracing. Perhaps it is now possible to actually do metrics through erlang tracing without too much overhead. This means you can measure anything, even 3rd party software.</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="69894" 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/how-can-i-get-the-response-time-of-a-http-request-in-elixir/12376/12">Post #11</a>
	                </div>
	            </div>
              <div id="likers-container-69894" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="69894"
                     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>