SlideShare a Scribd company logo
1 of 81
Download to read offline
Feature: Ruby on Rails Application Monitoring with Cucumber

 In order to ensure continuous application availability
 A developer should be able to assert the behavior of production apps
 From the outside in
 Without using antiquated monitoring tools
 To protect revenue
VP of Research & Development
                            railsmachine.com

                           jesse@railsmachine.com
                                  @jnewland
                             github.com/jnewland


About me:

I get to hack on Ruby tools to manage large Rails deployments all day long. Not a bad job,
eh?
Before we get into monitoring or cucumber, let’s talk about testing.

In my career as a dev, my testing habits have evolved over time, largely inspired by available
tools.

I’m sure some of you have shared a similar journey - let’s take a quick look back.
No
more
clicking
around
Save in your editor / refresh in your browser / lather / rinse repeat.

Occasional human preformed quality assurance

Broken by design
I then made the jump to unit testing using Ruby’s Test::Unit - specifically the generated
Model and Controller tests Rails generated.

This was nice, but it was often devalued by stakeholders due to poor communication of the
business value of this work on my part.
R

Enter Rspec and the BDD movement.

Rspec helped me, and I’m sure a lot of others, associate the business value with writing
tests / specs.

Stakeholder-digestable code if you’re really good, stakeholder-digestable output if you’re
doing things right.
C
  U
  C
  U
  M
  B
  E
  R
Basically, BDD nirvana. Stakeholder-*writable* if you’re crazy.
Cucumber lets software
development teams describe
how software should behave in
plain text. The text is written in
a business-readable domain-
specific language and serves
as documentation, automated
tests and development-aid - all
rolled into one format.
For those of you that aren’t familiar with Cuke
TATFT!
The most important part of the evolution of these tools is that they make it easy and -
legitimately - fun to test first and test all of the time as you’re developing your application.
Production
 Monitoring
But what about production? We’re testing all the time in development, while we’re developing
the that’s going to create revenue. But in production...
Revenue
                                          Preservation




...there’s actually revenue being earned. Why not test with the same veracity in production?
Current
                                                  Monitoring
                                                  Landscape




Quiz:

* Raise your hand if you are at least partially responsible for the continuous operation of a
business critical production rails app
* If you have ZERO monitoring of the site’s uptime - meaning your customers or boss would
be the one to tell you that the homepage was down - put your hand down
* If your monitoring solution runs on your server itself - monit or god, for example - put
your hand down
* If your external monitoring solution only hits one URL on the site, put your hand down

Some sites are monitored very closely, but I’ve found that in most cases, the monitoring of
many production apps is rather slim.

I generally evaluate monitoring solutions on two axes:
What’s being monitored - what URLs, metrics, system statistics, etc are being watched
How
closely
are
you
looking
at
it?
We’ll call this one the crazy monkey test - How frequently these URLs / metrics are being
queried, what values are acceptable, etc.
It seems that in many situations, the home page of an application is the only thing checked
closely
The crazy monkey has laser focus
but if the crazy monkey is that focused
Bad things can happen when he’s not looking.

For example, in Rails apps, I see this happen all the time with...
Search is a part of many applications that I’ve seen go unmonitored. I’m not singling out
sphinx here - this is just a sweet picture - the same thing happens to Solr, etc
Search can fail when the rest of a site works fine due to many reasons:

* search daemon may go down
* the indicies may be corrupt
* or things may fail in a more interesting kind of way...
0 results for “beer”




Wherein no results are returned when they obviously should be.
TATFT?
So are we really testing all the time?
TATFT*
                     *except in production
It doesn’t seem so
_why?




But why? Why are we testing so....ferociously in development, but so weakly in production?
Old
                                                                  Broken
                                                                   Tools
I’m largely convinced it’s because the tools that are presented to us for use in the monitoring
space are largely old and broken.
How many of your recognize this? Oh, nagios.
It’s the industry standard tool for infra monitoring. I haven’t met a single person that’s used
nagios that’s been an honest fan. The most widely despised part of nagios
is the noise. Unless masterly configured, Nagios is a noisy beast. This leads to “boy cries
wolf” type scenarios, wherein alerts are improperly categorized as noise and discarded.
EVIL



Because of the noise, and the piece of crap interface, esoteric configuration language, and for
years and years of waking me up for false positives, I’m going to paint this all in black and
white and just call nagios evil.
Pingdom’s a relatively new tool that’s gained a good bit of traction. It’s a hosted monitoring
service, that can test HTTP and many other types of services from a network of computers
around the world.
✔
Nagios and pingdom pass the crazy monkey intense focus test
✘

but in their default configuration generally only monitor a snapshot of what’s neccessary.
A recent entry into the space that’s doesn’t get a quick EVIL stamp from me is watchmouse
Twitter uses watchmouse to provide a public API status page, hitting many different API
endpoints and watching for outages and service problems
✔
Twitter’s use of Watchmouse passes the “what are you looking at test”
Business
Value
Disconnect




