SlideShare a Scribd company logo
1 of 58
Insight without Interference
Monitoring with Scala, Swagger, MongoDB and Wordnik OSS
                       Tony Tam
                       @fehguy
Nagios Dashboard
Monitoring?

 Disk                    Host
Space                   Checks


          IT Ops 101
                        System
Network                  Load
Monitoring?

 Disk                           Host
Space                          Checks

            Necessary
          (but insufficient)
                               System
Network                         Load
Why Insufficient?

• What about Services?
 •   Database running?
 •   HTTP traffic?
• Install Munin Node!
 •   Some (good) service-level insight
Your boss    “OH pretty
   LOVES charts    colors!”



                     “up and
                      to the
 “it MUST             right!”
     be
important!”
Good vs. Bad?

• Database calls avg 1ms?
 •   Great! DB working well
 •   But called 1M times per page load/user?
• Most tools are for system, not your app
• By the time you know, it’s too late
                Need business
                   metrics
                 monitoring!
Enter APM

• Application Performance Monitoring
• Many flavors, degrees of integration
 •   Heavy: transaction monitoring, code performance,
     heap, memory analysis
 •   Medium: home-grown profiling
 •   Light: digest your logs (failure forensics)
• What you need depends on architecture,
  business + technology stage
APM @ Wordnik

• Micro Services make the System



       Monolithic
       application
APM @ Wordnik

• Micro Services make the System
                           API Calls
                          are the unit
                            of work!

       Monolithic
       application
Monitoring API Calls

• Every API must be
  profiled
• Other logic as needed
 •   Database calls
 •   Connection manager
 •   etc...
• Anything that might
  matter!
How?

• Wordnik-OSS Profiler for Scala
  •   Apache 2.0 License, available in Maven Central
• Profiling Arbitrary code block:
import com.wordnik.util.perf.Profile
Profile("create a cat", {/* do something */})

• Profiling an API call:
Profile("/store/purchase", {/* do something */})
Profiler gives you…

• Nearly free*** tracking
• Simple aggregation
• Trigger mechanism
  •   Actions on time spent “doing things”:

Profile.triggers += new Function1[ProfileCounter, Unit] {
  def apply(counter: ProfileCounter): Unit = {
    if (counter.name == "getDb" && counter.duration > 5000)
      wakeUpSysAdminAndEveryoneWhoCanFixShit(Urgency.NOW)
    return counter
  }
}
Profiler gives you…

• Nearly free*** tracking
• Simple aggregation
• Trigger mechanism
  •   Actions on time spent “doing things”:

Profile.triggers += new Function1[ProfileCounter, Unit] {
  def apply(counter: ProfileCounter): Unit = {
    if (counter.name == "getDb" && counter.duration > 5000)
      wakeUpSysAdminAndEveryoneWhoCanFixShit(Urgency.NOW)
   This is intrusive
    return counter
  }
}
       on your
     codebase
Accessing Profile Data

• Easy to get in code
       ProfileScreenPrinter.dump




• Output where you want
  logger.info(ProfileScreenPrinter.toString)

• Send to logs, email, etc.
Accessing Profile Data

• Easier to get via API with Swagger-JAXRS
import com.wordnik.resource.util

@Path("/activity.json")
@Api("/activity")
@Produces(Array("application/json"))
class ProfileResource extends ProfileTrait
Accessing Profile Data
Accessing Profile Data




                 Inspect
                 without
                 bugging
                  devs!
Is Aggregate Data Enough?

• Probably not
• Not Actionable
 •   Have calls increased? Decreased?
 •   Faster response? Slower?
Make it Actionable

    • “In a 3 hour window, I expect 300,000
      views per server”
      •   Poll & persist the counters

{
      •   Example: Log page views, every min
      "_id" : "web1-word-page-view-20120625151812",
      "host" : "web1",
      "count" : 627172,
      "timestamp" : NumberLong("1340637492247")
},{
      "_id" : "web1-word-page-view-20120625151912",
      "host" : "web1",
      "count" : 627372,
      "timestamp" : NumberLong("1340637552778")
}
Make it Actionable
Make it Actionable


              Your boss
            LOVES charts
That’s not Actionable!

• Custompretty
  But it’s
   Time                         APIs to
  window                        track?
             What’s missing?


Too much                       Low + High
 custom                        Watermark
Engineerin                         s
    g
That’s not Actionable!

Custom
 Time                             APIs to
window                            track?

              Call to Action!

 Too much                       Low + High
  custom                        Watermarks
Engineering
Make it Actionable

• Swagger + a      tiny   bit of engineering
 •   Let your *product* people create monitors, set
     goals
• A Check: specific API call mapped to a
  service function
 {
     "name": "word-page-view",
     "path": "/word/*/wordView (post)",
     "checkInterval": 60,
     "healthSpan": 300,
     "minCount": 300,
     "maxCount": 100000
 }
Make it Actionable

• A Service Type: a collection of checks
  which make a functional unit
  {
          "name": "www-api",
          "checks": [
            "word-of-the-day",
            "word-page-view",
            "word-definitions",
            "user-login",
            "api-account-signup",
            "api-account-activated"
          ]
      }
Make it Actionable

• A Host: “directions” to get to the checks
{
  "host": "ip-10-132-43-114",
  "path": "/v4/health.json/profile?api_key=XYZ",
  "serviceType": "www-api”
},
{
  "host": "ip-10-130-134-82",
  "path": "/v4/health.json/profile?api_key=XYZ",
  "serviceType": "www-api”
}
Make it Actionable

• And finally, a simple GUI
Make it Actionable

• And finally, a simple GUI
Make it Actionable

• Point Nagios at this!
serviceHealth.json/status/www-
api?explodeOnFailure=true        Metrics from
                                  Product
• Get a 500, get an alert

        Treat like                Based on
         system                   YOUR app
         failure
Make it Actionable
Is this Enough?

