<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Garrett Hamelin</title>
    <description>The latest articles on DEV Community by Garrett Hamelin (@ghamelin).</description>
    <link>https://dev.to/ghamelin</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F1045236%2Fed6cdfef-5c3f-4fdc-aff4-e5b40aadaf05.jpeg</url>
      <title>DEV Community: Garrett Hamelin</title>
      <link>https://dev.to/ghamelin</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/ghamelin"/>
    <language>en</language>
    <item>
      <title>Improve application performance: How to find and fix slow function calls, HTTP requests, and SQL queries</title>
      <dc:creator>Garrett Hamelin</dc:creator>
      <pubDate>Fri, 21 Jul 2023 16:53:43 +0000</pubDate>
      <link>https://dev.to/appmap/improve-application-performance-how-to-find-and-fix-slow-function-calls-http-requests-and-sql-queries-1pf9</link>
      <guid>https://dev.to/appmap/improve-application-performance-how-to-find-and-fix-slow-function-calls-http-requests-and-sql-queries-1pf9</guid>
      <description>&lt;p&gt;Runtime analysis is the latest and greatest way for developers to find, flag, and fix software flaws before production. Our series on rules and their impact is focused in this article on Slow Function Calls, HTTP Requests, and SQL Queries.&lt;/p&gt;

&lt;p&gt;I will review what these rules mean and how to enhance your application performance using AppMap. &lt;/p&gt;

&lt;p&gt;If you learn better through video you can check out a walkthrough of these rules here: &lt;/p&gt;

&lt;p&gt;&lt;iframe width="710" height="399" src="https://www.youtube.com/embed/8OdZZfWWU98"&gt;
&lt;/iframe&gt;
&lt;/p&gt;

&lt;h2&gt;
  
  
  Slow function calls
&lt;/h2&gt;

&lt;p&gt;In this first example, let’s use AppMap to locate a performance finding related to slow function calls and use the new flame graph view to see the duration of each function call. It's crucial to optimize those long-running functions, as they can significantly impact performance. Often slow function calls are caused by poor code practices, inadequate algorithms, or excessive resource consumption, leading to scalability issues, bottlenecks in system responsiveness, and even user frustration&lt;/p&gt;

&lt;p&gt;To illustrate this, let's examine code snippets related to slow renders and highlight the usage of partials. Repeated rendering of partials within loops can significantly impact performance.&lt;/p&gt;

&lt;p&gt;For some context, the example we are dissecting today is an e-commerce merch store. To make sure we are all on the same page, the AppMap we are looking at outlines the user interaction of a user selecting featured products to view. The function in question &lt;code&gt;ActionController::Renderers#render_to_body&lt;/code&gt; can be plainly seen in the flame graph.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F3s0jrb2quwbsub1n3j3h.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F3s0jrb2quwbsub1n3j3h.png" alt="Flame Graph"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;When we dig a little deeper and see what is actually happening.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fiuzzm9lz7clcj4o4742m.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fiuzzm9lz7clcj4o4742m.png" alt="Render function"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;We can see that &lt;code&gt;Render_to_body&lt;/code&gt; calls &lt;code&gt;render_to_body_with_renderer&lt;/code&gt; which gets passed a series of options. Looking into the function itself we see the &lt;code&gt;_renderers.each do ...&lt;/code&gt;which, when passed a file with a lot of partials that need to be rendered, some containing caching operations themselves, we start to understand exactly why this function runs for such a long time. &lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fcsojgpjr19temkgno02a.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fcsojgpjr19temkgno02a.png" alt="Partials being rendered"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Looking at the trace view, we can see just how many children are spawned and will complete before we can return from the original calling function. &lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Flqgz0093055v2o4f55nl.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Flqgz0093055v2o4f55nl.png" alt="stack trace"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;To mitigate this we may want to reduce the number of partials that we are individually working with. Good coding practices encourage abstraction and code reuse but doing so may have introduced a performance concern. We need to be careful that we don’t abstract which can impact the performance of our application at runtime. &lt;/p&gt;

&lt;h2&gt;
  
  
  Slow HTTP requests and SQL queries
&lt;/h2&gt;

&lt;p&gt;Slow HTTP requests and SQL queries often stem from a range of situations, ranging from suboptimal coding practices, inefficient schemas and configuration, or lack of indexing to lack of resources available, and high network congestion. We need to be aware of potential causes, such as the lack of caching HTTP requests or leveraging a content delivery network (CDN) for faster content delivery. &lt;/p&gt;

&lt;h2&gt;
  
  
  Find and fix performance issues
&lt;/h2&gt;

&lt;p&gt;To address slow function calls, HTTP requests, and SQL queries, we can implement effective mitigation strategies by updating our coding practices and improving resource management. For slow renders, alternative home or index views can be used to minimize the number of function calls. Additionally, you can leverage caching techniques and pre-render pages that don't require dynamic data, as well as load-balancing techniques to reduce the pressure on our network. &lt;/p&gt;

&lt;h2&gt;
  
  
  In summary
&lt;/h2&gt;

&lt;p&gt;To improve application performance, it’s important to identify and optimize slow function calls, HTTP requests, and SQL queries.&lt;/p&gt;

&lt;p&gt;AppMap’s flame graphs and other tools like the &lt;a href="https://dev.to/appmap/quickly-learn-how-new-to-you-code-works-using-sequence-diagrams-h9g"&gt;interactive sequence diagram&lt;/a&gt; make it easy to pinpoint performance bottlenecks and implement appropriate mitigation strategies. &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Links&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;⬇️ Download AppMap for VSCode and JetBrains: &lt;a href="https://appmap.io/download" rel="noopener noreferrer"&gt;https://appmap.io/download&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;⭐ Star AppMap on GitHub: &lt;a href="https://github.com/getappmap" rel="noopener noreferrer"&gt;https://github.com/getappmap&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;🐦 Follow on Twitter: &lt;a href="https://twitter.com/getappmap" rel="noopener noreferrer"&gt;https://twitter.com/getappmap&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;💬 Join AppMap Slack: &lt;a href="https://appmap.io/slack" rel="noopener noreferrer"&gt;https://appmap.io/slack&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;ℹ️ Read the AppMap docs: &lt;a href="https://appmap.io/docs" rel="noopener noreferrer"&gt;https://appmap.io/docs&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;📺 Watch AppMap Tutorials: &lt;a href="https://www.youtube.com/@appmap" rel="noopener noreferrer"&gt;https://www.youtube.com/@appmap&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;📸 Cover Photo by &lt;a href="https://unsplash.com/@rwlinder?utm_source=unsplash&amp;amp;utm_medium=referral&amp;amp;utm_content=creditCopyText" rel="noopener noreferrer"&gt;Robert Linder&lt;/a&gt; on &lt;a href="https://unsplash.com/s/photos/road-work?utm_source=unsplash&amp;amp;utm_medium=referral&amp;amp;utm_content=creditCopyText" rel="noopener noreferrer"&gt;Unsplash&lt;/a&gt;&lt;/p&gt;

&lt;p&gt; &lt;/p&gt;

&lt;p&gt; &lt;/p&gt;


&lt;div class="ltag__user ltag__user__id__1045236"&gt;
    &lt;a href="/ghamelin" class="ltag__user__link profile-image-link"&gt;
      &lt;div class="ltag__user__pic"&gt;
        &lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F1045236%2Fed6cdfef-5c3f-4fdc-aff4-e5b40aadaf05.jpeg" alt="ghamelin image"&gt;
      &lt;/div&gt;
    &lt;/a&gt;
  &lt;div class="ltag__user__content"&gt;
    &lt;h2&gt;
&lt;a class="ltag__user__link" href="/ghamelin"&gt;Garrett Hamelin&lt;/a&gt;Follow
&lt;/h2&gt;
    &lt;div class="ltag__user__summary"&gt;
      &lt;a class="ltag__user__link" href="/ghamelin"&gt;I love technology and everything about it. I'm a software engineer who enjoys helping others succeed and building communities of like minded people. &lt;/a&gt;
    &lt;/div&gt;
  &lt;/div&gt;
&lt;/div&gt;


</description>
      <category>performance</category>
      <category>vscode</category>
      <category>java</category>
      <category>ruby</category>
    </item>
    <item>
      <title>Introducing Flame graphs: It’s getting hot in here</title>
      <dc:creator>Garrett Hamelin</dc:creator>
      <pubDate>Fri, 14 Jul 2023 18:47:50 +0000</pubDate>
      <link>https://dev.to/appmap/introducing-flame-graphs-its-getting-hot-in-here-1j9l</link>
      <guid>https://dev.to/appmap/introducing-flame-graphs-its-getting-hot-in-here-1j9l</guid>
      <description>&lt;p&gt;Flame graphs help developers identify code bottlenecks and understand code execution patterns, so we’re excited to announce they are now available within the AppMap extension for VS Code and JetBrains editors like IntelliJ. &lt;/p&gt;

&lt;p&gt;“&lt;a href="https://www.brendangregg.com/flamegraphs.html" rel="noopener noreferrer"&gt;Flame graphs&lt;/a&gt; are a visualization of hierarchical data, created to visualize stack traces of profiled software so that the most frequent code-paths to be identified quickly and accurately.”&lt;/p&gt;

&lt;p&gt;In this article, I explore how they work, and how to generate and use them with AppMap.&lt;/p&gt;

&lt;h3&gt;
  
  
  How to read a flame graph
&lt;/h3&gt;

&lt;p&gt;Flame graphs are read from bottom to top, left to right, providing a holistic view of function execution. In this video, you can see how I identify time-consuming functions and visualize the sequence of operations.&lt;/p&gt;

&lt;p&gt;&lt;iframe width="710" height="399" src="https://www.youtube.com/embed/4Ekc0Eal0sM"&gt;
&lt;/iframe&gt;
&lt;/p&gt;

&lt;p&gt;To make sense of the flame graphs, we must first understand the color scheme. &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Purple represents &lt;code&gt;SQL queries&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;Blue indicates &lt;code&gt;classes&lt;/code&gt;, &lt;code&gt;methods&lt;/code&gt;, or &lt;code&gt;functions&lt;/code&gt; that follow in the execution flow&lt;/li&gt;
&lt;li&gt;Yellow denotes &lt;code&gt;external service calls&lt;/code&gt; (absent in this video)&lt;/li&gt;
&lt;li&gt;Teal is the name of the AppMap&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  What you get with flame graphs
&lt;/h3&gt;