However, one thing that all of these tools are missing is a clear link between the business
value of the things they’re checking and the alerts they’re sending out
Hey, I know something that does that well!
Cucumber lets software
development teams describe
how software should behave in
plain text. The text is written in
a business-readable domain-
specific language and serves
as documentation, automated
tests and development-aid - all
rolled into one format.
Cucumber’s served well for me in my experience in bringing stakeholders and developers
together.
Cucumber lets software
development teams describe
how software should behave in
plain text. The text is written in
a business-readable domain-
specific language and serves
as documentation, automated
tests and development-aid - all
rolled into one format.
But with a couple quick edits
Cucumber also lets operations
teams describe how
infrastructure should behave in
plain text. The text is written in a
business-readable domain-
specific language and serves
as documentation, monitoring
and deployment-aid - all rolled
into one format.
We have a tool that can help us bring together developers, operations, *and* stakeholders
#devops




Some of you following the twitterz may have noticed some people in the ops and
development space talking about the ‘devops movement’
devs

                    ops



                        working together
While calling this a movement is pretty wild - a hashtag does not a movement make - the
ideas surrounding this ‘movement’ are things that I believe in personally, and things we’re
working on everyday at Rails Machine - blurring the line between development and ops, and
the line between the infrastructure and the application.
Cucumber also lets #devops
teams describe how
applications should behave in
plain text. The text is written in a
business-readable domain-
specific language and serves
as documentation, monitoring
and deployment-aid - all rolled
into one format.
Using cucumber in production embodies everything that is devops, and can blur those lines
even more
kumbaya




And thus result in a big happy #devops family
Example
Production
Cucumber
 Features
Benchmarking
Feature: slashdot.com
  To keep the geek masses satisfied
  Slashdot must be responsive

  Scenario: Cached pages are super quick
    Given I am benchmarking
    When I go to http://slashdot.org/
    Then the elapsed time should be less than 500 milliseconds
    When I follow "Login"
    Then the elapsed time should be less than 500 milliseconds
    When I follow "Contact"
    Then the elapsed time should be less than 500 milliseconds
Email Deliverability
Feature: Signup Emails
  In order to prevent bots from taking over the site
  A new user should receive a verification email upon signup

 Scenario: New User signup
   Given I visit "http://example.com"
   And I follow "Signup!"
   When I signup with a random email address and password
   And I press "Go"
   And I wait 10 seconds # an unfortunate reality
   Then I should have one email in my inbox
   And the email subject should match "^Welcome"
   And the email body should match "http://example.com/v/w+"


    https://github.com/technicalpickles/mailinator-spec
Existing
Metrics
Feature: Response Time
  As a impatient user
  Our web server should be in tip-top shape
  So our app can be super fast

  Background:
    Given my Scout account name is 'railsmachine'
    And my Scout email and password are 'jesse@railsmachine.com' and 'sekret'

  Scenario: Passenger Queue
    When I get the metrics from the 'Passenger' plugin on 'example.com'
    Then the 'passenger_queue_depth' should be 0

  Scenatiro: CPU usage is low
    When I get the metrics from the 'Server Overview' plugin on 'example.com'
    Then 'cpu_last_minute' should be less than 1




         http://github.com/jnewland/cucumber-scout/
Feature: Response Time
  As a impatient user
  Our app should be super fast

  Background:
    Given my NewRelic license key is 'omgwtfbbq'

  Scenario: Average Response time
    Given that my application is being monitored by New Relic
    Then my application's 'response time' should be less than 500 milliseconds

  Scenario: Apdex
    Given that my application is being monitored by New Relic
    Then my application's 'apdex' should be 1




        http://github.com/jnewland/cucumber-newrelic
SEO
Feature: Cucumber wiki discoverability
  In order to learn more about Cucumber
  As an uninformed developer
  I should be able easily find the GitHub wiki

 Scenario: Searching for Cucumber on Google
   When I go to http://www.google.com/
   And I fill in "q" with "cucumber"
   And I press "Google Search"
   Then I should see "BDD that talks to domain experts first and code second"
Security
Feature: example.org ssh logins
  As a user of example.org
  I need to login remotely

  Scenario: Login with a key
    Given I have the following public keys:
     | keyfile                    |
     | /home/jnewland/.ssh/id_dsa |
    Then I can ssh to the following hosts with these credentials:
     | hostname         | username |
     | example.org      | jnewland |
     | mail.example.org | jnewland |


  Scenario: Checking /etc/passwd
    When I ssh to "example.org" with the following credentials:
     | username | password       | keyfile                    |
     | jnewland |                | /home/jnewland/.ssh/id_dsa |
    And I run "cat /etc/passwd"
    Then I should see "jnewland" in the output
    And I should not see "that_dude_we_just_fired" in the output


        http://github.com/auxesis/cucumber-nagios