System monitoring
Aggregate monitoring
Windowed monitoring
Object monitoring?
 •   Action on a specific event/object


                               Why!?
Object-level Actions

• Any back-end engineer can build this
 •   But shouldn’t
• ETL to a cube?
• Run BI queries against production?
• Best way to “siphon” data from production
  w/o intrusive engineering?
Avoiding Code Invasion

• We use MongoDB everywhere
• We use > 1 server wherever we use
  MongoDB
• We have an opLog record against
  everything we do
What is the OpLog

• All participating members have one
• Capped collection of all write ops        t3

                  time

 t0         t1                         t2
        primary replica    replica
So What?

• It’s a “pseudo-durable global topic
  message bus” (PDGTMB)
  •   WTF?
• All DB transactions in there
• It’s persistent (cyclic collection)
• It’s fast (as fast as your writes)
• It’s non-blocking
• It’s easily accessible
More about this
{
    "ts" : {
         "t" : 1340948921000, "i" : 1
    },
    "h" : NumberLong("5674919573577531409"),
    "op" : "i",
    "ns" : "test.animals",
    "o" : {"_id" : "fred", "type" : "cat"
    }
}, {
    "ts" : {
         "t" : 1340948935000, "i" : 1
    },
    "h" : NumberLong("7701120461899338740"),
    "op" : "i",
    "ns" : "test.animals",
    "o" : {
         "_id" : "bill", "type" : "rat"
    }
}
Tapping into the Oplog

• Made easy for you!
https://github.com/wordnik/wordnik-oss
Tapping into the Oplog

 • Made easy for you!
 https://github.com/wordnik/wordnik-oss

Incremental
  Backup                     Snapshots
              Replication

                              Same
                            Technique!
Tapping into the Oplog

    • Create an OpLogProcessor
class OpLogReader extends OplogRecordProcessor {
  val recordTriggers =
      new HashSet[Function1[BasicDBObject, Unit]]
  @throws(classOf[Exception])
  def processRecord(dbo: BasicDBObject) = {
    recordTriggers.foreach(t => t(dbo))
  }
  @throws(classOf[IOException])
  def close(string: String) = {}
}
Tapping into the Oplog

• Attach it to an OpLogTailThread
val util = new OpLogReader
val coll: DBCollection =
 (MongoDBConnectionManager.getOplog("oplog",
 "localhost", None, None)).get
val tailThread = new OplogTailThread(util, coll)
tailThread.start
Tapping into the Oplog

• Add some observer functions
util.recordTriggers +=
  new Function1[BasicDBObject, Unit] {
      def apply(e: BasicDBObject): Unit =
        Profile("inspectObject", {
          totalExamined += 1
          /* do something here */
        }
      })
    }
  }
/* do something here */

• Like?
• Convert to business objects and act!
 •   OpLog to domain object is EASY
 •   Just process the ns that you care about
     "ns" : "test.animals”
• How?
Converting OpLog to Object

• Jackson makes this trivial
case class User(username: String, email: String,
  createdAt: Date)

val user = jacksonMapper.convertValue(
  dbo.get("o").asInstanceOf[DBObject],
  classOf[User])


• Reuse your DAOs?      Bonus points!
• Got your objects!
Converting OpLog to Object

• Jackson makes this trivial
                     “o” is for
case class User(username: String,   email: String,
  createdAt: Date)
                     “Object”

val user = jacksonMapper.convertValue(
  dbo.get("o").asInstanceOf[DBObject],
  classOf[User])


• Reuse your DAOs?      Bonus points!
• Got your objects!            Now What?
Use Case 1: Alert on Action

• New account!
obj match {
  case newAccount: UserAccount => {
    /* ring the bell! */
  }
  case _ => {
    /* ignore it */
  }
}
Use case 2: What’s Trending?

• Real-time activity
case o: VisitLog =>
 Profile("ActivityMonitor:processVisit", {
   wordTracker.add(o.word)
 })
Use case 3: External Analytics
case o: UserProfile => {
    getSqlDatabase().executeSql(
      "insert into user_profile values(?,?,?)",
       o.username, o.email, o.createdAt)
}
Use case 3: External Analytics
case o: UserProfile => {
    getSqlDatabase().executeSql(
      "insert into user_profile values(?,?,?)",
                                 Your Data
       o.username, o.email, o.createdAt)
}                                  pushes to
                                   Relational!

                   Don’t mix
                   runtime &
                     OLAP!
Use case 4: Cloud analysis
case o: NewUserAccount => {
    getSalesforceConnector().create(
      Lead(Account.ID, o.firstName, o.lastName,
         o.company, o.email, o.phone))
}
Use case 4: Cloud analysis
case o: NewUserAccount => {
    getSalesforceConnector().create(
      Lead(Account.ID, o.firstName, o.lastName,
         o.company, o.email, o.phone))
}

                                We didn’t
  Pushed                      interrupt core
 directly to                   engineering!
Salesforce!
Examples




     Polling profile
      APIs cross
        cluster
Examples



       Siphoning
        hashtags
      from opLog
Examples


       Page view
      activity from
         opLog
Examples


      Health check
          w/o
      engineering
Summary

• Don’t mix up monitoring servers & your
  application
• Leave core engineering alone
• Make a tiny engineering investment now
• Let your product folks set metrics
• FOSS tools are available (and well tested!)
• The opLog is incredibly powerful
 •   Hack it!
Find out more

• Wordnik: developer.wordnik.com
• Swagger: swagger.wordnik.com
• Wordnik OSS: github.com/wordnik/wordnik-oss
• Atmosphere: github.com/Atmosphere/atmosphere
• MongoDB: www.mongodb.org

More Related Content

What's hot

FunctionalConf '16 Robert Virding Erlang Ecosystem
FunctionalConf '16 Robert Virding Erlang EcosystemFunctionalConf '16 Robert Virding Erlang Ecosystem
FunctionalConf '16 Robert Virding Erlang EcosystemRobert Virding
 
