<?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: Karthikeyan Sadayamuthu</title>
    <description>The latest articles on DEV Community by Karthikeyan Sadayamuthu (@sadayamuthu).</description>
    <link>https://dev.to/sadayamuthu</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%2F290625%2Fd375a452-b11f-4916-a588-f803c8a83e45.jpg</url>
      <title>DEV Community: Karthikeyan Sadayamuthu</title>
      <link>https://dev.to/sadayamuthu</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/sadayamuthu"/>
    <language>en</language>
    <item>
      <title>LogMetrics framework for Microservices (Python) — part 2</title>
      <dc:creator>Karthikeyan Sadayamuthu</dc:creator>
      <pubDate>Thu, 10 Sep 2020 02:56:23 +0000</pubDate>
      <link>https://dev.to/devxchange/logmetrics-framework-for-microservices-python-part-2-caa</link>
      <guid>https://dev.to/devxchange/logmetrics-framework-for-microservices-python-part-2-caa</guid>
      <description>&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--rPXMegYI--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/q7b59wz94vu2oioyhxbo.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--rPXMegYI--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/q7b59wz94vu2oioyhxbo.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;LogMetrics provides simplified configuration to log payload for python flask projects.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Pypi Package&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;code&gt;https://pypi.org/project/logmetrics-sdk/&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--Z3BCJ99_--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/ys08mj52p26eeu1xw2y1.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--Z3BCJ99_--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/ys08mj52p26eeu1xw2y1.png" alt="1*pfTVSJz2mdxOGDR-VmbHwQ"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Install Dependencies&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;code&gt;pip install logmetrics-sdk&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Properties&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;enable_logmetrics= True
enable_frontend_request= True
enable_frontend_response= True
enable_backend= True
enable_backend_request= True
enable_backend_response= True
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Usage — Python Flask Projects&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;from logmetrics_sdk.logmetrics import LogMetrics

@app.route('/todo/api/v1/tasks', methods=['GET'])
@LogMetrics(enable_logmetrics=True,
            enable_frontend_request=True,
            enable_frontend_response=True,
            enable_backend=True,
            enable_backend_request=True,
            enable_backend_response=True)
def get_tasks():
    return jsonify(tasks)
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;LogMetrics Schema&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "LogMetrics",
  "properties": {
    "Node": {
      "type": "string",
      "description": "Application Host IP Address"
    },
    "MessageType": {
      "type": "string",
      "description": "Logmetrics message type",
      "value": "LOGMETRICS_MESSAGE"
    },
    "Duration": {
      "type": "integer",
      "description": "Response time of the API"
    },
    "Host": {
      "type": "string",
      "description": "Application Host Name"
    },
    "Fault": {
      "type": "boolean",
      "description": "API Success or Failed status "
    },
    "Method": {
      "type": "string",
      "description": "API Method name"
    },
    "ResponseBody": {
      "type": "string",
      "description": "API Response Body"
    },
    "StartDateTime": {
      "type": "string",
      "description": "API Start Time"
    },
    "EndDateTime": {
      "type": "string",
      "description": "API End time"
    },
    "HttpMethod": {
      "type": "string",
      "description": "Http Method Type"
    },
    "RequestBody": {
      "type": "string",
      "description": "API Request Body"
    }
  }
}
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Sample logmetrics message&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;{
  "Node": "127.0.0.1",
  "MessageType": "LOGMETRICS_MESSAGE",
  "Duration": 106,
  "Host": "hostname",
  "Fault": false,
  "Method": "/user-service/api/v1/user/{id}",
  "ResponseBody": "{\"id\":1,\"name\":\"02adcec2263d2127269fcd769c33f029\",\"age\":\"35135aaa6cc23891b40cb3f378c53a17a1127210ce60e125ccf03efcfdaec458\",\"salary\":\"********\"}",
  "StartDateTime": "Tue Nov 26 23:22:54 EST 2019",
  "EndDateTime": "Tue Nov 26 23:22:54 EST 2019",
  "HttpMethod": "GET",
  "RequestBody": ""
}
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Release History&lt;/strong&gt;&lt;/p&gt;

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

&lt;ul&gt;
&lt;li&gt;logging rest verb &amp;amp; payload to console.&lt;/li&gt;
&lt;li&gt;feature to enable/disable payload logging&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Demo Project&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://github.com/devxchangeio-blog/logmetrics-python-demo"&gt;LINK&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Want to Contribute to LogMetrics framework?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://github.com/devxchangeio/logmetrics-python"&gt;LINK&lt;/a&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Fork it!&lt;/li&gt;
&lt;li&gt;Create your feature branch: git checkout -b my-new-feature&lt;/li&gt;
&lt;li&gt;Commit your changes: git commit -am 'Add some feature'&lt;/li&gt;
&lt;li&gt;Push to the branch: git push origin my-new-feature&lt;/li&gt;
&lt;li&gt;Submit a pull request :D&lt;/li&gt;
&lt;/ol&gt;