&lt;p&gt;Flame Graphs reveal crucial insights about application performance. Each function in the graph is labeled with its corresponding execution time in milliseconds or microseconds. This detailed breakdown allows developers to pinpoint long-running queries and functions, optimizing code efficiency.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Frmm36w2989yk8slhw7fj.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Frmm36w2989yk8slhw7fj.png" alt="Flame Graph"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Zooming in on the graph or selecting a specific function provides a deeper understanding of the call stack and execution sequence. For example, the demonstration showcased the occurrence of a selector before an active support call, shedding light on the execution flow. This level of granularity empowers developers to tackle complex performance issues head-on.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Revealing performance issues&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;By examining the graph, developers can detect common issues like N+1 queries, a notorious problem in application development. The ability to visualize the duration of each query or function provides actionable insights, highlighting areas for improvement.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fz80o865m9k1tm6ozr0o3.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fz80o865m9k1tm6ozr0o3.png" alt="Flame Graph Analysis Highlight"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Flame graphs also expose the impact of long-running functions on overall performance. While some functions, like renders to body, are intended to run longer, others such as support services and callbacks, should be optimized for efficiency. The graph's tally of execution times offers a comprehensive overview, ensuring developers can focus their efforts where they matter most.&lt;/p&gt;

&lt;p&gt;AppMap improves on flame graphs by highlighting the flaws in your application and shows you the direct impact of a specific flaw on your application. No more searching to figure out where an N+1 query happened or how many times it ran!&lt;/p&gt;

&lt;h3&gt;
  
  
  Flame graphs, sequence diagrams, and more
&lt;/h3&gt;

&lt;p&gt;Try AppMap today to help you identify issues with your code or refactor an existing code base. Use our new flame graph and sequence diagram views. We also have traditional dependency and trace views. &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Links&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;⬇️ Download AppMap for VSCode and JetBrains: &lt;a href="https://appmap.io/download" rel="noopener noreferrer"&gt;https://appmap.io/download&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;⭐ Star AppMap on GitHub: &lt;a href="https://github.com/getappmap" rel="noopener noreferrer"&gt;https://github.com/getappmap&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;🐦 Follow on Twitter: &lt;a href="https://twitter.com/getappmap" rel="noopener noreferrer"&gt;https://twitter.com/getappmap&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;💬 Join AppMap Slack: &lt;a href="https://appmap.io/slack" rel="noopener noreferrer"&gt;https://appmap.io/slack&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;ℹ️ Read the AppMap docs: &lt;a href="https://appmap.io/docs" rel="noopener noreferrer"&gt;https://appmap.io/docs&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;📺 Watch AppMap Tutorials: &lt;a href="https://www.youtube.com/@appmap" rel="noopener noreferrer"&gt;https://www.youtube.com/@appmap&lt;/a&gt;&lt;br&gt;
 &lt;br&gt;
 &lt;br&gt;
 &lt;br&gt;
&lt;/p&gt;
&lt;div class="ltag__user ltag__user__id__1045236"&gt;
    &lt;a href="/ghamelin" class="ltag__user__link profile-image-link"&gt;
      &lt;div class="ltag__user__pic"&gt;
        &lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F1045236%2Fed6cdfef-5c3f-4fdc-aff4-e5b40aadaf05.jpeg" alt="ghamelin image"&gt;
      &lt;/div&gt;
    &lt;/a&gt;
  &lt;div class="ltag__user__content"&gt;
    &lt;h2&gt;
&lt;a class="ltag__user__link" href="/ghamelin"&gt;Garrett Hamelin&lt;/a&gt;Follow
&lt;/h2&gt;
    &lt;div class="ltag__user__summary"&gt;
      &lt;a class="ltag__user__link" href="/ghamelin"&gt;I love technology and everything about it. I'm a software engineer who enjoys helping others succeed and building communities of like minded people. &lt;/a&gt;
    &lt;/div&gt;
  &lt;/div&gt;
&lt;/div&gt;


</description>
      <category>ruby</category>
      <category>vscode</category>
      <category>python</category>
      <category>java</category>
    </item>
    <item>
      <title>Exploring" Too Many Updates": How to find and fix a code issue for a large number of outward calls</title>
      <dc:creator>Garrett Hamelin</dc:creator>
      <pubDate>Fri, 07 Jul 2023 18:59:37 +0000</pubDate>
      <link>https://dev.to/appmap/how-to-identify-and-fix-sql-and-rpc-updates-with-runtime-analysis-51aj</link>
      <guid>https://dev.to/appmap/how-to-identify-and-fix-sql-and-rpc-updates-with-runtime-analysis-51aj</guid>
      <description>&lt;p&gt;Whether you're a software engineer looking to optimize your code or just eager to understand &lt;a href="https://dev.to/appmap/how-appmaps-runtime-analysis-finds-performance-and-security-flaws-4p0k"&gt;runtime analysis&lt;/a&gt;, this article will help you think about rules as they relate to code analysis.&lt;/p&gt;

&lt;p&gt;In this article, I explore a maintenance rule called "Too Many Updates" and discuss its implications, causes, and mitigation strategies.&lt;/p&gt;

&lt;h2&gt;
  
  
  Understanding the rule
&lt;/h2&gt;

&lt;p&gt;At AppMap, we define the "Too Many Updates" rule as a verification process that examines the number of SQL and RPC updates executed by a command function or method within your application. This rule sets a default threshold of five updates in our &lt;code&gt;default.yml&lt;/code&gt; file. Any function or method that exceeds this threshold triggers the "Too Many Updates" finding to appear in the runtime analysis results. &lt;/p&gt;

&lt;p&gt;In technical terms, this finding corresponds to &lt;a href="https://cwe.mitre.org/data/definitions/1048.html"&gt;CWE-1048&lt;/a&gt;, which refers to an “invokable control element with a large number of outward calls” [sic]. For simplicity, we'll refer to it as "Too Many Updates" throughout this article.&lt;/p&gt;

&lt;h2&gt;
  
  
  Applying the rule
&lt;/h2&gt;

&lt;p&gt;To illustrate the concept, let's consider a real-world example using a Spring Pet Clinic application implemented with Java and the Spring framework. This application allows us to manage owners, pets, and visits for a veterinary clinic. Imagine we have created an owner, and a pet, a bird we have given the name of Jimmy, and added a recent visit to the veterinarian. Now, let's take a closer look at the code and explore the consequences of the "Too Many Updates" finding.&lt;/p&gt;

&lt;h3&gt;
  
  
  Setting custom overrides
&lt;/h3&gt;

&lt;p&gt;Before diving into the code, let's first understand how to customize the default threshold for the "Too Many Updates" rule. By creating an &lt;code&gt;appmap-scanner.yml&lt;/code&gt; file, and running the command, you can override the default settings.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nv"&gt;$ &lt;/span&gt;npx @appland/scanner &lt;span class="se"&gt;\&lt;/span&gt;
    &lt;span class="nt"&gt;--appmap-dir&lt;/span&gt; tmp/appmap &lt;span class="se"&gt;\&lt;/span&gt;
    &lt;span class="nt"&gt;--config&lt;/span&gt; appmap-scanner.yml &lt;span class="se"&gt;\&lt;/span&gt;
    ci
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;In the example provided, the warning limit is set to one for demonstration purposes.&lt;br&gt;
&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight yaml"&gt;&lt;code&gt;&lt;span class="na"&gt;checks&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
  &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;rule&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;authzBeforeAuthn&lt;/span&gt;
  &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;rule&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;http500&lt;/span&gt;
  &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;rule&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;illegalPackageDependency&lt;/span&gt;
    &lt;span class="na"&gt;properties&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
      &lt;span class="na"&gt;callerPackages&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
        &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;equal&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;actionpack&lt;/span&gt;
      &lt;span class="na"&gt;calleePackage&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
        &lt;span class="na"&gt;equal&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;app/controllers&lt;/span&gt;
  &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;rule&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;insecureCompare&lt;/span&gt;
  &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;rule&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;missingAuthentication&lt;/span&gt;
  &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;rule&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;missingContentType&lt;/span&gt;
  &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;rule&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;nPlusOneQuery&lt;/span&gt;
  &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;rule&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;secretInLog&lt;/span&gt;
  &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;rule&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;slowFunctionCall&lt;/span&gt;
    &lt;span class="na"&gt;properties&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
      &lt;span class="na"&gt;timeAllowed&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="m"&gt;0.2&lt;/span&gt;
      &lt;span class="na"&gt;functions&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
        &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;match&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;Controller#create$&lt;/span&gt;
  &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;rule&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;slowHttpServerRequest&lt;/span&gt;
    &lt;span class="na"&gt;properties&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
      &lt;span class="na"&gt;timeAllowed&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="m"&gt;0.5&lt;/span&gt;
  &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;rule&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;slowQuery&lt;/span&gt;
    &lt;span class="na"&gt;properties&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
      &lt;span class="na"&gt;timeAllowed&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="m"&gt;0.05&lt;/span&gt;
  &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;rule&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;tooManyJoins&lt;/span&gt;
  &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;rule&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;tooManyUpdates&lt;/span&gt;
        &lt;span class="s"&gt;properties&lt;/span&gt;&lt;span class="err"&gt;:&lt;/span&gt;
            &lt;span class="na"&gt;warningLimit&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="m"&gt;1&lt;/span&gt;
  &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;rule&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;unbatchedMaterializedQuery&lt;/span&gt;
  &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;rule&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;updateInGetRequest&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;However, in practical scenarios, it's recommended to set a more appropriate threshold based on your application's requirements. Now that we can control our threshold let's jump over and view our findings.&lt;/p&gt;
&lt;h3&gt;
  
  
  Analyzing findings
&lt;/h3&gt;

&lt;p&gt;To analyze the findings, we'll use AppMap to navigate to the runtime analysis section. The findings table provides a comprehensive overview of all the identified issues. &lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fdm4f0i5f280cll0j5wo3.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fdm4f0i5f280cll0j5wo3.png" alt="Analyzing Findings 1" width="800" height="493"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;You can also group the findings by project, date, or category to gain better visibility into your application's maintainability.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fnb3t9ow7oy8w675w1zip.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fnb3t9ow7oy8w675w1zip.png" alt="Analyzing Findings 2" width="477" height="523"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Examining Example 1&lt;/p&gt;

&lt;p&gt;Open the findings report for the "Too Many Updates" finding to understand its causes and implications. In this example, the command performs 47 SQL or RPC updates, as indicated in the event summary.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fn8g910n9tr9kn91i0lqc.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fn8g910n9tr9kn91i0lqc.png" alt="Findings Report Example 1" width="800" height="445"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;When we examine the map, we can observe a sequence diagram representing the execution flow. The presence of this finding suggests potential poor coding practices or architectural flaws in the application.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F5hmxhuqaaayotqd0tqqg.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F5hmxhuqaaayotqd0tqqg.png" alt="Example 1 Sequence Diagram" width="800" height="440"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;It highlights the need to consolidate multiple calls into a more efficient and maintainable structure. In this particular application, this is the result of database migrations being performed during the setup phase for development.&lt;/p&gt;

&lt;p&gt;Examining Example 2&lt;/p&gt;

