Upgrade to Pro — share decks privately, control downloads, hide ads and more …

The Truth Is Out There... Monitoring Your Isomorphic Application

Rob
September 10, 2017

The Truth Is Out There... Monitoring Your Isomorphic Application

Going a full circle from web-masters to HTML developers and expert JavaScript engineers, more product teams are closing the loop by working towards full-stack JS teams capable of implementing whole (or a most of) features from scratch and even deploy it to customer facing servers. Stepping up the stack and doing more Node.js to power your back-ends, what could be more important than a good night sleep with proper monitoring set-up?

Robert will guide you through monitoring essentials to make sure your isomorphic JS application, or a set of microservices, are performing stable and power your business without hikups. Learn about tools, isomorphic logging solutions, performance and stability measurement approaches and stay confident in your uptimes.

Talk from http://css-minsk-js.by

Rob

September 10, 2017
Tweet

More Decks by Rob

Other Decks in Technology

Transcript

  1. The Truth Is Out There...
    Robert Haritonov

    Tech Lead @
    Monitoring Your Isomorphic
    Application

    View Slide

  2. Zoover.nl is a travel website

    3-4M
    Users a 

    month
    10+
    Years on the
    market

    View Slide

  3. Rebuild everything from scratch


    View Slide

  4. What is monitoring?
    • Measuring
    • Recording
    • Alerting
    • Visualising

    View Slide

  5. Isomorphic == Fullstack

    View Slide

  6. Full-stack culture

    View Slide

  7. Monitoring:
    Why should you care?
    • Be confident in your product performance

    View Slide

  8. "Our code generates business value
    when it runs, not when we write it"
    - Coda Hale,
    "Metrics, metrics, everywhere"

    View Slide

  9. Monitoring:
    Why should you care?
    • Be confident in your product performance
    • Stay one step ahead, fix bugs before they affect UX
    • Good night sleep

    View Slide

  10. What to monitor?
    • Business and tech performance
    • Error and Success
    • Throughput and availability metrics

    View Slide

  11. Logging and Error Tracking


    View Slide

  12. "Anything that can go wrong
    will go wrong"
    - Murphy's law

    View Slide

  13. Error tracking services
    • Rollbar, Sentry, Bugsnag, New Relic...
    • Allow good discovery tools and alerting
    • Custom and auto-grouping
    • Source Maps, version tracking, and more...

    View Slide

  14. Client-side logging
    • Propagate errors to tracking services (or own storage)
    • Log user actions for debugging and analytics
    • Provide useful context with errors (status code, description)
    • Keep the stack traces

    View Slide

  15. "Undefined is not a function"
    - Your favourite browser

    View Slide

  16. Bad

    View Slide

  17. Good ✅

    View Slide

  18. Server-side logging
    • Log in JSON with most context data you can get:
    • Code version, host, timestamp
    • Request parameters (logging middlewares)
    • Loggers like Bunyan support streams for log propagation

    View Slide

  19. Streaming Logs

    View Slide

  20. Isomorphic Logger

    View Slide

  21. Isomorphic Logger

    View Slide

  22. Isomorphic Logger

    View Slide

  23. Isomorphic Logger

    View Slide

  24. Isomorphic Logger

    View Slide

  25. Notes from the field
    • International messages
    • Default Grouping could go wrong
    • Configure events throttling
    • Google bots from real devices will spawn uncommon errors

    View Slide

  26. Configuration Tips

    View Slide

  27. Configuration Tips

    View Slide

  28. Configuration Tips

    View Slide

  29. Throughput and Availability Metrics


    View Slide

  30. "If it could affect your code’s 

    business value, add a metric."
    - Coda Hale,
    "Metrics, metrics, everywhere"

    View Slide

  31. Tools We Use
    • Prometheus - metrics aggregator
    • Grafana - data visualizations
    • Pingdom - uptime monitoring

    View Slide

  32. View Slide

  33. Prometheus
    • Exposes `/metrics` endpoint
    • Supports numerous clients, including Node.js
    • Exports default metrics - CPU, Memory, Event Loop Lag
    • And custom - Counter, Gauge, Histogram

    View Slide

  34. Default metrics

    View Slide

  35. View Slide

  36. Custom Metrics
    • Counter - for values only going up (req count, etc)
    • Gauge - instantaneous value of something (hardware metrics)
    • Histogram - the statistical distribution of values (req duration, etc)

    View Slide

  37. Count Rendered Documents

    View Slide

  38. Count Rendered Documents

    View Slide

  39. Count Render Times

    View Slide

  40. Count Render Times

    View Slide

  41. More Prometheus Exporters
    • Redis, Memcached
    • Elasticsearch, PostgreSQL
    • Thumbor (image processing)
    • Google Analytics Reporting - infinityworks/gar-exporter

    View Slide

  42. Alerting


    View Slide

  43. Alerting
    • Pagerduty - alerts aggregations
    • Duty calendar

    View Slide

  44. Duty Calendar

    View Slide

  45. Alerting
    • Pagerduty - alerts aggregations
    • Duty calendar
    • Integration with Rollbar, Pingdom and other

    View Slide

  46. Grafana Alerting

    View Slide

  47. "Anything that can go wrong
    will go wrong"
    - Murphy's law

    View Slide

  48. View Slide

  49. Thank you!
    Robert Haritonov

    Tech Lead @

    View Slide