Erlang as a cloud citizen, a fractal approach to throughput
Erlang as a cloud citizen, a fractal approach to throughputErlang as a cloud citizen, a fractal approach to throughput
Erlang as a cloud citizen, a fractal approach to throughputPaolo Negri
 
APIs for the Internet of Things
APIs for the Internet of ThingsAPIs for the Internet of Things
APIs for the Internet of ThingsKinoma
 
Vladimir Ulogov - Large Scale Simulation | ZabConf2016 Lightning Talk
Vladimir Ulogov - Large Scale Simulation | ZabConf2016 Lightning TalkVladimir Ulogov - Large Scale Simulation | ZabConf2016 Lightning Talk
Vladimir Ulogov - Large Scale Simulation | ZabConf2016 Lightning TalkZabbix
 
Lotuscript for large systems
Lotuscript for large systemsLotuscript for large systems
Lotuscript for large systemsBill Buchan
 
Ncku csie talk about Spark
Ncku csie talk about SparkNcku csie talk about Spark
Ncku csie talk about SparkGiivee The
 
Elasticsearch for SQL Users
Elasticsearch for SQL UsersElasticsearch for SQL Users
Elasticsearch for SQL UsersAll Things Open
 
Combining R With Java For Data Analysis (Devoxx UK 2015 Session)
Combining R With Java For Data Analysis (Devoxx UK 2015 Session)Combining R With Java For Data Analysis (Devoxx UK 2015 Session)
Combining R With Java For Data Analysis (Devoxx UK 2015 Session)Ryan Cuprak
 
OSDC 2013 | Introduction into Chef by Andy Hawkins
OSDC 2013 | Introduction into Chef by Andy HawkinsOSDC 2013 | Introduction into Chef by Andy Hawkins
OSDC 2013 | Introduction into Chef by Andy HawkinsNETWAYS
 
Greenfields tech decisions
Greenfields tech decisionsGreenfields tech decisions
Greenfields tech decisionsTrent Hornibrook
 
Malicious Payloads vs Deep Visibility: A PowerShell Story
Malicious Payloads vs Deep Visibility: A PowerShell StoryMalicious Payloads vs Deep Visibility: A PowerShell Story
Malicious Payloads vs Deep Visibility: A PowerShell StoryDaniel Bohannon
 
Modern websites in 2020 and Joomla
Modern websites in 2020 and JoomlaModern websites in 2020 and Joomla
Modern websites in 2020 and JoomlaGeorge Wilson
 
API Design & Security in django
API Design & Security in djangoAPI Design & Security in django
API Design & Security in djangoTareque Hossain
 
AWS IoTで家庭内IoTをやってみた【JAWS DAYS 2016】
AWS IoTで家庭内IoTをやってみた【JAWS DAYS 2016】AWS IoTで家庭内IoTをやってみた【JAWS DAYS 2016】
AWS IoTで家庭内IoTをやってみた【JAWS DAYS 2016】tsuchimon
 
Security Automation using ZAP
Security Automation using ZAPSecurity Automation using ZAP
Security Automation using ZAPVaibhav Gupta
 
Simplify your integrations with Apache Camel
Simplify your integrations with Apache CamelSimplify your integrations with Apache Camel
Simplify your integrations with Apache CamelKenneth Peeples
 
Sandbox vs manual malware analysis v1.1
Sandbox vs manual malware analysis v1.1Sandbox vs manual malware analysis v1.1
Sandbox vs manual malware analysis v1.1Michael Gough
 
BTV PHP - Building Fast Websites
BTV PHP - Building Fast WebsitesBTV PHP - Building Fast Websites
BTV PHP - Building Fast WebsitesJonathan Klein
 
Hadoop Demystified + Automation Smackdown! Austin JUG June 24 2014
Hadoop Demystified + Automation Smackdown!  Austin JUG June 24 2014Hadoop Demystified + Automation Smackdown!  Austin JUG June 24 2014
Hadoop Demystified + Automation Smackdown! Austin JUG June 24 2014datafundamentals
 
Devops at Netflix (re:Invent)
Devops at Netflix (re:Invent)Devops at Netflix (re:Invent)
Devops at Netflix (re:Invent)Jeremy Edberg
 

What's hot (20)

FunctionalConf '16 Robert Virding Erlang Ecosystem
FunctionalConf '16 Robert Virding Erlang EcosystemFunctionalConf '16 Robert Virding Erlang Ecosystem
FunctionalConf '16 Robert Virding Erlang Ecosystem
 
Erlang as a cloud citizen, a fractal approach to throughput
Erlang as a cloud citizen, a fractal approach to throughputErlang as a cloud citizen, a fractal approach to throughput
Erlang as a cloud citizen, a fractal approach to throughput
 
APIs for the Internet of Things
APIs for the Internet of ThingsAPIs for the Internet of Things
APIs for the Internet of Things
 
Vladimir Ulogov - Large Scale Simulation | ZabConf2016 Lightning Talk
Vladimir Ulogov - Large Scale Simulation | ZabConf2016 Lightning TalkVladimir Ulogov - Large Scale Simulation | ZabConf2016 Lightning Talk
Vladimir Ulogov - Large Scale Simulation | ZabConf2016 Lightning Talk
 
Lotuscript for large systems
Lotuscript for large systemsLotuscript for large systems
Lotuscript for large systems
 
Ncku csie talk about Spark
Ncku csie talk about SparkNcku csie talk about Spark
Ncku csie talk about Spark
 
Elasticsearch for SQL Users
Elasticsearch for SQL UsersElasticsearch for SQL Users
Elasticsearch for SQL Users
 
Combining R With Java For Data Analysis (Devoxx UK 2015 Session)
Combining R With Java For Data Analysis (Devoxx UK 2015 Session)Combining R With Java For Data Analysis (Devoxx UK 2015 Session)
Combining R With Java For Data Analysis (Devoxx UK 2015 Session)
 