&lt;p&gt;Now, let's explore another example to compare and contrast the findings. In this case, the threshold is set to two, and we examine the sequence diagram for the corresponding map finding an action that performs to “updates” in the same function call.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fhpdxpit47ca7ab1rp6xp.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fhpdxpit47ca7ab1rp6xp.png" alt="Example 2 Sequence Diagram" width="800" height="388"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;This specific scenario involves adding a pet to an owner. We can observe that two updates are performed: one to &lt;code&gt;INSERT&lt;/code&gt; the pet's information…&lt;br&gt;
&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight sql"&gt;&lt;code&gt;&lt;span class="k"&gt;INSERT&lt;/span&gt; &lt;span class="k"&gt;INTO&lt;/span&gt; &lt;span class="n"&gt;pets&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;id&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;birth_date&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;name&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;type_id&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="nv"&gt;`
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;…and another to associate the pet with its owner.&lt;br&gt;
&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight sql"&gt;&lt;code&gt;&lt;span class="k"&gt;UPDATE&lt;/span&gt; &lt;span class="n"&gt;pets&lt;/span&gt; &lt;span class="k"&gt;SET&lt;/span&gt; &lt;span class="k"&gt;owner&lt;/span&gt; &lt;span class="n"&gt;owner_id&lt;/span&gt;&lt;span class="o"&gt;=?&lt;/span&gt; &lt;span class="k"&gt;WHERE&lt;/span&gt; &lt;span class="n"&gt;id&lt;/span&gt;&lt;span class="o"&gt;=?&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;Unlike the previous example, this finding emphasizes a design choice rather than inherent flaws in the application's architecture. It prompts us to evaluate if these two calls can be consolidated into a single call for improved efficiency and simplicity.&lt;/p&gt;
&lt;h3&gt;
  
  
  Selecting a strategy
&lt;/h3&gt;

&lt;p&gt;To address the "Too Many Updates" finding, we have several mitigation strategies at our disposal. &lt;/p&gt;

&lt;p&gt;The first and simplest approach is refactoring the code to consolidate multiple updates into a single call. Often we find that “Too Many Updates” isn’t the result of some large flaw in the design of our application, but rather the result of poor implementation of coding standards and common best practices. &lt;/p&gt;

&lt;p&gt;By reviewing the code and analyzing the sequence diagrams, we can identify opportunities to optimize the number of updates performed. Additionally, if we do find a larger issue at play we can consider architectural changes. Such as reevaluating the structure of services and abstractions, to ensure a more streamlined approach. &lt;/p&gt;

&lt;p&gt;Alternatively, if these issues uncover a security risk in our application, we can employ the use of rate limiting to ensure our application remains performant and secure. These mitigation strategies enhance maintainability, improve code readability, and reduce potential security risks.&lt;/p&gt;

&lt;p&gt;Watch the video:&lt;/p&gt;

&lt;p&gt;&lt;iframe width="710" height="399" src="https://www.youtube.com/embed/TSJWKRJYvaA"&gt;
&lt;/iframe&gt;
&lt;/p&gt;
&lt;h2&gt;
  
  
  Summary
&lt;/h2&gt;

&lt;p&gt;In this article, we explored the "Too Many Updates" maintenance rule and its impact on software engineering practices. &lt;/p&gt;

&lt;p&gt;By understanding the causes, implications, and mitigation strategies, you can effectively optimize your code and ensure a more efficient and maintainable application. &lt;/p&gt;

&lt;p&gt;Remember to review your findings, analyze sequence diagrams, and implement the appropriate refactoring techniques and architectural changes. By doing so, you'll enhance the overall quality and performance of your software.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Links&lt;/strong&gt;&lt;br&gt;
📸 Cover Photo by &lt;a href="https://unsplash.com/@karlp?utm_source=unsplash&amp;amp;utm_medium=referral&amp;amp;utm_content=creditCopyText"&gt;Karl Pawlowicz&lt;/a&gt; on &lt;a href="https://unsplash.com/photos/QUHuwyNgSA0?utm_source=unsplash&amp;amp;utm_medium=referral&amp;amp;utm_content=creditCopyText"&gt;Unsplash&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;⬇️ Download AppMap for VSCode and JetBrains: &lt;a href="https://appmap.io/download"&gt;https://appmap.io/download&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;⭐ Star AppMap on GitHub: &lt;a href="https://github.com/getappmap"&gt;https://github.com/getappmap&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;🐦 Follow on Twitter: &lt;a href="https://twitter.com/getappmap"&gt;https://twitter.com/getappmap&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;💬 Join AppMap Slack: &lt;a href="https://appmap.io/slack"&gt;https://appmap.io/slack&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;ℹ️ Read the AppMap docs: &lt;a href="https://appmap.io/docs"&gt;https://appmap.io/docs&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;📺 Watch AppMap Tutorials: &lt;a href="https://www.youtube.com/@appmap"&gt;https://www.youtube.com/@appmap&lt;/a&gt;&lt;/p&gt;

&lt;p&gt; &lt;br&gt;
 &lt;br&gt;
 &lt;/p&gt;


&lt;div class="ltag__user ltag__user__id__1045236"&gt;
    &lt;a href="/ghamelin" class="ltag__user__link profile-image-link"&gt;
      &lt;div class="ltag__user__pic"&gt;
        &lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F1045236%2Fed6cdfef-5c3f-4fdc-aff4-e5b40aadaf05.jpeg" alt="ghamelin image"&gt;
      &lt;/div&gt;
    &lt;/a&gt;
  &lt;div class="ltag__user__content"&gt;
    &lt;h2&gt;
&lt;a class="ltag__user__link" href="/ghamelin"&gt;Garrett Hamelin&lt;/a&gt;Follow
&lt;/h2&gt;
    &lt;div class="ltag__user__summary"&gt;
      &lt;a class="ltag__user__link" href="/ghamelin"&gt;I love technology and everything about it. I'm a software engineer who enjoys helping others succeed and building communities of like minded people. &lt;/a&gt;
    &lt;/div&gt;
  &lt;/div&gt;
&lt;/div&gt;



</description>
      <category>webdev</category>
      <category>programming</category>
      <category>java</category>
      <category>devops</category>
    </item>
    <item>
      <title>How to streamline and focus your sequence diagrams</title>
      <dc:creator>Garrett Hamelin</dc:creator>
      <pubDate>Wed, 28 Jun 2023 19:38:01 +0000</pubDate>
      <link>https://dev.to/appmap/how-to-streamline-and-focus-your-sequence-diagrams-3p7o</link>
      <guid>https://dev.to/appmap/how-to-streamline-and-focus-your-sequence-diagrams-3p7o</guid>
      <description>&lt;p&gt;&lt;strong&gt;AppMap’s new feature gives developers greater control over their sequence diagrams to enhance code reviews.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;The value of sequence diagrams, especially for code reviews, &lt;a href="https://dev.to/appmap/quickly-learn-how-new-to-you-code-works-using-sequence-diagrams-h9g"&gt;is growing&lt;/a&gt;. And AppMap is at the cutting edge, creating new tools and capabilities for developers to generate and use sequence diagrams for designing and improving code quality from writing to reviewing. In this article, I’ll share a new filtering feature of our sequence diagram tool in AppMap.&lt;/p&gt;

&lt;h3&gt;
  
  
  Taming the complexity of sequence diagrams
&lt;/h3&gt;

&lt;p&gt;As software projects grow in size and complexity, so do the sequence diagrams generated from them that represent their inner workings. These diagrams often become extensive and overwhelming, making it challenging to decipher the flow of interactions and identify critical components. The AppMap user community has requested a way to declutter their &lt;a href="https://dev.to/appmap/automatically-generate-interactive-sequence-diagrams-of-your-java-codes-runtime-behavior-2jg0"&gt;automatically-generated sequence diagrams&lt;/a&gt; in order to focus on the essential elements of their application. &lt;/p&gt;

&lt;p&gt;We heard you, and we’re excited to share this new feature release. Read on for the details, and watch this walkthrough video to see it in action.&lt;/p&gt;

&lt;p&gt;&lt;iframe width="710" height="399" src="https://www.youtube.com/embed/5uHA_pnKzIc"&gt;
&lt;/iframe&gt;
&lt;/p&gt;

&lt;h3&gt;
  
  
  Advanced filtering for unparalleled control
&lt;/h3&gt;

&lt;p&gt;With our latest release, we added an enhanced filtering system that empowers developers to take control of their sequence diagrams by eliminating unnecessary noise and tailoring your diagrams to display only the information that matters most to you and your team.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;3 key functionalities&lt;/strong&gt; &lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Live filtering: Instantly reduce complexity by hiding specific components, such as external code or framework-related elements. With just a few clicks, you can create a clean, focused view of your sequence diagram.&lt;/li&gt;
&lt;li&gt;Customizable views: Once you have refined your diagram to your liking, you can save that view as a filter. This means you can apply the filter to future app maps, whether you want it as a default setting for all diagrams or selectively choose where to apply it.&lt;/li&gt;
&lt;li&gt;Seamless switching: Switching between different views is effortless. Just select the desired filter, and the diagram will dynamically update to display your preferred elements. No need to rebuild or navigate complex menus.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F46hgvhvz31qaahebya3b.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F46hgvhvz31qaahebya3b.png" alt="Filtering Sequence Diagrams" width="800" height="369"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Benefits and advantages&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;AppMap's enhanced filtering feature goes beyond simplifying your sequence diagrams.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Persistence: Your custom filter views persist as long as the diagram remains open. This allows you to revisit and analyze your diagrams without losing your customized settings. If a diagram has been closed, getting that view back is as simple as reapplying the filter. If you find yourself applying the same filter to a majority of your sequence diagrams, set a previously saved filter as the default, providing a seamless experience across any sequence diagram you choose to open or share. Changing or setting a default view becomes as simple as clicking a button. &lt;/li&gt;
&lt;li&gt;Intuitive interface: Our user-friendly interface ensures that applying filters and customizing your view is a breeze. With our configure-as-you-go model, developers spend less time configuring and more time gaining insights from their diagrams.&lt;/li&gt;
&lt;li&gt;Increased efficiency: By decluttering your sequence diagrams and focusing on the relevant elements, you can make quick decisions on things that matter most, improving your code analysis efficiency and gaining a deeper understanding of your application's behavior on whatever scale you choose to view.&lt;/li&gt;
&lt;/ol&gt;

&lt;h3&gt;
  
  
  Getting Started + community
&lt;/h3&gt;

&lt;p&gt;Sequence diagrams are particularly useful for designing and testing software systems that involve multiple components, asynchronous events, or complex control flows. Learn more about the common use cases for sequence diagrams and how to interpret them &lt;a href="https://dev.to/appmap/quickly-learn-how-new-to-you-code-works-using-sequence-diagrams-h9g"&gt;in this post&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;To try out our new filtering feature, &lt;a href="https://appmap.io/download"&gt;download AppMap&lt;/a&gt; into your favorite IDE and use our &lt;a href="https://appmap.io/docs/appmap-overview.html"&gt;handy docs&lt;/a&gt; to get started. We hope you enjoy exploring the possibilities, experimenting with different views, and revolutionizing how you analyze and understand your code!&lt;/p&gt;

