<?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: Anton4J</title>
    <description>The latest articles on DEV Community by Anton4J (@antuanrokanten).</description>
    <link>https://dev.to/antuanrokanten</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%2F508840%2F450a0e61-beb5-43fe-80de-a6375afdf6be.jpeg</url>
      <title>DEV Community: Anton4J</title>
      <link>https://dev.to/antuanrokanten</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/antuanrokanten"/>
    <language>en</language>
    <item>
      <title>Monitor application errors with Sentry</title>
      <dc:creator>Anton4J</dc:creator>
      <pubDate>Sun, 20 Dec 2020 17:19:32 +0000</pubDate>
      <link>https://dev.to/antuanrokanten/monitor-application-errors-with-sentry-2i2d</link>
      <guid>https://dev.to/antuanrokanten/monitor-application-errors-with-sentry-2i2d</guid>
      <description>&lt;h4&gt;
  
  
  How do you handle your application errors/exceptions❓
&lt;/h4&gt;

&lt;p&gt;This is a question I often ask my colleagues. Surprisingly, but half of them answer that they have no dedicated procedure for such situations. That means that until customers contact the support and report the problem, they will be unaware of any issues. No need to mention that from a business perspective that might lead to customer loss. &lt;/p&gt;

&lt;p&gt;Ask yourself this question and if you find that you fall into the same category, you might consider taking some actions&lt;/p&gt;

&lt;h1&gt;
  
  
  Sentry to the rescue❕
&lt;/h1&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%2Fstatic0.cbrimages.com%2Fwordpress%2Fwp-content%2Fuploads%2F2020%2F01%2Fsentry-powerful-pose-10-worst-things-sentry-has-done-in-marvel-comics.jpg%3Fq%3D50%26fit%3Dcrop%26w%3D960%26h%3D500" 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%2Fstatic0.cbrimages.com%2Fwordpress%2Fwp-content%2Fuploads%2F2020%2F01%2Fsentry-powerful-pose-10-worst-things-sentry-has-done-in-marvel-comics.jpg%3Fq%3D50%26fit%3Dcrop%26w%3D960%26h%3D500" alt="Marvel's Sentry"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Sentry is a tool that takes application crashes and exceptions as first-class citizens, allowing you to manage the full crash lifecycle: from its occurrence till releasing a new version with the fix applied. &lt;/p&gt;

&lt;p&gt;Sentry developers follow open-source philosophy, so you can run an instance on your premise. This option might come in handy if your application is highly secured or not allowed to access anything outside the private network. To simplify the deployment of Sentry, you can utilize the &lt;a href="https://hub.docker.com/_/sentry" rel="noopener noreferrer"&gt;Docker image&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;On the other hand, you might purchase a license and put off your shoulders the burden of supporting infrastructure.&lt;/p&gt;

&lt;h2&gt;
  
  
  Integration
&lt;/h2&gt;

&lt;p&gt;Sentry claims to support 88 platforms. Here is how you can integrate Sentry into a Java application.&lt;/p&gt;

&lt;p&gt;Your first step will be to register a new application on Sentry and obtain Data Source Name (DSN), which effectively the only required configuration property.&lt;/p&gt;

&lt;h3&gt;
  
  
  Manual integration
&lt;/h3&gt;

