Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Instrumenting Analytics

bencodeorg edited this page Jul 8, 2020 · 2 revisions

We measure site health and activity using a few different tools:

  • Redshift is where we track Key Performance Indicators and analyze learning outcomes.
  • Google Analytics we use for simple event counting and traffic.
  • CloudWatch is for application- and infrastructure-layer health indicators.

Redshift and Google Analytics are product tools. Work with your PM to decide whether Redshift or Google Analytics are right for your feature.

CloudWatch is an engineering tool. Use it when instrumenting a site-health metric, or one that should be able to trigger a PagerDuty alert.

Redshift

Redshift is used for tracking Key Performance Indicators and learning outcomes. It's also the only service where we correlate gathered analytics with DB data. We send events directly to Redshift via Firehose. See the wrapper classes for documentation and example code.

Google Analytics

In JavaScript, you can use the function trackEvent (Example) to report an event to Google Analytics. For more information, see the ga.js docs on event tracking.

Testing your Google Analytics call

  1. Install the Google Analytics debugger
  2. Test locally
  3. Look for the analytics call in the Chrome debugger

CloudWatch

CloudWatch should be used for recording application- and infrastructure-layer metrics in cases where we want to be able to monitor and alert based on the metric's value over time. In Ruby, use Aws::CloudWatch::Client.new.put_metric_data (Example) to record a custom metric.

If you create metrics for CloudWatch, you'll probably want to add them to one of the dashboards that we look at there, and possibly configure alarms around that metric - otherwise there are so many tracked that nobody will ever notice yours.


We've also sent metrics to these places in the past:

New Relic

New Relic was used for recording application-layer metrics in cases where we want to be able to monitor and alert based on the metric's value over time. An example alerting rule based on metrics can be seen here: FilesApi policy.

New Relic has separate APIs for recording "events" and "metrics." It's a little hard to find good resources on the distinction; this thread may be helpful. We plan to sunset New Relic "custom events" by saving them instead to Redshift.

Clone this wiki locally

Morty Proxy This is a proxified and sanitized view of the page, visit original site.