&lt;p&gt;To chat with us and other users about it and get your questions answered, &lt;a href="https://appmap.io/community"&gt;join our community&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Cover Photo by &lt;a href="https://unsplash.com/@lucabravo?utm_source=unsplash&amp;amp;utm_medium=referral&amp;amp;utm_content=creditCopyText"&gt;Luca Bravo&lt;/a&gt; on &lt;a href="href="&gt;Unsplash&lt;/a&gt;&lt;/p&gt;

&lt;p&gt; &lt;br&gt;
 &lt;br&gt;
 &lt;br&gt;
&lt;/p&gt;
&lt;div class="ltag__user ltag__user__id__1045236"&gt;
    &lt;a href="/ghamelin" class="ltag__user__link profile-image-link"&gt;
      &lt;div class="ltag__user__pic"&gt;
        &lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F1045236%2Fed6cdfef-5c3f-4fdc-aff4-e5b40aadaf05.jpeg" alt="ghamelin image"&gt;
      &lt;/div&gt;
    &lt;/a&gt;
  &lt;div class="ltag__user__content"&gt;
    &lt;h2&gt;
&lt;a class="ltag__user__link" href="/ghamelin"&gt;Garrett Hamelin&lt;/a&gt;Follow
&lt;/h2&gt;
    &lt;div class="ltag__user__summary"&gt;
      &lt;a class="ltag__user__link" href="/ghamelin"&gt;I love technology and everything about it. I'm a software engineer who enjoys helping others succeed and building communities of like minded people. &lt;/a&gt;
    &lt;/div&gt;
  &lt;/div&gt;
&lt;/div&gt;


</description>
      <category>webdev</category>
      <category>programming</category>
      <category>news</category>
      <category>vscode</category>
    </item>
    <item>
      <title>Understanding Authorization Before Authentication: Enhancing Web API Security</title>
      <dc:creator>Garrett Hamelin</dc:creator>
      <pubDate>Fri, 23 Jun 2023 21:44:12 +0000</pubDate>
      <link>https://dev.to/appmap/understanding-authorization-before-authentication-enhancing-web-api-security-2cjh</link>
      <guid>https://dev.to/appmap/understanding-authorization-before-authentication-enhancing-web-api-security-2cjh</guid>
      <description>&lt;p&gt;In today's digital landscape, where data breaches and cyber attacks have become increasingly prevalent, ensuring the security of web applications and APIs is critical. While most developers are familiar with the concept of authentication, a crucial aspect that often gets overlooked or misunderstood is authorization. We'll explore a real-world scenario, identify common security risks, and discuss mitigation strategies. So let's get started!&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;Authorization vs. Authentication: Clarifying the Terminology&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;Before we jump into the specifics, let's clarify the difference between authorization and authentication. Authorization is the process of determining what resources or functionalities a user can access within an application. It revolves around identifying and granting appropriate permissions. On the other hand, authentication involves verifying the identity of a user and ensuring that they are who they claim to be. So it makes sense that you wouldn't want to give someone access to things before you know who they are. &lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;Unveiling Security Risks in Development Environments&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;Let's examine a practical example to understand this better. Consider an e-commerce store built on a Ruby on Rails framework, a fork of the Spree e-commerce platform.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F94izgb0smx03i8lmi7va.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F94izgb0smx03i8lmi7va.png" alt="storefront"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;When looking at a sequence diagram of cart interaction you’ll notice that the authentication step is missing when accessing the cart functionality. Clicking on the cart with an item already added to it does not prompt the user to sign in. &lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fgplrjpspcm6pvrwcqwqi.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fgplrjpspcm6pvrwcqwqi.png" alt="cart"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;While this may be by design because the cart does not contain any personally identifiable information, the very next step in the purchase process does.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F73tai9qpekumen3an266.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F73tai9qpekumen3an266.png" alt="shipping details"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The application asks for a shipping address. In my opinion, a good rule of thumb is that any time we are capturing personally identifiable information once the information has been submitted the application should be authenticating that user. Any time that type of information is presented a user must be authenticated and authorized before viewing or updating. &lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;AppMap: A Powerful Runtime Analysis Tool&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;It can be challenging and time-consuming to uncover and address these security concerns. Often times software teams look to tools or audits to provide us with a direction on what is causing the issue, which can be complex and require hours of investigation. The AppMap runtime analysis tool can give us a comprehensive look at the problem, what is causing it, and where it comes from in a matter of minutes. AppMap provides insights into how our applications behave at runtime, allowing us to analyze their execution flows and detect potential issues. With AppMap, we can identify and potentially fix security vulnerabilities, such as authorization-before-authentication problems.&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;Analyzing&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;Analyzing the code using AppMap, we discover that the violation of authorization-before-authentication occurs in multiple instances within the application. Specifically, we observe the use of CanCan, a library for authorization, which performs authorization before any authentication check.&lt;/p&gt;

&lt;p&gt;Inspecting the trace view and sequence diagram in AppMap, we trace the flow of events leading to the violation. We find that the "get cart" process triggers the authorization step without first authenticating the user. This type of behavior could allow unauthenticated users to access restricted resources.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fzdh5x8dndojx4spgkt4f.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fzdh5x8dndojx4spgkt4f.png" alt="trace view"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fi1j2pfoxcewbxf1bq9wa.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fi1j2pfoxcewbxf1bq9wa.png" alt="sequence diagram"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;As we explore the dependency map, we notice that the authorization call is sent to the Spree Order controller, which resides outside of our application's codebase. This presents a challenge since we lack direct control over Spree's authentication process.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F7wr4us6wwu6ylx3fwwup.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F7wr4us6wwu6ylx3fwwup.png" alt="Dependency map"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;To address this security risk, we need to modify the order of operations and ensure that authentication occurs before authorization. In this specific case, the README of the application states that every request is assumed to come from an admin user, which is a major red flag. To mitigate this, we can implement the following strategies:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Authenticate Before You Authorize:&lt;/strong&gt; Flip the order of authentication and authorization, ensuring that users are authenticated before granting them access to restricted resources. In our case, we may want to know who a user is or perform a basic authentication before adding something to a cart on the off chance that a user would like to save that cart for later or to prevent abuse of the cart system for exclusive limited release items (I'm just spitballing here there are a ton of reasons it may be a good idea to establish a user identity before performing an action). &lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Validate Credentials in Development Environments:&lt;/strong&gt; Even in development or QA environments, enforce authentication to replicate real-world scenarios and identify potential vulnerabilities early on.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Employ Anomaly Detection and Adaptive Access Control:&lt;/strong&gt; Utilize artificial intelligence or machine learning techniques to create anomaly detection systems, threat protection mechanisms, and adaptive access control. This hybrid approach allows for flexibility in development environments while providing robust security controls in production.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;By adopting these strategies, you can strengthen the security of your web APIs and prevent unauthorized access to sensitive resources. It is crucial to prioritize security throughout the development lifecycle to avoid compromising user data and maintain the trust of our users.&lt;/p&gt;

&lt;h2&gt;
  
  
  Summary
&lt;/h2&gt;

&lt;p&gt;Authorization before authentication is a vital security principle that ensures users are properly identified and granted access to resources. By leveraging tools like AppMap and following best practices, we can proactively identify and address security vulnerabilities early on, ultimately building more secure and reliable web applications.&lt;/p&gt;

&lt;p&gt;Thank you for joining me in this exploration of authorization before authentication in web API security. Stay tuned for more articles, and if you have any questions or suggestions, feel free to leave a comment below!&lt;/p&gt;

&lt;p&gt; &lt;br&gt;
 &lt;br&gt;
 &lt;br&gt;
&lt;/p&gt;
&lt;div class="ltag__user ltag__user__id__1045236"&gt;
    &lt;a href="/ghamelin" class="ltag__user__link profile-image-link"&gt;
      &lt;div class="ltag__user__pic"&gt;
        &lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F1045236%2Fed6cdfef-5c3f-4fdc-aff4-e5b40aadaf05.jpeg" alt="ghamelin image"&gt;
      &lt;/div&gt;
    &lt;/a&gt;
  &lt;div class="ltag__user__content"&gt;
    &lt;h2&gt;
&lt;a class="ltag__user__link" href="/ghamelin"&gt;Garrett Hamelin&lt;/a&gt;Follow
&lt;/h2&gt;
    &lt;div class="ltag__user__summary"&gt;
      &lt;a class="ltag__user__link" href="/ghamelin"&gt;I love technology and everything about it. I'm a software engineer who enjoys helping others succeed and building communities of like minded people. &lt;/a&gt;
    &lt;/div&gt;
  &lt;/div&gt;
&lt;/div&gt;


</description>
      <category>security</category>
      <category>webdev</category>
      <category>programming</category>
      <category>ruby</category>
    </item>
    <item>
      <title>How AppMap's runtime analysis finds performance and security flaws</title>
      <dc:creator>Garrett Hamelin</dc:creator>
      <pubDate>Fri, 16 Jun 2023 21:13:26 +0000</pubDate>
      <link>https://dev.to/appmap/how-appmaps-runtime-analysis-finds-performance-and-security-flaws-4p0k</link>
      <guid>https://dev.to/appmap/how-appmaps-runtime-analysis-finds-performance-and-security-flaws-4p0k</guid>
      <description>&lt;p&gt;&lt;em&gt;Cover image credit: Photo by &lt;a href="https://unsplash.com/@ikukevk?utm_source=unsplash&amp;amp;utm_medium=referral&amp;amp;utm_content=creditCopText"&gt;Kevin Ku&lt;/a&gt; on &lt;a href="https://unsplash.com/photos/w7ZyuGYNpRQ?utm_source=unsplash&amp;amp;utm_medium=referral&amp;amp;utm_content=creditCopyText"&gt;Unsplash&lt;/a&gt;&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Software and application development is difficult. Producing code that is flaw and error-free is even harder, sometimes finding the problems in our software can be half the battle of creating applications that are secure, reliable, and performant. We spend an enormous amount of time and money running, testing, and monitoring our code trying to find the root cause of an issue that has popped up either before or after the application went live, hoping that the next issue doesn’t rear its ugly head in production. So to prepare for the inevitable we implement tools everywhere, trying everything we can to catch it when it does. But what if we could reduce that overhead, and give ourselves a “head-start” to finding issues while we are still in the development phase? In this article, I’ll introduce runtime analysis and describe what it’s good for. I’ll also give you a tour of how AppMap uses runtime analysis to identify hard-to-find issues within your application.&lt;/p&gt;

&lt;h2&gt;
  
  
  What is runtime analysis?
&lt;/h2&gt;