Infrastructure
Feature: RAID
  To ensure optimal server operation
  And guarantee data is stored redundantly
  The RAID array should be in a good state

  Scenario: RAID Array status
    When I check the raid array status
    Then controller "1" should have a status of "optimal"
    And controller "2" should have a status of "optimal"
    And controller "1" should have "1" logical device with a status of "optimal"
    And controller "1" should have "4" drives in "online" state
    And controller "2" should have "1" logical device with a status of "optimal"
    And controller "2" should have "4" drives in "online" state




           http://github.com/auxesis/cucumber-nagios
DNS
Feature: rubygems.org
  As a member of the Ruby community
  I should be able to easily install Ruby gems

 Scenario: DNS
   When I lookup "rubygems.org"
   Then the name should resolve an IP




     http://github.com/auxesis/cucumber-nagios
Possibilities
Credit
Card
Transactions
SSL
Exception
    Rate
Running
     features
in production
Sorta Quick Setup                                     Ge
                                                               ne
                                                             com rato
$ gem install cucumber-json cucumber-newrelic               soo ing r
              cucumber-scout cucumber-nagios                    n!
$ cd RAILS_ROOT
$ mkdir -p production_features/step_definitions
$ mkdir -p production_features/support
$ vi config/cucumber.yml

production: production_features -f Cucumber::Formatter::JSON --out tmp/cuke.json

$ vi production_features/support/env.rb

require 'cucumber/nagios/steps'
require 'cucumber/newrelic'
require 'cucumber/scout'
# etc

$ # hack on features
$ cucumber -p production # doesn’t load the Rails env, just the defined steps
$ # profit!
Cucumber Scout Plugin
Cucumber Scout Plugin




http://github.com/jnewland/scout-plugins/raw/cucumber_ci/
                cucumber_ci/cucumber_ci.rb
Cucumber Scout Plugin
Cucumber Scout Plugin
                ZOMG!
Cucumber Scout Plugin




Sent via email
Power
to
monitor
anything
and
everything
Clearly
Defined
Business
Value
I
N

R
U
B
Y
24/7/365
Know before your customers do
Thanks!
Any questions?
Get in touch:

     Jesse Newland
jesse@railsmachine.com
       @jnewland
  github.com/jnewland
Flickr Creative Commons Photos
http://flic.kr/p/4EjsDJ   http://flic.kr/p/nxAqt
http://flic.kr/p/c1UTf    http://flic.kr/p/4VWY5F
http://flic.kr/p/5BGJMu   http://flic.kr/p/EKbuF
http://flic.kr/p/5iTuua   http://flic.kr/p/5xitHh
http://flic.kr/p/77oAy2   http://flic.kr/p/4uE9Wz
http://flic.kr/p/CdYo8    http://flic.kr/p/65KZaJ
http://flic.kr/p/k2LCm    http://flic.kr/p/7JKj5H
http://flic.kr/p/71vxY6   http://flic.kr/p/79HLb5
http://flic.kr/p/5aZYkP   http://flic.kr/p/xiYny
http://flic.kr/p/79ikH2   http://flic.kr/p/68vjKV
http://flic.kr/p/6rhqad   http://flic.kr/p/rvc1
http://flic.kr/p/4MdrW8   http://flic.kr/p/6y7EfX
http://flic.kr/p/5WuXzM   http://flic.kr/p/2Mxkhp
http://flic.kr/p/3jzrJ    http://flic.kr/p/5t7h5
http://flic.kr/p/5B4TaF   http://flic.kr/p/29qc7
http://flic.kr/p/4FAf2R   http://flic.kr/p/JBaj
http://flic.kr/p/39poLP   http://flic.kr/p/smfab
http://flic.kr/p/6nq52E   http://flic.kr/p/4t5Qf9
http://flic.kr/p/yQuMG    http://flic.kr/p/M8kdv
http://flic.kr/p/jZ5Ae    http://flic.kr/p/z3eWm
http://flic.kr/p/4yhzz    http://flic.kr/p/4XAQs7

More Related Content

What's hot

Selenium and Cucumber Selenium Conf 2011
Selenium and Cucumber Selenium Conf 2011Selenium and Cucumber Selenium Conf 2011
Selenium and Cucumber Selenium Conf 2011dimakovalenko
 
Behaviour driven infrastructure
Behaviour driven infrastructureBehaviour driven infrastructure
Behaviour driven infrastructureLindsay Holmwood
 
A Perfect Launch, Every Time
A Perfect Launch, Every TimeA Perfect Launch, Every Time
A Perfect Launch, Every TimePantheon
 
Cloud Foundry API for Fun and Ops
Cloud Foundry API for Fun and OpsCloud Foundry API for Fun and Ops
Cloud Foundry API for Fun and OpsChris DeLashmutt
 
Wrangling Large Scale Frontend Web Applications
Wrangling Large Scale Frontend Web ApplicationsWrangling Large Scale Frontend Web Applications
Wrangling Large Scale Frontend Web ApplicationsRyan Roemer
 
Experiences building apps with React Native @DomCode 2016
Experiences building apps with React Native @DomCode 2016Experiences building apps with React Native @DomCode 2016
Experiences building apps with React Native @DomCode 2016Adrian Philipp
 