OSDC 2013 | Introduction into Chef by Andy Hawkins
OSDC 2013 | Introduction into Chef by Andy HawkinsOSDC 2013 | Introduction into Chef by Andy Hawkins
OSDC 2013 | Introduction into Chef by Andy Hawkins
 
Greenfields tech decisions
Greenfields tech decisionsGreenfields tech decisions
Greenfields tech decisions
 
Malicious Payloads vs Deep Visibility: A PowerShell Story
Malicious Payloads vs Deep Visibility: A PowerShell StoryMalicious Payloads vs Deep Visibility: A PowerShell Story
Malicious Payloads vs Deep Visibility: A PowerShell Story
 
Modern websites in 2020 and Joomla
Modern websites in 2020 and JoomlaModern websites in 2020 and Joomla
Modern websites in 2020 and Joomla
 
API Design & Security in django
API Design & Security in djangoAPI Design & Security in django
API Design & Security in django
 
AWS IoTで家庭内IoTをやってみた【JAWS DAYS 2016】
AWS IoTで家庭内IoTをやってみた【JAWS DAYS 2016】AWS IoTで家庭内IoTをやってみた【JAWS DAYS 2016】
AWS IoTで家庭内IoTをやってみた【JAWS DAYS 2016】
 
Security Automation using ZAP
Security Automation using ZAPSecurity Automation using ZAP
Security Automation using ZAP
 
Simplify your integrations with Apache Camel
Simplify your integrations with Apache CamelSimplify your integrations with Apache Camel
Simplify your integrations with Apache Camel
 
Sandbox vs manual malware analysis v1.1
Sandbox vs manual malware analysis v1.1Sandbox vs manual malware analysis v1.1
Sandbox vs manual malware analysis v1.1
 
BTV PHP - Building Fast Websites
BTV PHP - Building Fast WebsitesBTV PHP - Building Fast Websites
BTV PHP - Building Fast Websites
 
Hadoop Demystified + Automation Smackdown! Austin JUG June 24 2014
Hadoop Demystified + Automation Smackdown!  Austin JUG June 24 2014Hadoop Demystified + Automation Smackdown!  Austin JUG June 24 2014
Hadoop Demystified + Automation Smackdown! Austin JUG June 24 2014
 
Devops at Netflix (re:Invent)
Devops at Netflix (re:Invent)Devops at Netflix (re:Invent)
Devops at Netflix (re:Invent)
 

Similar to System insight without Interference

we45 DEFCON Workshop - Building AppSec Automation with Python
we45 DEFCON Workshop - Building AppSec Automation with Pythonwe45 DEFCON Workshop - Building AppSec Automation with Python
we45 DEFCON Workshop - Building AppSec Automation with PythonAbhay Bhargav
 
An introduction to the API for OnTime for IBM
An introduction to the API for OnTime for IBMAn introduction to the API for OnTime for IBM
An introduction to the API for OnTime for IBMontimesuite
 
Intro to node and mongodb 1
Intro to node and mongodb   1Intro to node and mongodb   1
Intro to node and mongodb 1Mohammad Qureshi
 
Advanced Benchmarking at Parse
Advanced Benchmarking at ParseAdvanced Benchmarking at Parse
Advanced Benchmarking at ParseMongoDB
 
MongoDB.local Austin 2018: Ch-Ch-Ch-Ch-Changes: Taking Your MongoDB Stitch A...
MongoDB.local Austin 2018:  Ch-Ch-Ch-Ch-Changes: Taking Your MongoDB Stitch A...MongoDB.local Austin 2018:  Ch-Ch-Ch-Ch-Changes: Taking Your MongoDB Stitch A...
MongoDB.local Austin 2018: Ch-Ch-Ch-Ch-Changes: Taking Your MongoDB Stitch A...MongoDB
 
Building APIs in an easy way using API Platform
Building APIs in an easy way using API PlatformBuilding APIs in an easy way using API Platform
Building APIs in an easy way using API PlatformAntonio Peric-Mazar
 
Hacklu2011 tricaud
Hacklu2011 tricaudHacklu2011 tricaud
Hacklu2011 tricaudstricaud
 
Buildingsocialanalyticstoolwithmongodb
BuildingsocialanalyticstoolwithmongodbBuildingsocialanalyticstoolwithmongodb
BuildingsocialanalyticstoolwithmongodbMongoDB APAC
 
Measuring 2.0 - How to handle 100K events/sec - Berlin Buzzwords 2019
Measuring 2.0 - How to handle 100K events/sec - Berlin Buzzwords 2019Measuring 2.0 - How to handle 100K events/sec - Berlin Buzzwords 2019
Measuring 2.0 - How to handle 100K events/sec - Berlin Buzzwords 2019Niels Basjes
 
IVS CTO Night And Day 2018 Winter - [re:Cap] Serverless & Mobile
IVS CTO Night And Day 2018 Winter - [re:Cap] Serverless & MobileIVS CTO Night And Day 2018 Winter - [re:Cap] Serverless & Mobile
IVS CTO Night And Day 2018 Winter - [re:Cap] Serverless & MobileAmazon Web Services Japan
 
AWS Observability Made Simple
AWS Observability Made SimpleAWS Observability Made Simple
AWS Observability Made SimpleLuciano Mammino
 
¡El mejor lenguaje para automatizar pruebas!
¡El mejor lenguaje para automatizar pruebas!¡El mejor lenguaje para automatizar pruebas!
¡El mejor lenguaje para automatizar pruebas!Antonio Robres Turon
 
First Look at Azure Logic Apps (BAUG)
First Look at Azure Logic Apps (BAUG)First Look at Azure Logic Apps (BAUG)
First Look at Azure Logic Apps (BAUG)Daniel Toomey
 
Chef Analytics (Chef NYC Meeting - July 2014)
Chef Analytics (Chef NYC Meeting - July 2014)Chef Analytics (Chef NYC Meeting - July 2014)
Chef Analytics (Chef NYC Meeting - July 2014)James Casey
 