&lt;p&gt;Runtime analysis is a process of analyzing code while it is running, capturing how your code behaves when it is living and working with actual data. Traditionally, developers use static code analysis tools to examine patterns and create a model of their code and how the data flows through and application without actually &lt;em&gt;executing&lt;/em&gt; it. Usually, if we want to watch processes and see what happening in our live running applications we employ Application Performance Monitoring Tools running in our production environment. This option is expensive and rarely shows where the problem occurred in the source code, which can make it challenging to integrate a solution back into the code. Runtime analysis gives us a “best of both worlds” scenario. When runtime analysis is done within the development environment, developers have an easy and accessible way to observe running processes, analyze code patterns responsible for those processes, see how and what data is affected by our coding patterns, and identify potential hot spots directly in the source code of that application. This in turn gives us the opportunity to resolve issues before we even submit our code for a code review. &lt;/p&gt;

&lt;h3&gt;
  
  
  Flaws vs. bugs
&lt;/h3&gt;

&lt;p&gt;Runtime analysis identifies &lt;em&gt;flaws&lt;/em&gt;, which are different from &lt;em&gt;bugs&lt;/em&gt;. Bugs are usually the result of a logic error, such as forgetting to initialize a variable or causing a race condition. Flaws, on the other hand, are fundamental structural issues within the code. They pertain to problems with code design, code behavior when handling data, or deeper structural aspects of code implementation.&lt;/p&gt;

&lt;h2&gt;
  
  
  Benefits of runtime analysis in the dev environment
&lt;/h2&gt;

&lt;p&gt;While there are monitoring tools available for the production environment, runtime analysis in the development environment offers three superior benefits:&lt;/p&gt;

&lt;h3&gt;
  
  
  Cost effectiveness
&lt;/h3&gt;

&lt;p&gt;Production monitoring tools can be expensive, especially if your application has high traffic or complex architectures. Not to mention that it can be hard to tailor these tools for what you need and to leave out what you don’t.&lt;/p&gt;

&lt;h3&gt;
  
  
  Early issue detection
&lt;/h3&gt;

&lt;p&gt;By analyzing your code at runtime during the development phase, developers are able to identify flaws and weaknesses early on before it goes to production or is seen by a customer. &lt;a href="https://research.facebook.com/publications/fausta-scaling-dynamic-analysis-with-traffic-generation-at-whatsapp/"&gt;In a study published last year by Meta&lt;/a&gt;, they found that finding issues during the development phase makes them more likely to get fixed and makes the fix more likely&lt;/p&gt;

&lt;h3&gt;
  
  
  Seamless integration with the development workflow
&lt;/h3&gt;

&lt;p&gt;With runtime analysis, you can deploy your application to different testing environments and stages, catching and addressing issues at various points in the development lifecycle. This enhances code quality and reduces potential risks.&lt;/p&gt;

&lt;h2&gt;
  
  
  Using AppMap for runtime analysis
&lt;/h2&gt;

&lt;p&gt;AppMap performs runtime analysis within your IDE. Unlike static code analysis, which creates a model of your code's behavior, AppMap watches your code run, giving it the ability to reason about it much more accurately and definitively compared to static analysis.&lt;/p&gt;

&lt;p&gt;To identify flaws, AppMap sources its default list of 12 rules from the &lt;a href="https://cwe.mitre.org/data/definitions/1344.html"&gt;OWASP top 10&lt;/a&gt; found on the &lt;a href="https://cwe.mitre.org/index.html"&gt;Common Weakness Enumeration (CWE) forum&lt;/a&gt;. CWE is a community-developed list of software and hardware weakness types governed by high-level organizations and companies with a focus on security, maintainability, and performance. Additional rules are available for use as well, and a &lt;a href="https://appmap.io/docs/analysis/rules-reference.html"&gt;full list of available rules&lt;/a&gt; and their definitions can be found in our &lt;a href="https://appmap.io/docs/analysis/rules-reference.html"&gt;documentation&lt;/a&gt;. &lt;/p&gt;

&lt;p&gt;The cherry on top of this rule based runtime analysis is that it is fast. With static code analyzers, we have a wait time for the tool to parse code, build a model, and evaluate it.  AppMap takes a slightly different approach. Since we can actually run your code we have the ability to dynamically instrument your code. Doing so provides additional insight into what is happening in your application, where and which processes our running. We &lt;em&gt;flag&lt;/em&gt; certain events as they occur and add &lt;em&gt;labels&lt;/em&gt; with additional information about what is actually happening in your application at the moment in time that the event occurred.  AppMap’s Runtime Analysis Scanner then utilizes those flags and labels to identify potential issues or to spot patterns that may be problematic.&lt;/p&gt;

&lt;h3&gt;
  
  
  How to setup AppMap Runtime Analysis
&lt;/h3&gt;

&lt;p&gt;&lt;iframe width="710" height="399" src="https://www.youtube.com/embed/Hygw8F-HOVs"&gt;
&lt;/iframe&gt;
&lt;/p&gt;

&lt;p&gt;After you install AppMap, record your application, and create your first AppMap we will add these default rules by creating or modifying the &lt;code&gt;appmap-scanner.yml&lt;/code&gt; file. This extends the functionality of the scanner and allows you to include custom rules that suit your specific needs.&lt;/p&gt;

&lt;p&gt;Our documentation also provides insights into how the rules are constructed, &lt;a href="https://appmap.io/docs/analysis/labels-reference.html"&gt;which labels we use in instrumentation&lt;/a&gt;, and how the &lt;a href="https://github.com/getappmap/appmap-js/tree/main/packages/scanner"&gt;scanner works with flags&lt;/a&gt; to match patterns and find flaws.&lt;/p&gt;

&lt;p&gt;example 1: appmap-scanner.yml&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight yaml"&gt;&lt;code&gt;&lt;span class="na"&gt;checks&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
  &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;rule&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;authz-before-authn&lt;/span&gt;
  &lt;span class="c1"&gt;# - rule: circular-dependency&lt;/span&gt;
  &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;rule&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;deprecated-crypto-algorithm&lt;/span&gt;
  &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;rule&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;deserialization-of-untrusted-data&lt;/span&gt;
  &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;rule&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;exec-of-untrusted-command&lt;/span&gt;
  &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;rule&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;http-500&lt;/span&gt;
  &lt;span class="c1"&gt;# - rule: illegal-package-dependency&lt;/span&gt;
  &lt;span class="c1"&gt;# - rule: incompatible-http-client-request&lt;/span&gt;
  &lt;span class="c1"&gt;# - rule: insecure-compare&lt;/span&gt;
  &lt;span class="c1"&gt;# - rule: job-not-cancelled&lt;/span&gt;
  &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;rule&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;logout-without-session-reset&lt;/span&gt;
  &lt;span class="c1"&gt;# - rule: missing-authentication&lt;/span&gt;
  &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;rule&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;missing-content-type&lt;/span&gt;
  &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;rule&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;n-plus-one-query&lt;/span&gt;
  &lt;span class="c1"&gt;# - rule: query-from-invalid-package&lt;/span&gt;
  &lt;span class="c1"&gt;# - rule: query-from-view&lt;/span&gt;
  &lt;span class="c1"&gt;# - rule: rpc-without-circuit-breaker&lt;/span&gt;
  &lt;span class="c1"&gt;# - rule: save-without-validation&lt;/span&gt;
  &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;rule&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;secret-in-log&lt;/span&gt;
  &lt;span class="c1"&gt;#  - rule: slow-function-call&lt;/span&gt;
  &lt;span class="c1"&gt;#  - rule: slow-httpServer-request&lt;/span&gt;
  &lt;span class="c1"&gt;#  - rule: slow-query&lt;/span&gt;
  &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;rule&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;too-many-joins&lt;/span&gt;
  &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;rule&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;too-many-updates&lt;/span&gt;
  &lt;span class="c1"&gt;# - rule: unbatched-materialized-query&lt;/span&gt;
  &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;rule&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;unauthenticated-encryption&lt;/span&gt;
  &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;rule&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;update-in-get-request&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;h3&gt;
  
  
  Results
&lt;/h3&gt;

&lt;p&gt;Once a configuration has been created, you get all sorts of information about what possible issues may arise in your application at runtime. &lt;/p&gt;

&lt;p&gt;Example 2: Analysis Overview &lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F3w11kltga4l47w7rlj2u.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F3w11kltga4l47w7rlj2u.png" alt="Analysis Overview" width="800" height="643"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;When run against an example application, we set our configuration to look for N+1 queries that are causing performance issues that are difficult to find using traditional static code analysis. We can see in the findings that not only did we find two N+1 queries, we found 69 other flaws in our application, 28 of which are potential security risks. In full transparency, this example application was built to be deliberately insecure so those security findings aren’t all that surprising, but what is surprising is the wealth of information available to us about the flaws that were found. &lt;/p&gt;
&lt;h2&gt;
  
  
  Understanding runtime analysis findings
&lt;/h2&gt;

&lt;p&gt;When we drill down into one of these findings, we can see a link to the definition of the flaw with more information about it (ex. 3.1), the number of times it occurs (ex. 3.2), the stack trace to know how it occurred (ex.3.3), and how which “paths” a user could take to encounter that flaw (ex. 3.4). With these insights we are able to determine if a fix is necessary, where the fix needs to happen, and we can design and implement a fix before our feature ever goes into review.  &lt;/p&gt;

&lt;p&gt;&lt;em&gt;Example 3: Findings&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fcf3i887vs2ny37s2d2lu.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fcf3i887vs2ny37s2d2lu.png" alt="Runtime Analysis Findidngs" width="800" height="660"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;This presents us with real actionable information about just how negatively this flaw could impact the performance of our application. Imagine the cost and user interruption this would cause if it was found in production or, worse, not found at all. &lt;/p&gt;
&lt;h2&gt;
  
  
  Runtime analysis FTW 🏆
&lt;/h2&gt;

&lt;p&gt;By leveraging runtime analysis in the development environment, you can save on costs, detect issues early, and integrate the analysis into your workflow. Using AppMap for your runtime analysis empowers developers to deliver better and more reliable software. &lt;/p&gt;

&lt;p&gt;We love to hear what our users have to say. Let us know what you think in the comments below. Also, check out our AppMap integration for your IDE and other AppMap-related content at the links down below. &lt;/p&gt;

&lt;p&gt;For an in depth look at the default rules check out this article: &lt;a href="https://dev.to/appmap/how-to-ensure-your-web-apis-are-safe-3lk1"&gt;How to ensure your web APIs are Safe&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Links&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;⬇️ Download AppMap for VSCode and JetBrains: &lt;a href="https://appmap.io/download"&gt;https://appmap.io/download&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;⭐ Star AppMap on GitHub: &lt;a href="https://github.com/getappmap"&gt;https://github.com/getappmap&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;🐦 Follow on Twitter: &lt;a href="https://twitter.com/getappmap"&gt;https://twitter.com/getappmap&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;💬 Join AppMap Slack: &lt;a href="https://appmap.io/slack"&gt;https://appmap.io/slack&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;ℹ️ Read the AppMap docs: &lt;a href="https://appmap.io/docs"&gt;https://appmap.io/docs&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;📺 Watch AppMap Tutorials: &lt;a href="https://www.youtube.com/@appmap"&gt;https://www.youtube.com/@appmap&lt;/a&gt;&lt;/p&gt;