React native in the wild @ Codemotion 2016 in Rome
React native in the wild @ Codemotion 2016 in RomeReact native in the wild @ Codemotion 2016 in Rome
React native in the wild @ Codemotion 2016 in RomeAlessandro Nadalin
 
API Documentation -- Presentation to East Bay STC Chapter
API Documentation -- Presentation to East Bay STC ChapterAPI Documentation -- Presentation to East Bay STC Chapter
API Documentation -- Presentation to East Bay STC ChapterTom Johnson
 

What's hot (8)

Selenium and Cucumber Selenium Conf 2011
Selenium and Cucumber Selenium Conf 2011Selenium and Cucumber Selenium Conf 2011
Selenium and Cucumber Selenium Conf 2011
 
Behaviour driven infrastructure
Behaviour driven infrastructureBehaviour driven infrastructure
Behaviour driven infrastructure
 
A Perfect Launch, Every Time
A Perfect Launch, Every TimeA Perfect Launch, Every Time
A Perfect Launch, Every Time
 
Cloud Foundry API for Fun and Ops
Cloud Foundry API for Fun and OpsCloud Foundry API for Fun and Ops
Cloud Foundry API for Fun and Ops
 
Wrangling Large Scale Frontend Web Applications
Wrangling Large Scale Frontend Web ApplicationsWrangling Large Scale Frontend Web Applications
Wrangling Large Scale Frontend Web Applications
 
Experiences building apps with React Native @DomCode 2016
Experiences building apps with React Native @DomCode 2016Experiences building apps with React Native @DomCode 2016
Experiences building apps with React Native @DomCode 2016
 
React native in the wild @ Codemotion 2016 in Rome
React native in the wild @ Codemotion 2016 in RomeReact native in the wild @ Codemotion 2016 in Rome
React native in the wild @ Codemotion 2016 in Rome
 
API Documentation -- Presentation to East Bay STC Chapter
API Documentation -- Presentation to East Bay STC ChapterAPI Documentation -- Presentation to East Bay STC Chapter
API Documentation -- Presentation to East Bay STC Chapter
 

Similar to Continuous (Production) Integration: Ruby on Rails Application Monitoring with Cucumber

Mobile App Feature Configuration and A/B Experiments
Mobile App Feature Configuration and A/B ExperimentsMobile App Feature Configuration and A/B Experiments
Mobile App Feature Configuration and A/B Experimentslacyrhoades
 
Don't hate, automate. lessons learned from implementing continuous delivery
Don't hate, automate. lessons learned from implementing continuous deliveryDon't hate, automate. lessons learned from implementing continuous delivery
Don't hate, automate. lessons learned from implementing continuous deliverySolano Labs
 
Rails Operations - Lessons Learned
Rails Operations -  Lessons LearnedRails Operations -  Lessons Learned
Rails Operations - Lessons LearnedJosh Nichols
 
Strange but True: Counterintiutive Paths to Building a Business on APIs
Strange but True: Counterintiutive Paths to Building a Business on APIsStrange but True: Counterintiutive Paths to Building a Business on APIs
Strange but True: Counterintiutive Paths to Building a Business on APIsThomas Bouldin
 
DevDay 2013 - Building Startups and Minimum Viable Products
DevDay 2013 - Building Startups and Minimum Viable ProductsDevDay 2013 - Building Startups and Minimum Viable Products
DevDay 2013 - Building Startups and Minimum Viable ProductsBen Hall
 
Monitoring As Code: How to Integrate App Monitoring Into Your Developer Cycle
Monitoring As Code: How to Integrate App Monitoring Into Your Developer CycleMonitoring As Code: How to Integrate App Monitoring Into Your Developer Cycle
Monitoring As Code: How to Integrate App Monitoring Into Your Developer CycleAtlassian
 
Reactive Microservice Architecture with Groovy and Grails
Reactive Microservice Architecture with Groovy and GrailsReactive Microservice Architecture with Groovy and Grails
Reactive Microservice Architecture with Groovy and GrailsSteve Pember
 
10 practices that every developer needs to start right now
10 practices that every developer needs to start right now10 practices that every developer needs to start right now
10 practices that every developer needs to start right nowCaleb Jenkins
 
Industry stories on agile, scrum and kanban
Industry stories on agile, scrum and kanbanIndustry stories on agile, scrum and kanban
Industry stories on agile, scrum and kanbanBusiness901
 
Enterprise Devops Presentation @ Magentys Seminar London May 15 2014
Enterprise Devops Presentation @ Magentys Seminar London May 15 2014Enterprise Devops Presentation @ Magentys Seminar London May 15 2014
Enterprise Devops Presentation @ Magentys Seminar London May 15 2014Jwooldridge
 
Agile Software Development for Non-Developers
Agile Software Development for Non-DevelopersAgile Software Development for Non-Developers
Agile Software Development for Non-Developershamvocke
 