MongoDB in the Middle of a Hybrid Cloud and Polyglot Persistence Architecture
MongoDB in the Middle of a Hybrid Cloud and Polyglot Persistence ArchitectureMongoDB in the Middle of a Hybrid Cloud and Polyglot Persistence Architecture
MongoDB in the Middle of a Hybrid Cloud and Polyglot Persistence ArchitectureMongoDB
 
用Serverless技術快速開發line聊天機器人
用Serverless技術快速開發line聊天機器人用Serverless技術快速開發line聊天機器人
用Serverless技術快速開發line聊天機器人Kevin Luo
 
O365Con18 - Automate your Tasks through Azure Functions - Elio Struyf
O365Con18 - Automate your Tasks through Azure Functions - Elio StruyfO365Con18 - Automate your Tasks through Azure Functions - Elio Struyf
O365Con18 - Automate your Tasks through Azure Functions - Elio StruyfNCCOMMS
 
Web Development using Ruby on Rails
Web Development using Ruby on RailsWeb Development using Ruby on Rails
Web Development using Ruby on RailsAvi Kedar
 

Similar to System insight without Interference (20)

we45 DEFCON Workshop - Building AppSec Automation with Python
we45 DEFCON Workshop - Building AppSec Automation with Pythonwe45 DEFCON Workshop - Building AppSec Automation with Python
we45 DEFCON Workshop - Building AppSec Automation with Python
 
An introduction to the API for OnTime for IBM
An introduction to the API for OnTime for IBMAn introduction to the API for OnTime for IBM
An introduction to the API for OnTime for IBM
 
Intro to node and mongodb 1
Intro to node and mongodb   1Intro to node and mongodb   1
Intro to node and mongodb 1
 
Advanced Benchmarking at Parse
Advanced Benchmarking at ParseAdvanced Benchmarking at Parse
Advanced Benchmarking at Parse
 
MongoDB.local Austin 2018: Ch-Ch-Ch-Ch-Changes: Taking Your MongoDB Stitch A...
MongoDB.local Austin 2018:  Ch-Ch-Ch-Ch-Changes: Taking Your MongoDB Stitch A...MongoDB.local Austin 2018:  Ch-Ch-Ch-Ch-Changes: Taking Your MongoDB Stitch A...
MongoDB.local Austin 2018: Ch-Ch-Ch-Ch-Changes: Taking Your MongoDB Stitch A...
 
Building APIs in an easy way using API Platform
Building APIs in an easy way using API PlatformBuilding APIs in an easy way using API Platform
Building APIs in an easy way using API Platform
 
Hacklu2011 tricaud
Hacklu2011 tricaudHacklu2011 tricaud
Hacklu2011 tricaud
 
Buildingsocialanalyticstoolwithmongodb
BuildingsocialanalyticstoolwithmongodbBuildingsocialanalyticstoolwithmongodb
Buildingsocialanalyticstoolwithmongodb
 
Measuring 2.0 - How to handle 100K events/sec - Berlin Buzzwords 2019
Measuring 2.0 - How to handle 100K events/sec - Berlin Buzzwords 2019Measuring 2.0 - How to handle 100K events/sec - Berlin Buzzwords 2019
Measuring 2.0 - How to handle 100K events/sec - Berlin Buzzwords 2019
 
IVS CTO Night And Day 2018 Winter - [re:Cap] Serverless & Mobile
IVS CTO Night And Day 2018 Winter - [re:Cap] Serverless & MobileIVS CTO Night And Day 2018 Winter - [re:Cap] Serverless & Mobile
IVS CTO Night And Day 2018 Winter - [re:Cap] Serverless & Mobile
 
[Struyf] Automate Your Tasks With Azure Functions
[Struyf] Automate Your Tasks With Azure Functions[Struyf] Automate Your Tasks With Azure Functions
[Struyf] Automate Your Tasks With Azure Functions
 
AWS Observability Made Simple
AWS Observability Made SimpleAWS Observability Made Simple
AWS Observability Made Simple
 
¡El mejor lenguaje para automatizar pruebas!
¡El mejor lenguaje para automatizar pruebas!¡El mejor lenguaje para automatizar pruebas!
¡El mejor lenguaje para automatizar pruebas!
 
First Look at Azure Logic Apps (BAUG)
First Look at Azure Logic Apps (BAUG)First Look at Azure Logic Apps (BAUG)
First Look at Azure Logic Apps (BAUG)
 
Chef Analytics (Chef NYC Meeting - July 2014)
Chef Analytics (Chef NYC Meeting - July 2014)Chef Analytics (Chef NYC Meeting - July 2014)
Chef Analytics (Chef NYC Meeting - July 2014)
 
MongoDB in the Middle of a Hybrid Cloud and Polyglot Persistence Architecture
MongoDB in the Middle of a Hybrid Cloud and Polyglot Persistence ArchitectureMongoDB in the Middle of a Hybrid Cloud and Polyglot Persistence Architecture
MongoDB in the Middle of a Hybrid Cloud and Polyglot Persistence Architecture
 
用Serverless技術快速開發line聊天機器人
用Serverless技術快速開發line聊天機器人用Serverless技術快速開發line聊天機器人
用Serverless技術快速開發line聊天機器人
 
O365Con18 - Automate your Tasks through Azure Functions - Elio Struyf
O365Con18 - Automate your Tasks through Azure Functions - Elio StruyfO365Con18 - Automate your Tasks through Azure Functions - Elio Struyf
O365Con18 - Automate your Tasks through Azure Functions - Elio Struyf
 
Dev Ops without the Ops
Dev Ops without the OpsDev Ops without the Ops
Dev Ops without the Ops
 
Web Development using Ruby on Rails
Web Development using Ruby on RailsWeb Development using Ruby on Rails
Web Development using Ruby on Rails
 

More from Tony Tam

A Tasty deep-dive into Open API Specification Links
A Tasty deep-dive into Open API Specification LinksA Tasty deep-dive into Open API Specification Links
A Tasty deep-dive into Open API Specification LinksTony Tam
 
