Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Migrated to Confluence 4.0

...

The CloudWatchProfiler uses AmazonWebServices' CloudWatch feature to store latency information about the DefaultController.  When turned on it, it tracks how long each method in the DefaultController takes to complete.  These latency times are collected anytime a method in the DefaultController is used, and periodically sent in the form of "metrics" to CloudWatch.  Each metric has a name representing the DefaultController method used, a value representing that method's latency in milliseconds, and a timestamp representing when that method was called.  The CloudWatchController can be turned on and off, and the trigger time for how often the batches are sent to CloudWatch can be modified.

The metrics go to the Sage Bionetworks team account found at https://console.aws.amazon.com/cloudwatch/home?region=us-west-1

...

CloudWatch allows you to view the metrics via a line chart.  You can observe the metrics via in different time periods, allowing you to zoom in, and you .  You can view the metrics individually or in the form of statistics per a time period in the form of representing an average, minimum, maximum, sum, or sample count.  CloudWatch holds metric information for two weeks after they arrivearrival time.

Location

The CloudWatch profiler code can be found in the services-repository project under the profiler.org.sagebionetworks.cloudwatch package.

How To Turn On/Off

To turn the CloudWatchProfiler on, go to the lib-stackConfiguration project.  Under src/main/resources locate the stack.properties.xml file.  Turn "org.sagebionetworks.cloud.watch.report.enables=true" to turn on.

To turn CloudWatchProfiler off, stack.properties should match below example.

#AmazonWebServices CloudWatch Profiler
org.sagebionetworks.cloud.watch.report.enabled=false

How Often Should It Fire?

To adjust how often the CloudWatchProfiler sends batches of metrics to CloudWatch, go to the lib-stackConfiguation project.  Under Under src/main/resources locate the stack.properties.xml file.  The "org.sagebionetworks.coud.watch.trigger= " can be sent to a period of time in milliseconds.

To set to default trigger time of one minute (60,000 milliseconds) stack.properties should match below example.

#AmazonWebServices CloudWatch Profiler's Trigger time in milliseconds
org.sagebionetworks.cloud.watch.trigger=60000

How To Modify/Expand

The CloudWatchProfiler uses Spring AOP to collect the latency information.  It can be expanded or modified to work in a different location.  See the Services-repository project.  Under the profiler.org.sagebionetworks.cloudwatch package, locate the ControllerProfiler.java class.  The critical method is the doBasicProfiling.  See the @Around line above the doBasicProfiling method to look into adjusting/modifying which package it collects latency information for.  It currently reads per the below line, but the "around" can be modified to another class, or package, etc.

@Around("execution(* org.sagebionetworks.repo.web.controller.DefaultController.*(..))")

The "namespace" will always be the package name, and the "metric" names will automatically be set to the method names under the class.