30 days or less: New Features to Production
30 days or less: New Features to Production30 days or less: New Features to Production
30 days or less: New Features to ProductionKarthik Gaekwad
 
JavaOne 2015 Devops and the Darkside CON6447
JavaOne 2015 Devops and the Darkside CON6447JavaOne 2015 Devops and the Darkside CON6447
JavaOne 2015 Devops and the Darkside CON6447Steve Poole
 
Innovate Better Through Machine data Analytics
Innovate Better Through Machine data AnalyticsInnovate Better Through Machine data Analytics
Innovate Better Through Machine data AnalyticsHal Rottenberg
 
0 for 3: Edtech Startup Lessons Learned
0 for 3: Edtech Startup Lessons Learned0 for 3: Edtech Startup Lessons Learned
0 for 3: Edtech Startup Lessons LearnedSeriousGamesAssoc
 
Paris Web - Javascript as a programming language
Paris Web - Javascript as a programming languageParis Web - Javascript as a programming language
Paris Web - Javascript as a programming languageMarco Cedaro
 
Shift left-csun-sagar-barbhaya
Shift left-csun-sagar-barbhayaShift left-csun-sagar-barbhaya
Shift left-csun-sagar-barbhayaSAGAR BARBHAYA
 
Continuous validation (incl speaker notes)
Continuous validation (incl speaker notes)Continuous validation (incl speaker notes)
Continuous validation (incl speaker notes)Niels Talens
 
Resisting The Feature Creature
Resisting The Feature CreatureResisting The Feature Creature
Resisting The Feature CreatureChristian Heilmann
 

Similar to Continuous (Production) Integration: Ruby on Rails Application Monitoring with Cucumber (20)

Mobile App Feature Configuration and A/B Experiments
Mobile App Feature Configuration and A/B ExperimentsMobile App Feature Configuration and A/B Experiments
Mobile App Feature Configuration and A/B Experiments
 
Don't hate, automate. lessons learned from implementing continuous delivery
Don't hate, automate. lessons learned from implementing continuous deliveryDon't hate, automate. lessons learned from implementing continuous delivery
Don't hate, automate. lessons learned from implementing continuous delivery
 
Rails Operations - Lessons Learned
Rails Operations -  Lessons LearnedRails Operations -  Lessons Learned
Rails Operations - Lessons Learned
 
Strange but True: Counterintiutive Paths to Building a Business on APIs
Strange but True: Counterintiutive Paths to Building a Business on APIsStrange but True: Counterintiutive Paths to Building a Business on APIs
Strange but True: Counterintiutive Paths to Building a Business on APIs
 
DevDay 2013 - Building Startups and Minimum Viable Products
DevDay 2013 - Building Startups and Minimum Viable ProductsDevDay 2013 - Building Startups and Minimum Viable Products
DevDay 2013 - Building Startups and Minimum Viable Products
 
Monitoring As Code: How to Integrate App Monitoring Into Your Developer Cycle
Monitoring As Code: How to Integrate App Monitoring Into Your Developer CycleMonitoring As Code: How to Integrate App Monitoring Into Your Developer Cycle
Monitoring As Code: How to Integrate App Monitoring Into Your Developer Cycle
 
Reactive Microservice Architecture with Groovy and Grails
Reactive Microservice Architecture with Groovy and GrailsReactive Microservice Architecture with Groovy and Grails
Reactive Microservice Architecture with Groovy and Grails
 
10 practices that every developer needs to start right now
10 practices that every developer needs to start right now10 practices that every developer needs to start right now
10 practices that every developer needs to start right now
 
Industry stories on agile, scrum and kanban
Industry stories on agile, scrum and kanbanIndustry stories on agile, scrum and kanban
Industry stories on agile, scrum and kanban
 
Enterprise Devops Presentation @ Magentys Seminar London May 15 2014
Enterprise Devops Presentation @ Magentys Seminar London May 15 2014Enterprise Devops Presentation @ Magentys Seminar London May 15 2014
Enterprise Devops Presentation @ Magentys Seminar London May 15 2014
 
Agile Software Development for Non-Developers
Agile Software Development for Non-DevelopersAgile Software Development for Non-Developers
Agile Software Development for Non-Developers
 
Drupal 7 ci and testing
Drupal 7 ci and testingDrupal 7 ci and testing
Drupal 7 ci and testing
 
30 days or less: New Features to Production
30 days or less: New Features to Production30 days or less: New Features to Production
30 days or less: New Features to Production
 
JavaOne 2015 Devops and the Darkside CON6447
JavaOne 2015 Devops and the Darkside CON6447JavaOne 2015 Devops and the Darkside CON6447
JavaOne 2015 Devops and the Darkside CON6447
 
Innovate Better Through Machine data Analytics
Innovate Better Through Machine data AnalyticsInnovate Better Through Machine data Analytics
Innovate Better Through Machine data Analytics
 
0 for 3: Edtech Startup Lessons Learned
0 for 3: Edtech Startup Lessons Learned0 for 3: Edtech Startup Lessons Learned
0 for 3: Edtech Startup Lessons Learned
 
