SlideShare una empresa de Scribd logo
1 de 45
Descargar para leer sin conexión
 
	
  
1	
  
On	
  Building	
  	
  	
  	
  	
  	
  	
  	
  :	
  
Instrumen1ng	
  Ruby	
  with	
  
TraceView	
  in	
  10	
  minutes	
  
	
  
	
  
Peter	
  Lombardo	
  
h$p://blog.gameface.in	
   h$p://www.appneta.com/blog	
  
I’ve	
  been	
  a	
  Rubyist	
  and	
  Linux	
  addict	
  for	
  over	
  a	
  decade,	
  mainly	
  
developing	
  in	
  Ruby	
  and	
  JavaScript	
  (as	
  well	
  as	
  PHP	
  and	
  Perl).	
  I’m	
  the	
  
creator	
  of	
  numerous	
  soHware	
  tools	
  and	
  applicaIons,	
  most	
  recently	
  
Password	
  Pusher,	
  a	
  Ruby	
  on	
  Rails	
  applicaIon	
  to	
  communicate	
  
passwords	
  over	
  the	
  web	
  and	
  Gameface,	
  a	
  social	
  networking	
  
plaLorm	
  for	
  gamers	
  using	
  Rails	
  3.	
  	
  
	
  
When	
  I’m	
  not	
  creaIng	
  my	
  own	
  applicaIons,	
  I	
  help	
  develop	
  and	
  
maintain	
  the	
  infrastructure	
  at	
  OurStage	
  and	
  manage	
  the	
  Ruby	
  
community	
  for	
  AppNeta.	
  
Peter	
  Lombardo	
  
 
“Gameface	
  was	
  created	
  to	
  	
  
showcase	
  games,	
  	
  
the	
  people	
  who	
  play	
  them,	
  
and	
  the	
  characters	
  they	
  play”	
  
	
  
TraceView	
  by	
  AppNeta	
  gives	
  a	
  unique	
  
in-­‐depth	
  view	
  into	
  requests	
  even	
  as	
  
they	
  cross	
  hosts	
  and	
  soKware	
  stacks.	
  
	
  
Installa1on	
  and	
  setup	
  of	
  TraceView	
  for	
  
your	
  app	
  is	
  a	
  simple	
  two	
  step	
  process	
  
that	
  can	
  be	
  done	
  in	
  10	
  minutes	
  or	
  less.	
  	
  
h$p://www.appneta.com/traceview	
   h$p://www.appneta.com/	
  
TraceView	
  provides	
  deep	
  performance	
  
monitoring	
  of	
  web	
  apps.	
  
	
  
It	
  gives	
  insight	
  into	
  your	
  web	
  app	
  
performance	
  such	
  as	
  this:	
  	
  
	
  
	
  
	
  
…and	
  a	
  per	
  request	
  drill-­‐down	
  that	
  shows	
  
you	
  the	
  niOy	
  griOy	
  detail	
  of	
  where	
  1me	
  is	
  
spent	
  in	
  individual	
  requests	
  
and	
  even	
  end-­‐user	
  monitoring:	
  
	
  
	
  
I	
  run	
  it	
  on	
  Gameface	
  and	
  PasswordPusher	
  
-­‐	
  it’s	
  essen1al	
  in	
  iden1fying	
  problem	
  
areas,	
  performance	
  boOlenecks	
  and	
  poor	
  
performing	
  code.	
  (Read:	
  Ac1onView)	
  
	
  
	
  
	
  
Disclaimer:	
  I	
  authored	
  the	
  Ruby	
  instrumenta6on	
  for	
  Traceview	
  so	
  I	
  
may	
  be	
  a	
  bit	
  biased.	
  …but	
  with	
  good	
  reason!	
  
h$p://gameface.in	
   h$p://pwpush.com/	
  
Installa1on	
  
	
  
Installing	
  TraceView	
  consists	
  of	
  two	
  parts:	
  
	
  	
  
1)  installing	
  the	
  system	
  daemon	
  on	
  