API Design first with Swagger
API Design first with SwaggerAPI Design first with Swagger
API Design first with SwaggerTony Tam
 
Developing Faster with Swagger
Developing Faster with SwaggerDeveloping Faster with Swagger
Developing Faster with SwaggerTony Tam
 
Writer APIs in Java faster with Swagger Inflector
Writer APIs in Java faster with Swagger InflectorWriter APIs in Java faster with Swagger Inflector
Writer APIs in Java faster with Swagger InflectorTony Tam
 
Fastest to Mobile with Scalatra + Swagger
Fastest to Mobile with Scalatra + SwaggerFastest to Mobile with Scalatra + Swagger
Fastest to Mobile with Scalatra + SwaggerTony Tam
 
Swagger APIs for Humans and Robots (Gluecon)
Swagger APIs for Humans and Robots (Gluecon)Swagger APIs for Humans and Robots (Gluecon)
Swagger APIs for Humans and Robots (Gluecon)Tony Tam
 
Love your API with Swagger (Gluecon lightning talk)
Love your API with Swagger (Gluecon lightning talk)Love your API with Swagger (Gluecon lightning talk)
Love your API with Swagger (Gluecon lightning talk)Tony Tam
 
Swagger for-your-api
Swagger for-your-apiSwagger for-your-api
Swagger for-your-apiTony Tam
 
Swagger for startups
Swagger for startupsSwagger for startups
Swagger for startupsTony Tam
 
Data Modeling for NoSQL
Data Modeling for NoSQLData Modeling for NoSQL
Data Modeling for NoSQLTony Tam
 
Keeping MongoDB Data Safe
Keeping MongoDB Data SafeKeeping MongoDB Data Safe
Keeping MongoDB Data SafeTony Tam
 
Inside Wordnik's Architecture
Inside Wordnik's ArchitectureInside Wordnik's Architecture
Inside Wordnik's ArchitectureTony Tam
 
Scaling with swagger
Scaling with swaggerScaling with swagger
Scaling with swaggerTony Tam
 
Running MongoDB in the Cloud
Running MongoDB in the CloudRunning MongoDB in the Cloud
Running MongoDB in the CloudTony Tam
 
Scala & Swagger at Wordnik
Scala & Swagger at WordnikScala & Swagger at Wordnik
Scala & Swagger at WordnikTony Tam
 
Introducing Swagger
Introducing SwaggerIntroducing Swagger
Introducing SwaggerTony Tam
 
Why Wordnik went non-relational
Why Wordnik went non-relationalWhy Wordnik went non-relational
Why Wordnik went non-relationalTony Tam
 
Building a Directed Graph with MongoDB
Building a Directed Graph with MongoDBBuilding a Directed Graph with MongoDB
Building a Directed Graph with MongoDBTony Tam
 
Managing a MongoDB Deployment
Managing a MongoDB DeploymentManaging a MongoDB Deployment
Managing a MongoDB DeploymentTony Tam
 
Keeping the Lights On with MongoDB
Keeping the Lights On with MongoDBKeeping the Lights On with MongoDB
Keeping the Lights On with MongoDBTony Tam
 

More from Tony Tam (20)

A Tasty deep-dive into Open API Specification Links
A Tasty deep-dive into Open API Specification LinksA Tasty deep-dive into Open API Specification Links
A Tasty deep-dive into Open API Specification Links
 
API Design first with Swagger
API Design first with SwaggerAPI Design first with Swagger
API Design first with Swagger
 
Developing Faster with Swagger
Developing Faster with SwaggerDeveloping Faster with Swagger
Developing Faster with Swagger
 
Writer APIs in Java faster with Swagger Inflector
Writer APIs in Java faster with Swagger InflectorWriter APIs in Java faster with Swagger Inflector
Writer APIs in Java faster with Swagger Inflector
 
Fastest to Mobile with Scalatra + Swagger
Fastest to Mobile with Scalatra + SwaggerFastest to Mobile with Scalatra + Swagger
Fastest to Mobile with Scalatra + Swagger
 
Swagger APIs for Humans and Robots (Gluecon)
Swagger APIs for Humans and Robots (Gluecon)Swagger APIs for Humans and Robots (Gluecon)
Swagger APIs for Humans and Robots (Gluecon)
 
Love your API with Swagger (Gluecon lightning talk)
Love your API with Swagger (Gluecon lightning talk)Love your API with Swagger (Gluecon lightning talk)
Love your API with Swagger (Gluecon lightning talk)
 
Swagger for-your-api
Swagger for-your-apiSwagger for-your-api
Swagger for-your-api
 
Swagger for startups
Swagger for startupsSwagger for startups
Swagger for startups
 
Data Modeling for NoSQL
Data Modeling for NoSQLData Modeling for NoSQL
Data Modeling for NoSQL
 
Keeping MongoDB Data Safe
Keeping MongoDB Data SafeKeeping MongoDB Data Safe
Keeping MongoDB Data Safe
 
Inside Wordnik's Architecture
Inside Wordnik's ArchitectureInside Wordnik's Architecture
Inside Wordnik's Architecture
 
Scaling with swagger
Scaling with swaggerScaling with swagger
Scaling with swagger
 
Running MongoDB in the Cloud
Running MongoDB in the CloudRunning MongoDB in the Cloud
Running MongoDB in the Cloud
 
Scala & Swagger at Wordnik
Scala & Swagger at WordnikScala & Swagger at Wordnik
Scala & Swagger at Wordnik
 
Introducing Swagger
Introducing SwaggerIntroducing Swagger
Introducing Swagger
 
Why Wordnik went non-relational
Why Wordnik went non-relationalWhy Wordnik went non-relational
Why Wordnik went non-relational
 
Building a Directed Graph with MongoDB
Building a Directed Graph with MongoDBBuilding a Directed Graph with MongoDB
Building a Directed Graph with MongoDB
 