Paris Web - Javascript as a programming language
Paris Web - Javascript as a programming languageParis Web - Javascript as a programming language
Paris Web - Javascript as a programming language
 
Shift left-csun-sagar-barbhaya
Shift left-csun-sagar-barbhayaShift left-csun-sagar-barbhaya
Shift left-csun-sagar-barbhaya
 
Continuous validation (incl speaker notes)
Continuous validation (incl speaker notes)Continuous validation (incl speaker notes)
Continuous validation (incl speaker notes)
 
Resisting The Feature Creature
Resisting The Feature CreatureResisting The Feature Creature
Resisting The Feature Creature
 

Recently uploaded

Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Patryk Bandurski
 
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage CostLeverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage CostZilliz
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr BaganFwdays
 
The Future of Software Development - Devin AI Innovative Approach.pdf
The Future of Software Development - Devin AI Innovative Approach.pdfThe Future of Software Development - Devin AI Innovative Approach.pdf
The Future of Software Development - Devin AI Innovative Approach.pdfSeasiaInfotech2
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):comworks
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationSlibray Presentation
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenHervé Boutemy
 
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
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek SchlawackFwdays
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsSergiu Bodiu
 
Artificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxArtificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxhariprasad279825
 
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
 
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
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsMemoori
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Mattias Andersson
 
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machinePadma Pradeep
 
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr LapshynFwdays
 
Commit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyCommit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyAlfredo García Lavilla
 
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Scott Keck-Warren
 

Recently uploaded (20)

Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
 
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage CostLeverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan
 
The Future of Software Development - Devin AI Innovative Approach.pdf
The Future of Software Development - Devin AI Innovative Approach.pdfThe Future of Software Development - Devin AI Innovative Approach.pdf
The Future of Software Development - Devin AI Innovative Approach.pdf
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck Presentation
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache Maven
 
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)
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platforms
 
Artificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxArtificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptx
 
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
 
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
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial Buildings
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?
 
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machine
 
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
 
Commit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyCommit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easy
 
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024
 