&lt;p&gt;Although this integration option will require manual configuration as well as manual error push, you get full control of the process. With this option, it's up to you what data you would like to see in the error details on Sentry.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Sentry.init();
...
try {
     method()
} catch (Exception e) {
     Sentry.capture(e);
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Logger integration
&lt;/h3&gt;

&lt;p&gt;If you use Log4j2 or Logback logger, you have an option to integrate it into the logger configuration. Just describe the appender for error level and all error log events will be posted to Sentry&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;configuration&amp;gt;

    &amp;lt;appender name="Sentry" class="io.sentry.logback.SentryAppender"&amp;gt;
        &amp;lt;options&amp;gt;
            &amp;lt;dsn{{SENTRY_DSN}}&amp;lt;/dsn&amp;gt;
        &amp;lt;/options&amp;gt;
    &amp;lt;/appender&amp;gt;

    &amp;lt;root level="ERROR"&amp;gt;
...
        &amp;lt;appender-ref ref="Sentry" /&amp;gt;
    &amp;lt;/root&amp;gt;
&amp;lt;/configuration&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Sprin Boot integration
&lt;/h3&gt;

&lt;p&gt;Like many other modules pluggable into Spring, Sentry provides its own starter bundle, named &lt;code&gt;sentry-spring-boot-starter&lt;/code&gt;. After including defining &lt;code&gt;sentry.dsn&lt;/code&gt; property value, you are ready to post error data with &lt;code&gt;Sentry.captureException(e)&lt;/code&gt;&lt;/p&gt;

&lt;h1&gt;
  
  
  Interface
&lt;/h1&gt;

&lt;p&gt;Although to my eye Sentry interface looks a bit overloaded with features, it starts growing on you over time. After several days of usage, you will grasp its essential features.&lt;br&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%2Fi%2Ficxxairgww0kcxaidibq.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%2Fi%2Ficxxairgww0kcxaidibq.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h1&gt;
  
  
  Conclusion
&lt;/h1&gt;

&lt;p&gt;Sentry is a great tool for monitor errors on any application stage. If this brief overview caught your interest, make sure to check out the &lt;a href="https://blog.sentry.io/" rel="noopener noreferrer"&gt;official blog&lt;/a&gt; for a lot more details.&lt;/p&gt;

</description>
      <category>monitoring</category>
      <category>java</category>
      <category>android</category>
      <category>webdev</category>
    </item>
    <item>
      <title>Why you shouldn't use AWS API Gateway HTTP API</title>
      <dc:creator>Anton4J</dc:creator>
      <pubDate>Sun, 08 Nov 2020 18:48:28 +0000</pubDate>
      <link>https://dev.to/antuanrokanten/why-you-shouldn-t-use-aws-api-gateway-http-api-c3h</link>
      <guid>https://dev.to/antuanrokanten/why-you-shouldn-t-use-aws-api-gateway-http-api-c3h</guid>
      <description>&lt;p&gt;Less than a year passed since &lt;a href="https://aws.amazon.com/blogs/compute/announcing-http-apis-for-amazon-api-gateway/"&gt;AWS announced&lt;/a&gt; a new API type for API Gateway, namely HTTP API. Here I'd like to share my experience with HTTP API utilization. &lt;/p&gt;

&lt;p&gt;Since &lt;a href="https://docs.aws.amazon.com/apigateway/latest/developerguide/welcome.html"&gt;AWS API Gateway&lt;/a&gt; has proved its efficiency (especially in serverless architecture), numerous projects adopted this AWS service. Following developers' requests, AWS gave us a chance to have a lighter experience with gateways configurations and support. &lt;/p&gt;

&lt;p&gt;But did AWS cut off some of the useful features pursuing simplicity? In my opinion yes. Here are some of them:&lt;/p&gt;

&lt;h3&gt;
  
  
  1. Pass static data to API target
&lt;/h3&gt;

&lt;p&gt;HTTP API Gateway has cut off the requests modifications on the way from a user to a target. And it seems to be a reasonable simplification. However, it would be very useful to have a way to pass some static data to the target.&lt;/p&gt;

&lt;p&gt;For example imagine a scenario, when a target expects an HTTP header which will authorize a request as a one coming from API Gateway. Original API Gateway allowed certification authorization. But this feature is also gone for HTTP APIs.&lt;/p&gt;

&lt;h3&gt;
  
  
  2. Restrict access to API with policies
&lt;/h3&gt;

&lt;p&gt;Resource policies when applied to API is a great tool for controlling access to the API. It gives the possibility for granular access definition. With several lines with configuration code, we can define which CIDR blocks, VPCs, or AWS accounts are allowed to send requests to the API.&lt;/p&gt;

&lt;p&gt;For HTTP APIs it's not available. We are left to JWT, AWS Lambda, or IAM authorizers. They do the job with flying colors, but useless when access should be allowed only for a defined set of IP addresses.&lt;/p&gt;

&lt;h3&gt;
  
  
  3. AWS CLI interoperability
&lt;/h3&gt;

&lt;p&gt;If you rely on AWS CLI for configurations, you will need to use a new V2 namespace for HTTP APIs. This might look like a pretty minor thing, but for me, it is not.&lt;/p&gt;

&lt;p&gt;I rely on IaC modules for setting up an infrastructure. I use Terraform as an engine. With an introduction of the new CLI version, you cannot start using HTTP API just by updating the type attribute in the module definition. You need to describe your API anew.&lt;/p&gt;

&lt;h3&gt;
  
  
  4. Linking to Load Balancer
&lt;/h3&gt;

&lt;p&gt;To access resources inside a private VPC, a VPC link needs to be defined. Only Application Load Balancers are supported for it. On the other hand, REST API Gateway type can be linked only to Network Load Balancer, which operates on a lower level of OSI model.&lt;/p&gt;

&lt;p&gt;If you have NLB already defined, you won't be able to utilize it. &lt;/p&gt;

&lt;h3&gt;
  
  
  5. Usage plans
&lt;/h3&gt;

&lt;p&gt;Original API Gateway allows configuring usage plans based on a key. You can issue an API key, defined a quota for it, and be sure that the key holder will not abuse your API. That's also not available for HTTP API.&lt;/p&gt;




&lt;p&gt;Now let's take a look at some of the pros for HTTP APIs:&lt;/p&gt;

&lt;h3&gt;
  
  
  1. It's easy to use
&lt;/h3&gt;

&lt;p&gt;To start with HTTP API Gateway, you just need to define a root and integration for it. That's it, you are good to go. No need to define integration requests, responses, etc.&lt;/p&gt;

&lt;h3&gt;
  
  
  2. It's cheaper
&lt;/h3&gt;

&lt;p&gt;One of the most important selling points for HTTP API presented by Amazon is price:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Most customers will see an average cost saving up to 70%.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;If your API is a simple one or you use API Gateway for prototyping, then I would definitely recommend HTTP API. &lt;br&gt;
For production-grade APIs I decided to stick with the original type of API Gateway. &lt;/p&gt;

&lt;p&gt;What is your opinion on that?&lt;/p&gt;

</description>
      <category>aws</category>
      <category>cloud</category>
      <category>serverless</category>
      <category>http</category>
    </item>
  </channel>
</rss>