your	
  host,	
  and	
  	
  
2)  installing	
  the	
  Ruby	
  gem	
  in	
  your	
  
applica1on	
  
h$p://www.appneta.com/apm-­‐datasheet	
  
Why	
  a	
  system	
  daemon?	
  	
  
	
  
TraceView	
  uses	
  a	
  system	
  daemon	
  to	
  collect	
  
instrumenta6on	
  from	
  sources	
  beyond	
  
applica6on	
  code	
  such	
  as	
  host	
  metrics,	
  
Apache	
  or	
  Resque.	
  
The	
  system	
  daemon	
  is	
  installed	
  with	
  
two	
  commands	
  that	
  can	
  be	
  pasted	
  into	
  
your	
  shell.	
  	
  
	
  
An	
  account	
  specific	
  version	
  of	
  these	
  
commands	
  is	
  available	
  in	
  your	
  
TraceView	
  dashboard	
  once	
  you	
  create	
  
an	
  account.	
  
	
  	
  
(Under	
  SeWngs;	
  App	
  Configura1on;	
  Trace	
  New	
  Hosts)	
  	
  
And	
  the	
  gem	
  for	
  your	
  applica1on	
  
Gemfile	
  available	
  on	
  RubyGems:	
  
	
  
h$ps://rubygems.org/gems/oboe	
  
gem 'oboe' !
Setup	
  
	
  
TraceView	
  func1ons	
  by	
  sampling	
  a	
  
subset	
  of	
  all	
  requests	
  that	
  go	
  through	
  
your	
  web	
  applica1on.	
  	
  
	
  
This	
  sample	
  rate	
  must	
  be	
  set	
  at	
  the	
  
entry	
  point	
  of	
  requests	
  in	
  your	
  
applica1on.	
  	
  
This	
  can	
  be	
  a	
  load	
  balancer,	
  Apache/
nginx	
  or	
  Ruby	
  itself.	
  	
  
	
  
Successive	
  hosts	
  and	
  soKware	
  stacks	
  
that	
  requests	
  pass	
  through	
  will	
  act	
  
appropriately	
  according	
  to	
  upstream	
  
seWngs.!
Yes.	
  	
  
	
  
That	
  means	
  requests	
  can	
  be	
  traced	
  
across	
  hosts,	
  so6ware	
  stacks,	
  even	
  
track	
  internal	
  API	
  calls	
  via	
  HTTP/SOAP/
REST	
  which	
  make	
  for	
  spectacular	
  
applicaEon	
  insight.	
  
	
  
…But	
  that’s	
  another	
  post	
  for	
  another	
  Eme.	
  
	
  
For	
  this	
  walkthrough	
  we’re	
  going	
  to	
  
assume	
  that	
  you’re	
  running	
  a	
  Ruby	
  on	
  
Rails	
  applica1on	
  with	
  Unicorn,	
  Thin,	
  
Puma	
  or	
  any	
  other	
  Rack	
  based	
  Ruby	
  
webserver.	
  
	
  
To	
  instead	
  configure	
  Apache/nginx	
  as	
  the	
  entry	
  point,	
  see	
  here.	
  
This	
  can	
  be	
  a	
  load	
  balancer,	
  Apache/
nginx	
  or	
  Ruby	
  itself.	
  	
  
	
  
Successive	
  hosts	
  and	
  soKware	
  stacks	
  
that	
  requests	
  pass	
  through	
  will	
  act	
  
appropriately	
  according	
  to	
  upstream	
  
seWngs.!
If	
  you	
  setup	
  Apache	
  or	
  nginx	
  as	
  your	
  entry	
  
point	
  then	
  you	
  can	
  skip	
  this	
  part	
  enErely.	
  
	
  
The	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  gem	
  will	
  take	
  it’s	
  tracing	
  
instrucEons	
  from	
  upstream	
  automaEcally.	
  
Oboe!
When	
  the	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  gem	
  is	
  installed	
  in	
  your	
  
applica1on,	
  it	
  makes	
  available	
  	
  