Continuous (Production) Integration: Ruby on Rails Application Monitoring with Cucumber

  • 1. Feature: Ruby on Rails Application Monitoring with Cucumber In order to ensure continuous application availability A developer should be able to assert the behavior of production apps From the outside in Without using antiquated monitoring tools To protect revenue
  • 2. VP of Research & Development railsmachine.com jesse@railsmachine.com @jnewland github.com/jnewland About me: I get to hack on Ruby tools to manage large Rails deployments all day long. Not a bad job, eh?
  • 3. Before we get into monitoring or cucumber, let’s talk about testing. In my career as a dev, my testing habits have evolved over time, largely inspired by available tools. I’m sure some of you have shared a similar journey - let’s take a quick look back.
  • 4. No more clicking around Save in your editor / refresh in your browser / lather / rinse repeat. Occasional human preformed quality assurance Broken by design
  • 5. I then made the jump to unit testing using Ruby’s Test::Unit - specifically the generated Model and Controller tests Rails generated. This was nice, but it was often devalued by stakeholders due to poor communication of the business value of this work on my part.
  • 6. R Enter Rspec and the BDD movement. Rspec helped me, and I’m sure a lot of others, associate the business value with writing tests / specs. Stakeholder-digestable code if you’re really good, stakeholder-digestable output if you’re doing things right.
  • 7. C U C U M B E R Basically, BDD nirvana. Stakeholder-*writable* if you’re crazy.
  • 8. Cucumber lets software development teams describe how software should behave in plain text. The text is written in a business-readable domain- specific language and serves as documentation, automated tests and development-aid - all rolled into one format. For those of you that aren’t familiar with Cuke
  • 9. TATFT! The most important part of the evolution of these tools is that they make it easy and - legitimately - fun to test first and test all of the time as you’re developing your application.
  • 10. Production Monitoring But what about production? We’re testing all the time in development, while we’re developing the that’s going to create revenue. But in production...
  • 11. Revenue Preservation ...there’s actually revenue being earned. Why not test with the same veracity in production?
  • 12. Current Monitoring Landscape Quiz: * Raise your hand if you are at least partially responsible for the continuous operation of a business critical production rails app * If you have ZERO monitoring of the site’s uptime - meaning your customers or boss would be the one to tell you that the homepage was down - put your hand down * If your monitoring solution runs on your server itself - monit or god, for example - put your hand down * If your external monitoring solution only hits one URL on the site, put your hand down Some sites are monitored very closely, but I’ve found that in most cases, the monitoring of many production apps is rather slim. I generally evaluate monitoring solutions on two axes:
  • 13. What’s being monitored - what URLs, metrics, system statistics, etc are being watched
  • 14. How closely are you looking at it? We’ll call this one the crazy monkey test - How frequently these URLs / metrics are being queried, what values are acceptable, etc.
  • 15. It seems that in many situations, the home page of an application is the only thing checked closely
  • 16. The crazy monkey has laser focus
  • 17. but if the crazy monkey is that focused
  • 18.
  • 19. Bad things can happen when he’s not looking. For example, in Rails apps, I see this happen all the time with...
  • 20. Search is a part of many applications that I’ve seen go unmonitored. I’m not singling out sphinx here - this is just a sweet picture - the same thing happens to Solr, etc
  • 21. Search can fail when the rest of a site works fine due to many reasons: * search daemon may go down * the indicies may be corrupt * or things may fail in a more interesting kind of way...
  • 22. 0 results for “beer” Wherein no results are returned when they obviously should be.
  • 23. TATFT? So are we really testing all the time?
  • 24. TATFT* *except in production It doesn’t seem so
  • 25. _why? But why? Why are we testing so....ferociously in development, but so weakly in production?
  • 26. Old Broken Tools I’m largely convinced it’s because the tools that are presented to us for use in the monitoring space are largely old and broken.
  • 27. How many of your recognize this? Oh, nagios.
  • 28. It’s the industry standard tool for infra monitoring. I haven’t met a single person that’s used nagios that’s been an honest fan. The most widely despised part of nagios
  • 29. is the noise. Unless masterly configured, Nagios is a noisy beast. This leads to “boy cries wolf” type scenarios, wherein alerts are improperly categorized as noise and discarded.
  • 30. EVIL Because of the noise, and the piece of crap interface, esoteric configuration language, and for years and years of waking me up for false positives, I’m going to paint this all in black and white and just call nagios evil.
  • 31. Pingdom’s a relatively new tool that’s gained a good bit of traction. It’s a hosted monitoring service, that can test HTTP and many other types of services from a network of computers around the world.
  • 32. ✔ Nagios and pingdom pass the crazy monkey intense focus test
  • 33. ✘ but in their default configuration generally only monitor a snapshot of what’s neccessary.
  • 34. A recent entry into the space that’s doesn’t get a quick EVIL stamp from me is watchmouse
  • 35. Twitter uses watchmouse to provide a public API status page, hitting many different API endpoints and watching for outages and service problems
  • 36. ✔ Twitter’s use of Watchmouse passes the “what are you looking at test”
  • 37. Business Value Disconnect However, one thing that all of these tools are missing is a clear link between the business value of the things they’re checking and the alerts they’re sending out
  • 38. Hey, I know something that does that well!
  • 39. Cucumber lets software development teams describe how software should behave in plain text. The text is written in a business-readable domain- specific language and serves as documentation, automated tests and development-aid - all rolled into one format. Cucumber’s served well for me in my experience in bringing stakeholders and developers together.
  • 40. Cucumber lets software development teams describe how software should behave in plain text. The text is written in a business-readable domain- specific language and serves as documentation, automated tests and development-aid - all rolled into one format. But with a couple quick edits
  • 41. Cucumber also lets operations teams describe how infrastructure should behave in plain text. The text is written in a business-readable domain- specific language and serves as documentation, monitoring and deployment-aid - all rolled into one format. We have a tool that can help us bring together developers, operations, *and* stakeholders
  • 42. #devops Some of you following the twitterz may have noticed some people in the ops and development space talking about the ‘devops movement’
  • 43. devs ops working together While calling this a movement is pretty wild - a hashtag does not a movement make - the ideas surrounding this ‘movement’ are things that I believe in personally, and things we’re working on everyday at Rails Machine - blurring the line between development and ops, and the line between the infrastructure and the application.
  • 44. Cucumber also lets #devops teams describe how applications should behave in plain text. The text is written in a business-readable domain- specific language and serves as documentation, monitoring and deployment-aid - all rolled into one format. Using cucumber in production embodies everything that is devops, and can blur those lines even more
  • 45. kumbaya And thus result in a big happy #devops family
  • 48. Feature: slashdot.com To keep the geek masses satisfied Slashdot must be responsive Scenario: Cached pages are super quick Given I am benchmarking When I go to http://slashdot.org/ Then the elapsed time should be less than 500 milliseconds When I follow "Login" Then the elapsed time should be less than 500 milliseconds When I follow "Contact" Then the elapsed time should be less than 500 milliseconds
  • 50. Feature: Signup Emails In order to prevent bots from taking over the site A new user should receive a verification email upon signup Scenario: New User signup Given I visit "http://example.com" And I follow "Signup!" When I signup with a random email address and password And I press "Go" And I wait 10 seconds # an unfortunate reality Then I should have one email in my inbox And the email subject should match "^Welcome" And the email body should match "http://example.com/v/w+" https://github.com/technicalpickles/mailinator-spec
  • 52. Feature: Response Time As a impatient user Our web server should be in tip-top shape So our app can be super fast Background: Given my Scout account name is 'railsmachine' And my Scout email and password are 'jesse@railsmachine.com' and 'sekret' Scenario: Passenger Queue When I get the metrics from the 'Passenger' plugin on 'example.com' Then the 'passenger_queue_depth' should be 0 Scenatiro: CPU usage is low When I get the metrics from the 'Server Overview' plugin on 'example.com' Then 'cpu_last_minute' should be less than 1 http://github.com/jnewland/cucumber-scout/
  • 53. Feature: Response Time As a impatient user Our app should be super fast Background: Given my NewRelic license key is 'omgwtfbbq' Scenario: Average Response time Given that my application is being monitored by New Relic Then my application's 'response time' should be less than 500 milliseconds Scenario: Apdex Given that my application is being monitored by New Relic Then my application's 'apdex' should be 1 http://github.com/jnewland/cucumber-newrelic
  • 54. SEO
  • 55. Feature: Cucumber wiki discoverability In order to learn more about Cucumber As an uninformed developer I should be able easily find the GitHub wiki Scenario: Searching for Cucumber on Google When I go to http://www.google.com/ And I fill in "q" with "cucumber" And I press "Google Search" Then I should see "BDD that talks to domain experts first and code second"
  • 57. Feature: example.org ssh logins As a user of example.org I need to login remotely Scenario: Login with a key Given I have the following public keys: | keyfile | | /home/jnewland/.ssh/id_dsa | Then I can ssh to the following hosts with these credentials: | hostname | username | | example.org | jnewland | | mail.example.org | jnewland | Scenario: Checking /etc/passwd When I ssh to "example.org" with the following credentials: | username | password | keyfile | | jnewland | | /home/jnewland/.ssh/id_dsa | And I run "cat /etc/passwd" Then I should see "jnewland" in the output And I should not see "that_dude_we_just_fired" in the output http://github.com/auxesis/cucumber-nagios
  • 59. Feature: RAID To ensure optimal server operation And guarantee data is stored redundantly The RAID array should be in a good state Scenario: RAID Array status When I check the raid array status Then controller "1" should have a status of "optimal" And controller "2" should have a status of "optimal" And controller "1" should have "1" logical device with a status of "optimal" And controller "1" should have "4" drives in "online" state And controller "2" should have "1" logical device with a status of "optimal" And controller "2" should have "4" drives in "online" state http://github.com/auxesis/cucumber-nagios
  • 60. DNS
  • 61. Feature: rubygems.org As a member of the Ruby community I should be able to easily install Ruby gems Scenario: DNS When I lookup "rubygems.org" Then the name should resolve an IP http://github.com/auxesis/cucumber-nagios
  • 64. SSL
  • 65. Exception Rate
  • 66. Running features in production
  • 67. Sorta Quick Setup Ge ne com rato $ gem install cucumber-json cucumber-newrelic soo ing r cucumber-scout cucumber-nagios n! $ cd RAILS_ROOT $ mkdir -p production_features/step_definitions $ mkdir -p production_features/support $ vi config/cucumber.yml production: production_features -f Cucumber::Formatter::JSON --out tmp/cuke.json $ vi production_features/support/env.rb require 'cucumber/nagios/steps' require 'cucumber/newrelic' require 'cucumber/scout' # etc $ # hack on features $ cucumber -p production # doesn’t load the Rails env, just the defined steps $ # profit!
  • 68.
  • 78. Know before your customers do
  • 80. Get in touch: Jesse Newland jesse@railsmachine.com @jnewland github.com/jnewland
  • 81. Flickr Creative Commons Photos http://flic.kr/p/4EjsDJ http://flic.kr/p/nxAqt http://flic.kr/p/c1UTf http://flic.kr/p/4VWY5F http://flic.kr/p/5BGJMu http://flic.kr/p/EKbuF http://flic.kr/p/5iTuua http://flic.kr/p/5xitHh http://flic.kr/p/77oAy2 http://flic.kr/p/4uE9Wz http://flic.kr/p/CdYo8 http://flic.kr/p/65KZaJ http://flic.kr/p/k2LCm http://flic.kr/p/7JKj5H http://flic.kr/p/71vxY6 http://flic.kr/p/79HLb5 http://flic.kr/p/5aZYkP http://flic.kr/p/xiYny http://flic.kr/p/79ikH2 http://flic.kr/p/68vjKV http://flic.kr/p/6rhqad http://flic.kr/p/rvc1 http://flic.kr/p/4MdrW8 http://flic.kr/p/6y7EfX http://flic.kr/p/5WuXzM http://flic.kr/p/2Mxkhp http://flic.kr/p/3jzrJ http://flic.kr/p/5t7h5 http://flic.kr/p/5B4TaF http://flic.kr/p/29qc7 http://flic.kr/p/4FAf2R http://flic.kr/p/JBaj http://flic.kr/p/39poLP http://flic.kr/p/smfab http://flic.kr/p/6nq52E http://flic.kr/p/4t5Qf9 http://flic.kr/p/yQuMG http://flic.kr/p/M8kdv http://flic.kr/p/jZ5Ae http://flic.kr/p/z3eWm http://flic.kr/p/4yhzz http://flic.kr/p/4XAQs7