</description>
      <category>python</category>
      <category>flask</category>
      <category>logmetrics</category>
      <category>devxchange</category>
    </item>
    <item>
      <title>LogMetrics framework for Microservices (Java)— part 1</title>
      <dc:creator>Karthikeyan Sadayamuthu</dc:creator>
      <pubDate>Fri, 28 Aug 2020 21:17:39 +0000</pubDate>
      <link>https://dev.to/devxchange/logmetrics-framework-for-microservices-spring-part-1-56eb</link>
      <guid>https://dev.to/devxchange/logmetrics-framework-for-microservices-spring-part-1-56eb</guid>
      <description>&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--rPXMegYI--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/q7b59wz94vu2oioyhxbo.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--rPXMegYI--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/q7b59wz94vu2oioyhxbo.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;LogMetrics Framework provides simplified configuration to log payload and metrics data.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Maven Repo&lt;/strong&gt;&lt;br&gt;
&lt;code&gt;maven { url "https://dl.bintray.com/m2/release/"}&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Dependencies&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;compile ("io.devxchange:logmetrics:0.0.2")
Enable logmetrics — Add below property to your application.properties file
logmetrics.logging.enabled=true
logmetrics.logging.request.enabled=true
logmetrics.logging.response.enabled=true
logmetrics.logging.obfuscate.enabled=false
logmetrics.logging.obfuscate.md5.fields= #comma seperated fields
logmetrics.logging.obfuscate.sha256.fields= #comma seperated fields
logmetrics.logging.obfuscate.fields= #comma seperated fields
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;SpringBoot Application&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;@SpringBootApplication
@ComponentScan(basePackages = { "io.devxchange.logmetrics.demo", "io.devxchange.logmetrics" })
public class LoggingDemoApplication {

   public static void main(String[] args) {
      SpringApplication.run(LoggingDemoApplication.class, args);
   }
}
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Injecting the LogWriterManager &amp;amp; adding Interceptors&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;@Configuration
@EnableWebMvc
public class AppConfig extends WebMvcConfigurerAdapter {

   @Autowired
   @Qualifier("manager.logwriter")
   private LogWriterManager logWriterManager;

   @Override
   public void addInterceptors(InterceptorRegistry registry) {
      registry.addInterceptor(new FrontendRestInterceptor(logWriterManager));
   }
}
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;LogMetrics json schema&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "LogMetrics",
  "properties": {
    "Node": {
      "type": "string",
      "description": "Application Host IP Address"
    },
    "message_type": {
      "type": "string",
      "description": "Logmetrics message type",
      "value": "LOGMETRICS_MESSAGE"
    },
    "Duration": {
      "type": "integer",
      "description": "Response time of the API"
    },
    "Host": {
      "type": "string",
      "description": "Application Host Name"
    },
    "Fault": {
      "type": "boolean",
      "description": "API Success or Failed status "
    },
    "Method": {
      "type": "string",
      "description": "API Method name"
    },
    "ResponseBody": {
      "type": "string",
      "description": "API Response Body"
    },
    "StartDateTime": {
      "type": "string",
      "description": "API Start Time"
    },
    "EndDateTime": {
      "type": "string",
      "description": "API End time"
    },
    "HttpMethod": {
      "type": "string",
      "description": "Http Method Type"
    },
    "RequestBody": {
      "type": "string",
      "description": "API Request Body"
    }
  }
}
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;sample logmetrics message&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;{
  "Node": "127.0.0.1",
  "message_type": "LOGMETRICS_MESSAGE",
  "Duration": 106,
  "Host": "hostname",
  "Fault": false,
  "Method": "/user-service/api/v1/user/{id}",
  "ResponseBody": "{\"id\":1,\"name\":\"02adcec2263d2127269fcd769c33f029\",\"age\":\"35135aaa6cc23891b40cb3f378c53a17a1127210ce60e125ccf03efcfdaec458\",\"salary\":\"********\"}",
  "StartDateTime": "Tue Nov 26 23:22:54 EST 2019",
  "EndDateTime": "Tue Nov 26 23:22:54 EST 2019",
  "HttpMethod": "GET",
  "RequestBody": ""
}
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Demo Project&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--tAWcGL0p--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_66%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/bbt10shsnyxd2ohp4ree.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--tAWcGL0p--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_66%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/bbt10shsnyxd2ohp4ree.gif" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://github.com/devxchangeio-blog/logmetrics-java-demo"&gt;LINK&lt;/a&gt;&lt;/p&gt;

</description>
      <category>java</category>
      <category>spring</category>
      <category>logmetrics</category>
      <category>devxchange</category>
    </item>
  </channel>
</rss>