!
!
which	
  is	
  a	
  nested	
  hash	
  of	
  configura1on	
  
op1ons	
  that	
  affect	
  how	
  your	
  applica1on	
  is	
  
instrumented.	
  
Oboe::Config !
Oboe!
Luckily,	
  the	
  defaults	
  are	
  very	
  smart	
  and	
  
only	
  a	
  couple	
  ini1al	
  values	
  need	
  to	
  be	
  
configured.	
  
	
  
The	
  two	
  required	
  values	
  are:	
  
	
  Oboe::Config[:tracing_mode] = 'always' !
Oboe::config[:sample_rate] = 100000 # 10% of incoming requests !
These	
  values	
  enable	
  tracing	
  
(:tracing_mode)	
  and	
  sets	
  the	
  sample	
  rate	
  
to	
  10%	
  (:sample_rate).	
  
	
  
The	
  sample_rate	
  is	
  calculated	
  by	
  the	
  value	
  
out	
  of	
  one	
  million.	
  	
  
	
  
e.g.	
  300000	
  would	
  equal	
  a	
  30%	
  sample	
  rate	
  meaning	
  3	
  out	
  
of	
  10	
  requests	
  would	
  be	
  sampled.	
  	
  
	
  
(For	
  low	
  traffic	
  sites,	
  you	
  may	
  want	
  to	
  set	
  these	
  values	
  higher.)!
These	
  values	
  are	
  usually	
  set	
  in	
  a	
  Rails	
  
ini1alizer	
  for	
  Ruby	
  on	
  Rails.	
  	
  
	
  
See	
  the	
  OpEonal	
  Rails	
  IniEalizer	
  sec1on	
  
on	
  this	
  page.	
  	
  
	
  
A	
  complete	
  list	
  of	
  all	
  configura1on	
  
op1ons	
  for	
   is	
  here.!Oboe::Config !
And	
  that’s	
  it.	
  Now	
  to	
  the	
  good	
  stuff…!
GeWng	
  Performance	
  
Data	
  
	
  
If	
  you	
  want	
  to	
  test	
  that	
  the	
  oboe	
  gem	
  is	
  
func1onal,	
  start-­‐up	
  a	
  Rails	
  console,	
  you	
  
should	
  see	
  a	
  message	
  to	
  stdout	
  
similar	
  to:	
  
	
   Tracelytics oboe gem 1.4.0.2 successfully loaded. !
Note	
  that	
  on	
  hosts	
  that	
  don’t	
  have	
  the	
  system	
  
daemon	
  installed,	
  the	
  oboe	
  gem	
  disables	
  itself	
  
and	
  outputs	
  a	
  message	
  to	
  that	
  fact:	
  
	
  
	
  
	
  
Deploy/restart	
  your	
  applica1on	
  and	
  you	
  should	
  
start	
  seeing	
  traces	
  show	
  up	
  in	
  your	
  TraceView	
  
dashboard	
  aKer	
  a	
  couple	
  minutes.	
  
Unsupported Tracelytics environment (no libs). Going No-op. !
Things	
  are	
  moving	
  fast	
  for	
  the	
  Ruby	
  
language	
  instrumenta1on	
  in	
  TraceView.	
  	
  
	
  
We	
  support	
  tracing	
  of:	
  
	
  
	
  
	
  
	
  
memcache-­‐client,	
  memcached,	
  	
  
dalli,	
  mongo,	
  	
  
moped,	
  mongoid,	
  
mongomapper,	
  cassandra,	
  	
  
Ac1veRecord	
  (postgres,	
  mysql,	
  mysql2)	
  
	
  
	
  
	
  …plus	
  more.	
  	
  
Most	
  recently	
  we	
  added	
  support	
  for	
  
Rack	
  and	
  Resque	
  tracing.	
  
	
  
For	
  a	
  full-­‐list	
  of	
  supported	
  libraries,	
  see	
  
this	
  ar1cle.!
Extras:	
  	
  
Some	
  Random	
  Chart	
  Porn	
  
	
  