&lt;p&gt; &lt;br&gt;
 &lt;br&gt;
 &lt;br&gt;
&lt;/p&gt;
&lt;div class="ltag__user ltag__user__id__1045236"&gt;
    &lt;a href="/ghamelin" class="ltag__user__link profile-image-link"&gt;
      &lt;div class="ltag__user__pic"&gt;
        &lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F1045236%2Fed6cdfef-5c3f-4fdc-aff4-e5b40aadaf05.jpeg" alt="ghamelin image"&gt;
      &lt;/div&gt;
    &lt;/a&gt;
  &lt;div class="ltag__user__content"&gt;
    &lt;h2&gt;
&lt;a class="ltag__user__link" href="/ghamelin"&gt;Garrett Hamelin&lt;/a&gt;Follow
&lt;/h2&gt;
    &lt;div class="ltag__user__summary"&gt;
      &lt;a class="ltag__user__link" href="/ghamelin"&gt;I love technology and everything about it. I'm a software engineer who enjoys helping others succeed and building communities of like minded people. &lt;/a&gt;
    &lt;/div&gt;
  &lt;/div&gt;
&lt;/div&gt;



</description>
      <category>security</category>
      <category>performance</category>
      <category>programming</category>
      <category>webdev</category>
    </item>
    <item>
      <title>Share your AppMap files and findings with your team</title>
      <dc:creator>Garrett Hamelin</dc:creator>
      <pubDate>Fri, 09 Jun 2023 21:51:07 +0000</pubDate>
      <link>https://dev.to/appmap/share-your-appmap-files-and-findings-with-your-team-37m6</link>
      <guid>https://dev.to/appmap/share-your-appmap-files-and-findings-with-your-team-37m6</guid>
      <description>&lt;p&gt;AppMap is a powerful tool for developers to find and fix performance issues. Write and run your code, and then AppMap generates findings that save you and your business time and money upfront instead of down the line.&lt;/p&gt;

&lt;p&gt;If you’re a developer running AppMap on your code, you may want to share your files and findings with your team or manager. In the upper right-hand corner, there is a share arrow that allows you to generate an SVG file of your AppMaps &lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F216fqj9ukdm5mnab1cxd.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F216fqj9ukdm5mnab1cxd.png" alt="Share your AppMap" width="800" height="344"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Because AppMaps help developers and teams describe their code design and architecture, you are able to use them to help explain the decisions you made.&lt;/p&gt;

&lt;p&gt;Once you have your SVG file, you can embed it in many different places, for many different uses. Here are some examples:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Add to a presentation for a design and/or planning meeting&lt;/li&gt;
&lt;li&gt;Add to a status update on where you or your team are on a feature update&lt;/li&gt;
&lt;li&gt;Add to documentation for onboarding a new team member or company to your code&lt;/li&gt;
&lt;li&gt;Add to the internal documentation for a feature to show the logical structure of the code&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Using AppMap SVG files to share your findings? Tell us how and share with our &lt;a href="https://appmap.io/slack"&gt;community&lt;/a&gt;.&lt;br&gt;
 &lt;br&gt;
 &lt;br&gt;
&lt;/p&gt;
&lt;div class="ltag__user ltag__user__id__1045236"&gt;
    &lt;a href="/ghamelin" class="ltag__user__link profile-image-link"&gt;
      &lt;div class="ltag__user__pic"&gt;
        &lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F1045236%2Fed6cdfef-5c3f-4fdc-aff4-e5b40aadaf05.jpeg" alt="ghamelin image"&gt;
      &lt;/div&gt;
    &lt;/a&gt;
  &lt;div class="ltag__user__content"&gt;
    &lt;h2&gt;
&lt;a class="ltag__user__link" href="/ghamelin"&gt;Garrett Hamelin&lt;/a&gt;Follow
&lt;/h2&gt;
    &lt;div class="ltag__user__summary"&gt;
      &lt;a class="ltag__user__link" href="/ghamelin"&gt;I love technology and everything about it. I'm a software engineer who enjoys helping others succeed and building communities of like minded people. &lt;/a&gt;
    &lt;/div&gt;
  &lt;/div&gt;
&lt;/div&gt;


</description>
      <category>webdev</category>
      <category>programming</category>
      <category>tutorial</category>
      <category>productivity</category>
    </item>
    <item>
      <title>How to ensure your web APIs are safe</title>
      <dc:creator>Garrett Hamelin</dc:creator>
      <pubDate>Fri, 09 Jun 2023 17:21:29 +0000</pubDate>
      <link>https://dev.to/appmap/how-to-ensure-your-web-apis-are-safe-3lk1</link>
      <guid>https://dev.to/appmap/how-to-ensure-your-web-apis-are-safe-3lk1</guid>
      <description>&lt;p&gt;&lt;em&gt;Cover image credit: Photo by &lt;a href="https://unsplash.com/@jannerboy62?utm_source=unsplash&amp;amp;utm_medium=referral&amp;amp;utm_content=creditCopyText"&gt;Nick Fewings&lt;/a&gt; on &lt;a href="https://unsplash.com/photos/4pZu15OeTXA?utm_source=unsplash&amp;amp;utm_medium=referral&amp;amp;utm_content=creditCopyText"&gt;Unsplash&lt;/a&gt;&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;This article explores how to ensure your APIs are safe. Specifically, we address a critical issue that arises when incorrect database actions are coupled with inappropriate HTTP request verbs creating an “unsafe API method.”&lt;/p&gt;

&lt;p&gt;“Request methods are considered &lt;em&gt;safe&lt;/em&gt; if their defined semantics are essentially read-only; i.e., the client does not request, and does not expect, any state change on the origin server as a result of applying a safe method to a target resource.” (&lt;a href="https://www.rfc-editor.org/rfc/rfc9110.html#section-9.2.1"&gt;The RFC Documentation&lt;/a&gt;)&lt;/p&gt;

&lt;p&gt;&lt;code&gt;GET&lt;/code&gt; and &lt;code&gt;HEAD&lt;/code&gt; requests should be &lt;em&gt;idempotent&lt;/em&gt;, which means they shouldn’t cause any side effects on the resources on the server. For most API endpoints, this means that calling them once will return the same values as calling them multiple times. For some APIs (like one that can &lt;code&gt;GET&lt;/code&gt; the current time, or look up a stock’s latest market price) it might return different data each time, but still be idempotent as long as it isn’t the API that causes those changes in the server’s data values.&lt;/p&gt;

&lt;p&gt;If a supposedly safe API breaks the idempotency rule, it can cause a lot of issues for a system. Clients of the API need to be 100% sure that their read-only calls truly are read-only. After all, nobody would trust an ATM if the act of checking their bank balance caused it to drop in value each time!&lt;/p&gt;

&lt;p&gt;Code reviewers are doing their job well when they check read-only APIs to be safe. However, they can sometimes miss things, especially with library-generated database interactions like those found in frameworks like ActiveRecord or Hibernate.&lt;/p&gt;

&lt;p&gt;In this example, I find and fix a similar issue in a Ruby on Rails application.&lt;/p&gt;

&lt;p&gt;&lt;iframe width="710" height="399" src="https://www.youtube.com/embed/iXHAzX2zTPA"&gt;
&lt;/iframe&gt;
&lt;/p&gt;

&lt;p&gt;I noticed an unexpected database insertion alongside the expected &lt;code&gt;SELECT&lt;/code&gt; statement. Instead of manually digging through the codebase, I used AppMap to scour the application for flaws and present me with comprehensive information about the exact locations of the issues within the codebase. Armed with this valuable insight, we are able to initiate fixes effectively.&lt;/p&gt;

&lt;p&gt;If we open the Runtime Analysis tab in the AppMap plugin, we can see that it identified a&lt;code&gt;INSERT&lt;/code&gt; into the analytics database, complete with IP addresses and other relevant information. A closer inspection reveals that this &lt;code&gt;INSERT&lt;/code&gt; statement is occurring within a &lt;code&gt;GET&lt;/code&gt; request. Oftentimes this is not the desired behavior and needs to be fixed. In our example, there are no side effects and the &lt;code&gt;INSERT&lt;/code&gt; is simply logging traffic analytics data and may not need to be removed, however for purposes of our demonstration I will treat this as an issue that needs resolving. &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Please note that not every &lt;code&gt;INSERT&lt;/code&gt; in a &lt;code&gt;GET&lt;/code&gt; request handler is a side effect and may be valid because it has no effect on the response; these types of side effects are not against spec. It’s perfectly fine to log API calls in your database or increment your API usage counter and still keep that API safe.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;To pinpoint the source of this issue, click on the caller function link in the side panel. Doing so jumps to the call stack within the trace view, and we can see more information about the calling function in our side panel. By selecting the source path in the gray box, we are led to the code section we need to investigate. In our case, &lt;code&gt;active_support/callbacks.rb&lt;/code&gt; &lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fn33f3piof071709xlwmp.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fn33f3piof071709xlwmp.png" alt="Trace View" width="800" height="299"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Active Support, a core dependency of Ruby on Rails, played a crucial role in initiating the action that causes the rogue &lt;code&gt;INSERT&lt;/code&gt; to occur. While this is framework-dependent code and nothing we wrote, we don’t want to change it. However,  the &lt;code&gt;invoke before&lt;/code&gt; function does give us a clue as to what is happening. The function looks like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight ruby"&gt;&lt;code&gt;&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;invoke_before&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;arg&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
  &lt;span class="vi"&gt;@before&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;each&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt;&lt;span class="n"&gt;b&lt;/span&gt;&lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="n"&gt;b&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;call&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;arg&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="k"&gt;end&lt;/span&gt; 
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;From this, we know that before any incoming request is processed, some function or action is getting called by one of our controllers to perform some action. Knowing that we need to find where the action gets created, by viewing which services the HTTP request “talks to” we can get a hint as to where the real issue might be &lt;/p&gt;

&lt;p&gt;Tracing our steps further, we explore the HTTP request by switching to the dependency map, focusing on the &lt;code&gt;GET /&lt;/code&gt;request and its connection to ActionPack, Active Support, and other parts of our code. Although most paths were internal or beyond our control, one of them led us to &lt;code&gt;controllers/dashboard_controller.rb&lt;/code&gt;. We can navigate directly to it by clicking to expand the &lt;code&gt;app/controllers&lt;/code&gt; box, then clicking on the &lt;code&gt;DashboardController&lt;/code&gt; node and using the gray navigation box in the left panel. &lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Feui7clllw65b74xz7pn4.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Feui7clllw65b74xz7pn4.png" alt="Dependency Graph" width="800" height="343"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Inside the DashboardController, I discover two important pieces of information: &lt;/p&gt;

&lt;p&gt;1) That this controller is inheriting attributes from &lt;code&gt;application_controller.rb&lt;/code&gt; &lt;/p&gt;

&lt;p&gt;2) There is a &lt;code&gt;skip_before_action&lt;/code&gt; method that skips actions that are invoked before the rest of the controller code executes&lt;/p&gt;