Managing a MongoDB Deployment
Managing a MongoDB DeploymentManaging a MongoDB Deployment
Managing a MongoDB Deployment
 
Keeping the Lights On with MongoDB
Keeping the Lights On with MongoDBKeeping the Lights On with MongoDB
Keeping the Lights On with MongoDB
 

Recently uploaded

Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubKalema Edgar
 
Digital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptxDigital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptxLoriGlavin3
 
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptxThe Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptxLoriGlavin3
 
Generative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information DevelopersGenerative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information DevelopersRaghuram Pandurangan
 
What is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdfWhat is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdfMounikaPolabathina
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Mark Simos
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsRizwan Syed
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationSlibray Presentation
 
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupFlorian Wilhelm
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brandgvaughan
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr BaganFwdays
 
Moving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdfMoving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdfLoriGlavin3
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 3652toLead Limited
 
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptxUse of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptxLoriGlavin3
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Commit University
 
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptxThe Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptxLoriGlavin3
 
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024BookNet Canada
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfAlex Barbosa Coqueiro
 

Recently uploaded (20)

Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding Club
 
Digital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptxDigital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptx
 
DMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special EditionDMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special Edition
 
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptxThe Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
 
Generative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information DevelopersGenerative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information Developers
 
What is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdfWhat is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdf
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL Certs
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck Presentation
 
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project Setup
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brand
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan
 
Moving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdfMoving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdf
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365
 
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptxUse of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!
 
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptxThe Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
 
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdf
 