A	
  screenshot	
  that	
  I	
  sent	
  to	
  Linode	
  when	
  
performance	
  unexpectedly	
  dropped:	
  	
  
Linode	
  migrated	
  my	
  VPS	
  to	
  a	
  lesser	
  
u1lized	
  host	
  with	
  evident	
  results	
  	
  
(Thanks	
  Linode):	
  	
  
An	
  older	
  issue	
  that	
  Gameface	
  had	
  with	
  
atrocious	
  rendering	
  1mes:	
  	
  
If	
  you	
  haven’t	
  tried	
  out	
  TraceView	
  
yet,	
  give	
  it	
  a	
  run.	
  
	
  
	
  You	
  won’t	
  be	
  disappointed.	
  
	
  
	
  
Note:	
  AppNeta	
  now	
  offers	
  free	
  tracing	
  for	
  single	
  
projects.	
  Check	
  it	
  out	
  on	
  their	
  pricing	
  page.	
  

Más contenido relacionado

Último

Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebUiPathCommunity
 
TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024Lonnie McRorey
 
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
 
Vertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsVertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsMiki Katsuragi
 
DSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningDSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningLars Bell
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr BaganFwdays
 
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
 
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
 
H2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo Day
H2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo DayH2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo Day
H2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo DaySri Ambati
 
Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Enterprise Knowledge
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLScyllaDB
 
"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
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationSlibray Presentation
 
SAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxSAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxNavinnSomaal
 
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdfHyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdfPrecisely
 
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
 
How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.Curtis Poe
 
Advanced Computer Architecture – An Introduction
Advanced Computer Architecture – An IntroductionAdvanced Computer Architecture – An Introduction
Advanced Computer Architecture – An IntroductionDilum Bandara
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):comworks
 

Último (20)

Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio Web
 
TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024
 
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
 
Vertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsVertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering Tips
 
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
 
DSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningDSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine Tuning
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan
 
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
 
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
 
H2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo Day
H2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo DayH2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo Day
H2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo Day
 
Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQL
 
"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
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck Presentation
 
SAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxSAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptx
 
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdfHyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
 
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?
 
How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.
 
Advanced Computer Architecture – An Introduction
Advanced Computer Architecture – An IntroductionAdvanced Computer Architecture – An Introduction
Advanced Computer Architecture – An Introduction
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):
 

Destacado

PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024Neil Kimberley
 
Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)contently
 
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024Albert Qian
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsKurio // The Social Media Age(ncy)
 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Search Engine Journal
 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summarySpeakerHub
 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd Clark Boyd
 
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next Tessa Mero
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentLily Ray
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best PracticesVit Horky
 
The six step guide to practical project management
The six step guide to practical project managementThe six step guide to practical project management
The six step guide to practical project managementMindGenius
 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...RachelPearson36
 
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...Applitools
 
12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at Work12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at WorkGetSmarter
 
Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...
Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...
Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...DevGAMM Conference
 

Destacado (20)

Skeleton Culture Code
Skeleton Culture CodeSkeleton Culture Code
Skeleton Culture Code
 
PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024
 
Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)
 
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie Insights
 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024
 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary
 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd
 
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search Intent
 
How to have difficult conversations
How to have difficult conversations How to have difficult conversations
How to have difficult conversations
 
Introduction to Data Science
Introduction to Data ScienceIntroduction to Data Science
Introduction to Data Science
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best Practices
 
The six step guide to practical project management
The six step guide to practical project managementThe six step guide to practical project management
The six step guide to practical project management
 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
 
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
 
12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at Work12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at Work
 
ChatGPT webinar slides
ChatGPT webinar slidesChatGPT webinar slides
ChatGPT webinar slides
 
More than Just Lines on a Map: Best Practices for U.S Bike Routes
More than Just Lines on a Map: Best Practices for U.S Bike RoutesMore than Just Lines on a Map: Best Practices for U.S Bike Routes
More than Just Lines on a Map: Best Practices for U.S Bike Routes
 
Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...
Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...
Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...
 