&lt;p&gt;I would like to look at the parent controller to see what this controller is inheriting and what actions are being run. Upon examining the application controller, I observe the problematic &lt;code&gt;before_action&lt;/code&gt;method responsible for triggering a &lt;code&gt;create analytic&lt;/code&gt; method which actually performs the work. This is the exact spot where the issue originates.&lt;br&gt;
&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight ruby"&gt;&lt;code&gt;&lt;span class="c1"&gt;# frozen_string_literal: true&lt;/span&gt;
&lt;span class="k"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;DashboardController&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&lt;/span&gt; &lt;span class="no"&gt;ApplicationController&lt;/span&gt;
  &lt;span class="n"&gt;skip_before_action&lt;/span&gt; &lt;span class="ss"&gt;:has_info&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="ss"&gt;:create_analytic&lt;/span&gt;
  &lt;span class="n"&gt;layout&lt;/span&gt; &lt;span class="kp"&gt;false&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="ss"&gt;only: &lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="ss"&gt;:change_graph&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;By adding this particular action to the &lt;code&gt;skip_before_action&lt;/code&gt; list in our &lt;code&gt;dasboard_controller&lt;/code&gt; and saving the changes, I am able to eliminate the unwanted &lt;code&gt;INSERT&lt;/code&gt; behavior. It's worth noting again that in some cases, such as when logging user activity, leaving the &lt;code&gt;INSERT&lt;/code&gt; intact might be preferable as it doesn’t cause any side effects. &lt;/p&gt;

&lt;p&gt;This entire process of identifying and fixing the issue was made possible by utilizing AppMap to find and navigate our application’s runtime behavior, quickly guiding us to the resolution. Doing this without AppMap would have required a lot more time for investigation with multiple tools. But only AppMap can detect this kind of issue in the first place without us even knowing that there is an issue.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Links&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;⬇️ Download AppMap for VSCode and JetBrains: &lt;a href="https://appmap.io/download"&gt;https://appmap.io/download&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;⭐ Star AppMap on GitHub: &lt;a href="https://github.com/getappmap"&gt;https://github.com/getappmap&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;🐦 Follow on Twitter: &lt;a href="https://twitter.com/getappmap"&gt;https://twitter.com/getappmap&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;💬 Join AppMap Slack: &lt;a href="https://appmap.io/slack"&gt;https://appmap.io/slack&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;ℹ️ Read the AppMap docs: &lt;a href="https://appmap.io/docs"&gt;https://appmap.io/docs&lt;/a&gt;&lt;/p&gt;

&lt;p&gt; &lt;br&gt;
 &lt;br&gt;
 &lt;br&gt;
&lt;/p&gt;
&lt;div class="ltag__user ltag__user__id__1045236"&gt;
    &lt;a href="/ghamelin" class="ltag__user__link profile-image-link"&gt;
      &lt;div class="ltag__user__pic"&gt;
        &lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F1045236%2Fed6cdfef-5c3f-4fdc-aff4-e5b40aadaf05.jpeg" alt="ghamelin image"&gt;
      &lt;/div&gt;
    &lt;/a&gt;
  &lt;div class="ltag__user__content"&gt;
    &lt;h2&gt;
&lt;a class="ltag__user__link" href="/ghamelin"&gt;Garrett Hamelin&lt;/a&gt;Follow
&lt;/h2&gt;
    &lt;div class="ltag__user__summary"&gt;
      &lt;a class="ltag__user__link" href="/ghamelin"&gt;I love technology and everything about it. I'm a software engineer who enjoys helping others succeed and building communities of like minded people. &lt;/a&gt;
    &lt;/div&gt;
  &lt;/div&gt;
&lt;/div&gt;



</description>
      <category>webdev</category>
      <category>programming</category>
      <category>ruby</category>
      <category>rails</category>
    </item>
    <item>
      <title>Find and fix non-Restful APIs with runtime analysis</title>
      <dc:creator>Garrett Hamelin</dc:creator>
      <pubDate>Tue, 06 Jun 2023 20:53:37 +0000</pubDate>
      <link>https://dev.to/appmap/find-and-fix-non-restful-apis-with-runtime-analysis-video-55n4</link>
      <guid>https://dev.to/appmap/find-and-fix-non-restful-apis-with-runtime-analysis-video-55n4</guid>
      <description>&lt;p&gt;&lt;iframe width="710" height="399" src="https://www.youtube.com/embed/iXHAzX2zTPA"&gt;
&lt;/iframe&gt;
&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>programming</category>
      <category>tutorial</category>
      <category>ruby</category>
    </item>
    <item>
      <title>Go beyond static code analysis: Understand how your data flows through a process from start to finish</title>
      <dc:creator>Garrett Hamelin</dc:creator>
      <pubDate>Fri, 12 May 2023 19:02:33 +0000</pubDate>
      <link>https://dev.to/appmap/go-beyond-static-code-analysis-understand-how-your-data-flows-through-a-process-from-start-to-finish-3dh3</link>
      <guid>https://dev.to/appmap/go-beyond-static-code-analysis-understand-how-your-data-flows-through-a-process-from-start-to-finish-3dh3</guid>
      <description>&lt;p&gt;A tutorial for process recording for Java with AppMap.&lt;/p&gt;

&lt;p&gt;Once you’ve recorded a process, AppMap allows you to get a bird's eye view of everything going on in a process from start to finish by drilling down into the individual functions and classes. This allows you to understand how data flows through the whole process.&lt;/p&gt;

&lt;p&gt;This article teaches how to set up process recording in Java with AppMap. We will use IntelliJ IDEA and a pet clinic application as the example repo. &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;First, let’s configure.&lt;/strong&gt; &lt;/p&gt;

&lt;p&gt;To do this, we're going to take a look at run configurations. Run configurations are a convenient way to run your application using different environments with different environment variables. In addition, run configurations allow you to set up multiple scenarios or situations your app could run in. &lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Edit your run configuration by adding a specific variable to the virtual machine environment.&lt;/li&gt;
&lt;li&gt;&lt;p&gt;To do that, click on the drop-down in the upper right corner of your editor and select edit configurations.&lt;br&gt;
&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F3510g0mzl5e4h5j639zj.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F3510g0mzl5e4h5j639zj.png" alt="Image description" width="800" height="203"&gt;&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;From here, you should see a field labeled “VM options” under the "build and run" section. The field may be hidden by default, so if you don't see it, select modify options, then under Java, select add "VM options."&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F9xetcjkmqs9a6lrobx3q.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F9xetcjkmqs9a6lrobx3q.png" alt="Image description" width="800" height="446"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;&lt;p&gt;A new field should appear labeled "VM Options," inside of which we are going to place this option:  &lt;code&gt;-Dappmap.recording.auto=true&lt;/code&gt;&lt;br&gt;
&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Foelq9l2qymexgxka3hz1.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Foelq9l2qymexgxka3hz1.png" alt="Image description" width="800" height="521"&gt;&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;strong&gt;Next, let’s start a recording.&lt;/strong&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Select the run configuration you created, and click the "Start with AppMap” button.&lt;/li&gt;
&lt;li&gt;Once the application is running, AppMap will record the process.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;It is not readily apparent, but there is a process recording running. You can verify that by looking at the bottom left-hand corner next to the AppMap logo. You should see a green dot indicating that a recording is active.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Frs6jjggxol0kk188xb2u.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Frs6jjggxol0kk188xb2u.png" alt="Image description" width="800" height="138"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Finally, interact with your application&lt;/strong&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Visit the application running in your browser and use it as you normally would.&lt;/li&gt;
&lt;li&gt;Once you have interacted with your application, press the "Stop" button to end the process.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fr7vn2w2ch3ex0tmr6p31.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fr7vn2w2ch3ex0tmr6p31.png" alt="Image description" width="800" height="221"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The AppMap recording will stop as well. Soon you will see a new recording designated by a number in your list of AppMaps, it will be named by the date.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fqkxmtoatbe21ox7xtuxl.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fqkxmtoatbe21ox7xtuxl.png" alt="Image description" width="551" height="492"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;How to use your maps&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;View your maps, and use them to &lt;a href="https://appmap.io/blog/2023/05/05/how-to-navigate-a-new-codespace-with-appmap/"&gt;navigate to code&lt;/a&gt; and make changes. You may find behavioral and performance issues by opening the runtime analysis option. &lt;a href="https://appmap.io/blog/2023/05/05/automatically-generate-interactive-sequence-diagrams-of-your-java-codes-runtime-behavior/"&gt;Use sequence diagrams&lt;/a&gt;, or &lt;a href="https://appmap.io/blog/2022/12/14/automatically-generating-openapi-docs-for-mastodon-copy/"&gt;generate OpenAPI documentation&lt;/a&gt; based on this new flow.&lt;/p&gt;

&lt;p&gt;Process recording can be done with Python, Javascript, and Ruby as well. Find AppMap in the &lt;a href="https://marketplace.visualstudio.com/items?itemName=appland.appmap"&gt;VS Code marketplace&lt;/a&gt; as well as JetBrains.&lt;/p&gt;

</description>
      <category>java</category>
      <category>webdev</category>
      <category>tutorial</category>
      <category>career</category>
    </item>
    <item>
      <title>How to navigate a new codebase with AppMap</title>
      <dc:creator>Garrett Hamelin</dc:creator>
      <pubDate>Fri, 28 Apr 2023 21:04:28 +0000</pubDate>
      <link>https://dev.to/appmap/-starting-a-new-job-use-appmap-to-navigate-a-new-codebase-377j</link>
      <guid>https://dev.to/appmap/-starting-a-new-job-use-appmap-to-navigate-a-new-codebase-377j</guid>
      <description>&lt;p&gt;In the tech industry, changing jobs feels inevitable. Whether moving on to advance your career or being caught up in an unfortunate layoff. But, eventually, just about everyone will find themselves staring at an unfamiliar code base at some point or time in their career.&lt;/p&gt;

&lt;p&gt;Starting fresh can be both exciting and slightly unnerving. There's often a feeling of: "Oh no, I don't understand any of this" that we know will go away with time, but it can be daunting. &lt;/p&gt;

&lt;p&gt;For me, even if I've worked in the language for several years or I am familiar with the framework, that uncertainty happens. And, the longer I work in the industry, the more I realize I'm not alone. &lt;/p&gt;

&lt;p&gt;There are tons of articles and blogs out there that give steps for how to learn a new codebase quickly, but what if there was a way you could get an overview very quickly to see how things work together? Or a way to show how the features we were responsible for connect to the rest of the application?&lt;/p&gt;

&lt;p&gt;In this article, I will show you an unconventional way to use AppMap, an incredible mapping tool. Rather than using it to map your application to refactor it or fix issues, we will use it to get familiar with a new codebase. &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;To follow along, the example project we are using can be found &lt;a href="https://github.com/spring-projects/spring-petclinic" rel="noopener noreferrer"&gt;here&lt;/a&gt;.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Before we start, here's a brief intro to AppMap.&lt;/p&gt;