System insight without Interference

  • 1. Insight without Interference Monitoring with Scala, Swagger, MongoDB and Wordnik OSS Tony Tam @fehguy
  • 3. Monitoring? Disk Host Space Checks IT Ops 101 System Network Load
  • 4. Monitoring? Disk Host Space Checks Necessary (but insufficient) System Network Load
  • 5. Why Insufficient? • What about Services? • Database running? • HTTP traffic? • Install Munin Node! • Some (good) service-level insight
  • 6.
  • 7. Your boss “OH pretty LOVES charts colors!” “up and to the “it MUST right!” be important!”
  • 8. Good vs. Bad? • Database calls avg 1ms? • Great! DB working well • But called 1M times per page load/user? • Most tools are for system, not your app • By the time you know, it’s too late Need business metrics monitoring!
  • 9. Enter APM • Application Performance Monitoring • Many flavors, degrees of integration • Heavy: transaction monitoring, code performance, heap, memory analysis • Medium: home-grown profiling • Light: digest your logs (failure forensics) • What you need depends on architecture, business + technology stage
  • 10. APM @ Wordnik • Micro Services make the System Monolithic application
  • 11. APM @ Wordnik • Micro Services make the System API Calls are the unit of work! Monolithic application
  • 12. Monitoring API Calls • Every API must be profiled • Other logic as needed • Database calls • Connection manager • etc... • Anything that might matter!
  • 13. How? • Wordnik-OSS Profiler for Scala • Apache 2.0 License, available in Maven Central • Profiling Arbitrary code block: import com.wordnik.util.perf.Profile Profile("create a cat", {/* do something */}) • Profiling an API call: Profile("/store/purchase", {/* do something */})
  • 14. Profiler gives you… • Nearly free*** tracking • Simple aggregation • Trigger mechanism • Actions on time spent “doing things”: Profile.triggers += new Function1[ProfileCounter, Unit] { def apply(counter: ProfileCounter): Unit = { if (counter.name == "getDb" && counter.duration > 5000) wakeUpSysAdminAndEveryoneWhoCanFixShit(Urgency.NOW) return counter } }
  • 15. Profiler gives you… • Nearly free*** tracking • Simple aggregation • Trigger mechanism • Actions on time spent “doing things”: Profile.triggers += new Function1[ProfileCounter, Unit] { def apply(counter: ProfileCounter): Unit = { if (counter.name == "getDb" && counter.duration > 5000) wakeUpSysAdminAndEveryoneWhoCanFixShit(Urgency.NOW) This is intrusive return counter } } on your codebase
  • 16. Accessing Profile Data • Easy to get in code ProfileScreenPrinter.dump • Output where you want logger.info(ProfileScreenPrinter.toString) • Send to logs, email, etc.
  • 17. Accessing Profile Data • Easier to get via API with Swagger-JAXRS import com.wordnik.resource.util @Path("/activity.json") @Api("/activity") @Produces(Array("application/json")) class ProfileResource extends ProfileTrait
  • 19. Accessing Profile Data Inspect without bugging devs!
  • 20. Is Aggregate Data Enough? • Probably not • Not Actionable • Have calls increased? Decreased? • Faster response? Slower?
  • 21. Make it Actionable • “In a 3 hour window, I expect 300,000 views per server” • Poll & persist the counters { • Example: Log page views, every min "_id" : "web1-word-page-view-20120625151812", "host" : "web1", "count" : 627172, "timestamp" : NumberLong("1340637492247") },{ "_id" : "web1-word-page-view-20120625151912", "host" : "web1", "count" : 627372, "timestamp" : NumberLong("1340637552778") }
  • 23. Make it Actionable Your boss LOVES charts
  • 24. That’s not Actionable! • Custompretty But it’s Time APIs to window track? What’s missing? Too much Low + High custom Watermark Engineerin s g
  • 25. That’s not Actionable! Custom Time APIs to window track? Call to Action! Too much Low + High custom Watermarks Engineering
  • 26. Make it Actionable • Swagger + a tiny bit of engineering • Let your *product* people create monitors, set goals • A Check: specific API call mapped to a service function { "name": "word-page-view", "path": "/word/*/wordView (post)", "checkInterval": 60, "healthSpan": 300, "minCount": 300, "maxCount": 100000 }
  • 27. Make it Actionable • A Service Type: a collection of checks which make a functional unit { "name": "www-api", "checks": [ "word-of-the-day", "word-page-view", "word-definitions", "user-login", "api-account-signup", "api-account-activated" ] }
  • 28. Make it Actionable • A Host: “directions” to get to the checks { "host": "ip-10-132-43-114", "path": "/v4/health.json/profile?api_key=XYZ", "serviceType": "www-api” }, { "host": "ip-10-130-134-82", "path": "/v4/health.json/profile?api_key=XYZ", "serviceType": "www-api” }
  • 29. Make it Actionable • And finally, a simple GUI
  • 30. Make it Actionable • And finally, a simple GUI
  • 31. Make it Actionable • Point Nagios at this! serviceHealth.json/status/www- api?explodeOnFailure=true Metrics from Product • Get a 500, get an alert Treat like Based on system YOUR app failure
  • 33. Is this Enough? System monitoring Aggregate monitoring Windowed monitoring Object monitoring? • Action on a specific event/object Why!?
  • 34. Object-level Actions • Any back-end engineer can build this • But shouldn’t • ETL to a cube? • Run BI queries against production? • Best way to “siphon” data from production w/o intrusive engineering?
  • 35. Avoiding Code Invasion • We use MongoDB everywhere • We use > 1 server wherever we use MongoDB • We have an opLog record against everything we do
  • 36. What is the OpLog • All participating members have one • Capped collection of all write ops t3 time t0 t1 t2 primary replica replica
  • 37. So What? • It’s a “pseudo-durable global topic message bus” (PDGTMB) • WTF? • All DB transactions in there • It’s persistent (cyclic collection) • It’s fast (as fast as your writes) • It’s non-blocking • It’s easily accessible
  • 38. More about this { "ts" : { "t" : 1340948921000, "i" : 1 }, "h" : NumberLong("5674919573577531409"), "op" : "i", "ns" : "test.animals", "o" : {"_id" : "fred", "type" : "cat" } }, { "ts" : { "t" : 1340948935000, "i" : 1 }, "h" : NumberLong("7701120461899338740"), "op" : "i", "ns" : "test.animals", "o" : { "_id" : "bill", "type" : "rat" } }
  • 39. Tapping into the Oplog • Made easy for you! https://github.com/wordnik/wordnik-oss
  • 40. Tapping into the Oplog • Made easy for you! https://github.com/wordnik/wordnik-oss Incremental Backup Snapshots Replication Same Technique!
  • 41. Tapping into the Oplog • Create an OpLogProcessor class OpLogReader extends OplogRecordProcessor { val recordTriggers = new HashSet[Function1[BasicDBObject, Unit]] @throws(classOf[Exception]) def processRecord(dbo: BasicDBObject) = { recordTriggers.foreach(t => t(dbo)) } @throws(classOf[IOException]) def close(string: String) = {} }
  • 42. Tapping into the Oplog • Attach it to an OpLogTailThread val util = new OpLogReader val coll: DBCollection = (MongoDBConnectionManager.getOplog("oplog", "localhost", None, None)).get val tailThread = new OplogTailThread(util, coll) tailThread.start
  • 43. Tapping into the Oplog • Add some observer functions util.recordTriggers += new Function1[BasicDBObject, Unit] { def apply(e: BasicDBObject): Unit = Profile("inspectObject", { totalExamined += 1 /* do something here */ } }) } }
  • 44. /* do something here */ • Like? • Convert to business objects and act! • OpLog to domain object is EASY • Just process the ns that you care about "ns" : "test.animals” • How?
  • 45. Converting OpLog to Object • Jackson makes this trivial case class User(username: String, email: String, createdAt: Date) val user = jacksonMapper.convertValue( dbo.get("o").asInstanceOf[DBObject], classOf[User]) • Reuse your DAOs? Bonus points! • Got your objects!
  • 46. Converting OpLog to Object • Jackson makes this trivial “o” is for case class User(username: String, email: String, createdAt: Date) “Object” val user = jacksonMapper.convertValue( dbo.get("o").asInstanceOf[DBObject], classOf[User]) • Reuse your DAOs? Bonus points! • Got your objects! Now What?
  • 47. Use Case 1: Alert on Action • New account! obj match { case newAccount: UserAccount => { /* ring the bell! */ } case _ => { /* ignore it */ } }
  • 48. Use case 2: What’s Trending? • Real-time activity case o: VisitLog => Profile("ActivityMonitor:processVisit", { wordTracker.add(o.word) })
  • 49. Use case 3: External Analytics case o: UserProfile => { getSqlDatabase().executeSql( "insert into user_profile values(?,?,?)", o.username, o.email, o.createdAt) }
  • 50. Use case 3: External Analytics case o: UserProfile => { getSqlDatabase().executeSql( "insert into user_profile values(?,?,?)", Your Data o.username, o.email, o.createdAt) } pushes to Relational! Don’t mix runtime & OLAP!
  • 51. Use case 4: Cloud analysis case o: NewUserAccount => { getSalesforceConnector().create( Lead(Account.ID, o.firstName, o.lastName, o.company, o.email, o.phone)) }
  • 52. Use case 4: Cloud analysis case o: NewUserAccount => { getSalesforceConnector().create( Lead(Account.ID, o.firstName, o.lastName, o.company, o.email, o.phone)) } We didn’t Pushed interrupt core directly to engineering! Salesforce!
  • 53. Examples Polling profile APIs cross cluster
  • 54. Examples Siphoning hashtags from opLog
  • 55. Examples Page view activity from opLog
  • 56. Examples Health check w/o engineering
  • 57. Summary • Don’t mix up monitoring servers & your application • Leave core engineering alone • Make a tiny engineering investment now • Let your product folks set metrics • FOSS tools are available (and well tested!) • The opLog is incredibly powerful • Hack it!
  • 58. Find out more • Wordnik: developer.wordnik.com • Swagger: swagger.wordnik.com • Wordnik OSS: github.com/wordnik/wordnik-oss • Atmosphere: github.com/Atmosphere/atmosphere • MongoDB: www.mongodb.org