Instrumenting Ruby on Rails With Traceview

  • 1.     1   On  Building                :   Instrumen1ng  Ruby  with   TraceView  in  10  minutes       Peter  Lombardo   h$p://blog.gameface.in   h$p://www.appneta.com/blog  
  • 2. I’ve  been  a  Rubyist  and  Linux  addict  for  over  a  decade,  mainly   developing  in  Ruby  and  JavaScript  (as  well  as  PHP  and  Perl).  I’m  the   creator  of  numerous  soHware  tools  and  applicaIons,  most  recently   Password  Pusher,  a  Ruby  on  Rails  applicaIon  to  communicate   passwords  over  the  web  and  Gameface,  a  social  networking   plaLorm  for  gamers  using  Rails  3.       When  I’m  not  creaIng  my  own  applicaIons,  I  help  develop  and   maintain  the  infrastructure  at  OurStage  and  manage  the  Ruby   community  for  AppNeta.   Peter  Lombardo  
  • 3.   “Gameface  was  created  to     showcase  games,     the  people  who  play  them,   and  the  characters  they  play”    
  • 4.
  • 5. TraceView  by  AppNeta  gives  a  unique   in-­‐depth  view  into  requests  even  as   they  cross  hosts  and  soKware  stacks.     Installa1on  and  setup  of  TraceView  for   your  app  is  a  simple  two  step  process   that  can  be  done  in  10  minutes  or  less.     h$p://www.appneta.com/traceview   h$p://www.appneta.com/  
  • 6. TraceView  provides  deep  performance   monitoring  of  web  apps.     It  gives  insight  into  your  web  app   performance  such  as  this:          
  • 7.
  • 8. …and  a  per  request  drill-­‐down  that  shows   you  the  niOy  griOy  detail  of  where  1me  is   spent  in  individual  requests  
  • 9.
  • 10.
  • 11. and  even  end-­‐user  monitoring:      
  • 12.
  • 13. I  run  it  on  Gameface  and  PasswordPusher   -­‐  it’s  essen1al  in  iden1fying  problem   areas,  performance  boOlenecks  and  poor   performing  code.  (Read:  Ac1onView)         Disclaimer:  I  authored  the  Ruby  instrumenta6on  for  Traceview  so  I   may  be  a  bit  biased.  …but  with  good  reason!   h$p://gameface.in   h$p://pwpush.com/  
  • 15. Installing  TraceView  consists  of  two  parts:       1)  installing  the  system  daemon  on   your  host,  and     2)  installing  the  Ruby  gem  in  your   applica1on   h$p://www.appneta.com/apm-­‐datasheet  
  • 16. Why  a  system  daemon?       TraceView  uses  a  system  daemon  to  collect   instrumenta6on  from  sources  beyond   applica6on  code  such  as  host  metrics,   Apache  or  Resque.  
  • 17. The  system  daemon  is  installed  with   two  commands  that  can  be  pasted  into   your  shell.       An  account  specific  version  of  these   commands  is  available  in  your   TraceView  dashboard  once  you  create   an  account.       (Under  SeWngs;  App  Configura1on;  Trace  New  Hosts)    
  • 18.
  • 19. And  the  gem  for  your  applica1on   Gemfile  available  on  RubyGems:     h$ps://rubygems.org/gems/oboe   gem 'oboe' !
  • 21. TraceView  func1ons  by  sampling  a   subset  of  all  requests  that  go  through   your  web  applica1on.       This  sample  rate  must  be  set  at  the   entry  point  of  requests  in  your   applica1on.    
  • 22. This  can  be  a  load  balancer,  Apache/ nginx  or  Ruby  itself.       Successive  hosts  and  soKware  stacks   that  requests  pass  through  will  act   appropriately  according  to  upstream   seWngs.!
  • 23. Yes.       That  means  requests  can  be  traced   across  hosts,  so6ware  stacks,  even   track  internal  API  calls  via  HTTP/SOAP/ REST  which  make  for  spectacular   applicaEon  insight.     …But  that’s  another  post  for  another  Eme.    
  • 24. For  this  walkthrough  we’re  going  to   assume  that  you’re  running  a  Ruby  on   Rails  applica1on  with  Unicorn,  Thin,   Puma  or  any  other  Rack  based  Ruby   webserver.     To  instead  configure  Apache/nginx  as  the  entry  point,  see  here.  
  • 25. This  can  be  a  load  balancer,  Apache/ nginx  or  Ruby  itself.       Successive  hosts  and  soKware  stacks   that  requests  pass  through  will  act   appropriately  according  to  upstream   seWngs.!
  • 26. If  you  setup  Apache  or  nginx  as  your  entry   point  then  you  can  skip  this  part  enErely.     The                      gem  will  take  it’s  tracing   instrucEons  from  upstream  automaEcally.   Oboe!
  • 27. When  the                    gem  is  installed  in  your   applica1on,  it  makes  available     ! ! which  is  a  nested  hash  of  configura1on   op1ons  that  affect  how  your  applica1on  is   instrumented.   Oboe::Config ! Oboe!
  • 28. Luckily,  the  defaults  are  very  smart  and   only  a  couple  ini1al  values  need  to  be   configured.     The  two  required  values  are:    Oboe::Config[:tracing_mode] = 'always' ! Oboe::config[:sample_rate] = 100000 # 10% of incoming requests !
  • 29. These  values  enable  tracing   (:tracing_mode)  and  sets  the  sample  rate   to  10%  (:sample_rate).     The  sample_rate  is  calculated  by  the  value   out  of  one  million.       e.g.  300000  would  equal  a  30%  sample  rate  meaning  3  out   of  10  requests  would  be  sampled.       (For  low  traffic  sites,  you  may  want  to  set  these  values  higher.)!
  • 30. These  values  are  usually  set  in  a  Rails   ini1alizer  for  Ruby  on  Rails.       See  the  OpEonal  Rails  IniEalizer  sec1on   on  this  page.       A  complete  list  of  all  configura1on   op1ons  for   is  here.!Oboe::Config !
  • 31. And  that’s  it.  Now  to  the  good  stuff…!
  • 33. If  you  want  to  test  that  the  oboe  gem  is   func1onal,  start-­‐up  a  Rails  console,  you   should  see  a  message  to  stdout   similar  to:     Tracelytics oboe gem 1.4.0.2 successfully loaded. !
  • 34. Note  that  on  hosts  that  don’t  have  the  system   daemon  installed,  the  oboe  gem  disables  itself   and  outputs  a  message  to  that  fact:         Deploy/restart  your  applica1on  and  you  should   start  seeing  traces  show  up  in  your  TraceView   dashboard  aKer  a  couple  minutes.   Unsupported Tracelytics environment (no libs). Going No-op. !
  • 35. Things  are  moving  fast  for  the  Ruby   language  instrumenta1on  in  TraceView.       We  support  tracing  of:          
  • 36. memcache-­‐client,  memcached,     dalli,  mongo,     moped,  mongoid,   mongomapper,  cassandra,     Ac1veRecord  (postgres,  mysql,  mysql2)        …plus  more.    
  • 37. Most  recently  we  added  support  for   Rack  and  Resque  tracing.     For  a  full-­‐list  of  supported  libraries,  see   this  ar1cle.!
  • 38. Extras:     Some  Random  Chart  Porn    
  • 39. A  screenshot  that  I  sent  to  Linode  when   performance  unexpectedly  dropped:    
  • 40.
  • 41. Linode  migrated  my  VPS  to  a  lesser   u1lized  host  with  evident  results     (Thanks  Linode):    
  • 42.
  • 43. An  older  issue  that  Gameface  had  with   atrocious  rendering  1mes:    
  • 44.
  • 45. If  you  haven’t  tried  out  TraceView   yet,  give  it  a  run.      You  won’t  be  disappointed.       Note:  AppNeta  now  offers  free  tracing  for  single   projects.  Check  it  out  on  their  pricing  page.