&lt;h2&gt;
  
  
  What is AppMap?
&lt;/h2&gt;

&lt;p&gt;AppMap is an open-source tool that automatically generates a visual representation of your code behavior. It allows you to see the relationships between different components, understand how they interact with each other, and identify potential issues.&lt;/p&gt;

&lt;h3&gt;
  
  
  How does it work?
&lt;/h3&gt;

&lt;p&gt;AppMap works by analyzing your code as it runs. It records every method call and visually represents the code flow. This visualization can be used to identify specific areas of code that may need attention or to better understand how the code works.&lt;/p&gt;

&lt;h3&gt;
  
  
  How can I use it?
&lt;/h3&gt;

&lt;p&gt;Using AppMap is easy. &lt;a href="https://plugins.jetbrains.com/plugin/16701-appmap" rel="noopener noreferrer"&gt;Download the AppMap agent&lt;/a&gt; and add it to your Java application. Once the agent is running, it will start recording method calls and generating the visual representation of your code. You can then use this visualization to explore your code base and better understand how it works.&lt;/p&gt;

&lt;h2&gt;
  
  
  Get started learning a new codebase
&lt;/h2&gt;

&lt;p&gt;Let's say we just started at a software company specializing in Veterinary Clinic software. Our software is a Java application that uses the Spring framework, and we are using IntelliJ IDEA for our development environment. We've been given access to the &lt;a href="https://github.com/spring-projects/spring-petclinic" rel="noopener noreferrer"&gt;repo&lt;/a&gt;, have our first ticket, and we need to add a nickname attribute to a pet when it gets created. We have yet to learn what the codebase looks like or how the application works, so let's get started. &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;To follow along, the example project we are using can be found &lt;a href="https://github.com/spring-projects/spring-petclinic" rel="noopener noreferrer"&gt;here&lt;/a&gt;.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;First, pull down the repo and open it inside your IDE. Then, install the AppMap plugin if you haven’t already. Here's a quick &lt;a href="https://appmap.io/docs/reference/jetbrains#start-with-appmap-for-java" rel="noopener noreferrer"&gt;how to&lt;/a&gt; to get you up to speed. Next, install the correct Java versions (I'm using v17), then we will map the application. AppMap's integration with IntelliJ is thorough, and mapping an application is pretty straightforward.&lt;/p&gt;

&lt;h3&gt;
  
  
  To the tests
&lt;/h3&gt;

&lt;p&gt;A mentor once told me: "If you don't know what's going on in a codebase, start with the tests. If there are no tests. Run." &lt;/p&gt;

&lt;p&gt;Starting with tests is a decent strategy and has worked out many times before, so let's map some tests. In the IDE open:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;test &amp;gt; java &amp;gt; org.springframework.samples.petclinic &amp;gt; PetClinicIntegrationTests&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Next, from the three dots menu in the upper right-hand corner near the run button, select &lt;code&gt;Start PetClinicIntegrationTests with AppMap&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F3ux8o00kw9zqf4gnu11h.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F3ux8o00kw9zqf4gnu11h.png" alt="start tests with AppMap"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Open the AppMap plugin by selecting the icon from the right-hand menu bar.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fltnd8hu5zszk09yzte77.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fltnd8hu5zszk09yzte77.png" alt="open AppMap Extension"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;AppMap automatically generates maps for us. If you're following along, you should see two tests. One is for a "find all" action, and one is for "owner details." We can select either to view it. Let's take a look at “owner details.” &lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ffzxzyu2z8tts6b02zolc.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ffzxzyu2z8tts6b02zolc.png" alt="View Test Map"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;This map is great but we need to update the pet, not the owner which isn’t on the list. Let's create another map and see if we can learn more about our application.&lt;/p&gt;

&lt;h3&gt;
  
  
  Recording application interactions
&lt;/h3&gt;

&lt;p&gt;The best way to learn an application and how it works is to use it, so let's actually use it. While we use the application, we will record what we do in the app with AppMap.&lt;/p&gt;

&lt;p&gt;To do this, start the application with AppMap. In IntelliJ, open&lt;/p&gt;

&lt;p&gt;&lt;code&gt;src &amp;gt; main &amp;gt; java &amp;gt; org.springframework.samples.petclinic &amp;gt; PetClinicApplication.&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Next, we will start the application the same way we did when mapping tests, but this time select &lt;code&gt;"Start PetClinicAppliactaion with AppMap."&lt;/code&gt; &lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F2bmzxk1xqvfmdfa44kx6.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F2bmzxk1xqvfmdfa44kx6.png" alt="Start App with AppMap"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;From the AppMap plugin menu, click the round gray record button in the upper right-hand corner. &lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fsk6peiewrmgbl2h6xjgk.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fsk6peiewrmgbl2h6xjgk.png" alt="Start Recording"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;A pop-up menu should appear, select the remote URL from the drop-down menu and click start recording. &lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F07tm8rvjjknal9l0c8wz.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F07tm8rvjjknal9l0c8wz.png" alt="Remote URL"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The pet clinic application should open a new tab in your browser with the application running; if it does not, open a browser and navigate to the remote URL you selected. If you're following along, the remote URL is&lt;/p&gt;

&lt;p&gt;&lt;code&gt;http://localhost:8080/&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;Now that the application is running, we can start using it. First, let's add an owner. Select find owners and then click the "Add Owner" button.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Flqste9coxdg8v1c40fax.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Flqste9coxdg8v1c40fax.png" alt="Add Owner"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Fill out the form with whatever data you would like and add the owner. &lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fxavajwrw37ad43utn5hx.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fxavajwrw37ad43utn5hx.png" alt="Owner"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;On the next screen, select "Add Pet" fill in the details, and add the pet.  &lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fhajxl3234xm08e3hde0x.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fhajxl3234xm08e3hde0x.png" alt="Add Pet"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Once we have added a pet successfully, we will see this screen. &lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fj4hu2de2vbddu9plec4s.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fj4hu2de2vbddu9plec4s.png" alt="Pet Added"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Let's head back to our IDE and stop the recording by selecting the grey square button in the AppMap plugin menu. &lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fsnx7ux6rlw5g1rm6cbz3.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fsnx7ux6rlw5g1rm6cbz3.png" alt="Stop Recording"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;A new pop-up should appear. Let's name our map "add pet" and select stop recording.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fl8fbfpxtgva913hn90do.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fl8fbfpxtgva913hn90do.png" alt="Name Map"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Congrats, you just generated your first map. &lt;/p&gt;

&lt;p&gt;It takes a moment for AppMap to process, then once complete, you should see the new map open in your IDE. The map itself is stored locally in a tmp folder in the root directory of your project.  &lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fa0yvfleqxhk7lmupfufi.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fa0yvfleqxhk7lmupfufi.png" alt="Add Pet Map"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The default view is a sequence diagram of the entire process we just went through. The sequence diagram is the heart of an AppMap and tells you exactly what happened from start to finish. The &lt;a href="https://appmap.io/docs/diagrams/sequence-diagrams.html" rel="noopener noreferrer"&gt;sequence diagram view&lt;/a&gt; is one of the most useful views you can look at and it gives a ton of detail about the app. If you have never used one, take the time to &lt;a href="https://appmap.io/docs/diagrams/how-to-use-appmaps.html#using-the-sequence-diagram-view" rel="noopener noreferrer"&gt;learn about&lt;/a&gt; them and what they do. &lt;/p&gt;

&lt;p&gt;There are many ways to take advantage of this view in the future, but for this example, we are looking for a more general view of the application. There are two other map views you can look at that give more insight into what is happening in your application under the hood and how everything is connected. Each can be viewed by clicking the tabs at the top of the AppMap view. They are the &lt;a href="https://appmap.io/docs/diagrams/how-to-use-appmaps.html#view-and-interact-with-the-trace-diagram" rel="noopener noreferrer"&gt;trace view&lt;/a&gt; and &lt;a href="https://appmap.io/docs/diagrams/how-to-use-appmaps.html#view-and-interact-with-the-dependency-map" rel="noopener noreferrer"&gt;dependency map&lt;/a&gt;.&lt;/p&gt;

&lt;h3&gt;
  
  
  Making updates with AppMap
&lt;/h3&gt;

&lt;p&gt;These views are great, but if you can't use them to your advantage, they are just cool pictures. With that in mind let's use them. The real power of your maps comes from recording interactions and being able to follow connections from one part of your application to another. &lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F6lqx5pfsyr0cpk8k57n7.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F6lqx5pfsyr0cpk8k57n7.png" alt="Dependency Map"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;First, open the dependency map and click the plus buttons to expand the colored boxes until you see the owner controller. When you click on the PetController, the left-side menu will update. This menu lists functions, inbound connections,  queries, and the file path to the PetController. We can even see the creation form we need to change. &lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fsjccii4kfwutuwug86a0.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fsjccii4kfwutuwug86a0.png" alt="Dependency Map Expanded"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;We can open the controller to change it right from here. We click the open in a new tab icon in the file path box, or we can click on the function we want to change, then the open icon and your controller will open. We can make any edits, commit, and push. Plus, we can export the sequence diagram of the new behavior as an SVG and &lt;a href="https://docs.github.com/en/get-started/writing-on-github/working-with-advanced-formatting/attaching-files" rel="noopener noreferrer"&gt;attach it to our pull request&lt;/a&gt; for our team to check over which helps them understand my new code as well. &lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fem7cvp9ymg0vrmrs7tx9.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fem7cvp9ymg0vrmrs7tx9.png" alt="Export SD"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Now, we completed our first ticket without digging through hours of documentation and directories to find what you were looking for! We found the controller we needed to work on, understand how it works, understand what it's connected to, and made a change. The more we view and study these maps, the better we will know how they work and are connected.&lt;/p&gt;

&lt;h2&gt;
  
  
  Summary
&lt;/h2&gt;

&lt;p&gt;Starting a new job can be daunting, but with the help of AppMap, you can quickly get up to speed and easily navigate any new codebase. &lt;/p&gt;

&lt;p&gt;Whether you're a seasoned developer or just starting, AppMap is a valuable tool to have in your arsenal. &lt;a href="https://appmap.io/download" rel="noopener noreferrer"&gt;Try it out today&lt;/a&gt; and see how it can help you become more productive and efficient in your new role.&lt;/p&gt;

&lt;p&gt;Check out some other amazing things AppMap can do like OpenAPI documentation generation or runtime analysis on the &lt;a href="https://appmap.io/docs/analysis" rel="noopener noreferrer"&gt;AppMap Documentation&lt;/a&gt;. If you find something awesome or use it in an exciting way I’d love to hear about it. I always hang out in the AppMap community Slack and am stoked to hear people's stories.&lt;/p&gt;

</description>
      <category>java</category>
      <category>webdev</category>
      <category>tutorial</category>
      <category>career</category>
    </item>
  </channel>
</rss>
