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

Sua aplicação não precisa ser uma Caixa Preta @...

Sua aplicação não precisa ser uma Caixa Preta @ GDG DevFest Extended Belo Horizonte

É comum medirmos a velocidade de desenvolvimento de um time, o número de horas investidas na correção de bugs e até a densidade de comentários no código. Porém, quando o serviço chega em produção, muitas vezes essa cultura é esquecida. Esta palestra aborda como empregar logs e métricas calculadas em tempo de execução para aprimorar e melhor entender sistemas.

Thiago Cardoso

March 28, 2015
Tweet

More Decks by Thiago Cardoso

Other Decks in Programming

Transcript

  1. 127.0.0.1 - - [27/Mar/2015 07:26:19] "GET / HTTP/1.1" 200 -

    [22/Aug/2014:18:27:54 -0400] "GET / HTTP/1.1" 301 625 "-" "UserAgent" [ 4927.914673] IPv6: ADDRCONF(NETDEV_UP): eth0: link is not ready
  2. 127.0.0.1 - - [27/Mar/2015 07:26:19] "GET / HTTP/1.1" 200 -

    [22/Aug/2014:18:27:54 -0400] "GET / HTTP/1.1" 301 625 "-" "UserAgent" [ 4927.914673] IPv6: ADDRCONF(NETDEV_UP): eth0: link is not ready LOG = TIMESTAMP + DADOS
  3. Lumberjack ♫ I'm a lumberjack and I'm ok! I sleep

    when idle, then I ship logs all day! I parse your logs, I eat the JVM agent for lunch! ♫ Beaver python daemon that munches on logs and sends their contents to logstash
  4. [27/02/15 18:20:03] ERROR crawler. RSSCrawler:: Could not fetch page java.net.MalformedURLException:

    unknown at java.net.URL.<init>(URL.java:592) at java.net.URL.<init>(URL.java:482)
  5. [27/02/15 18:20:03] ERROR crawler. RSSCrawler:: Could not fetch page java.net.MalformedURLException:

    unknown at java.net.URL.<init>(URL.java:592) at java.net.URL.<init>(URL.java:482) { "timestamp": "2015-02-27T18:20:03.000Z", "level": "ERROR", "class": "crawler.RSSCrawler", "message": "Could not fetch page java.net. MalformedURLException: unknown at java.net.URL.<init>(URL.java:592) at java.net.URL.<init>(URL.java:482)", "host": "server1" }
  6. Auditar a execução do programa Encontrar a origem de problemas

    Estatísticas: qual pedaço do código gera mais bugs?
  7. “Measurement is the first step that leads to control and

    eventually to improvement. If you can't measure something, you can't understand it. If you can't understand it, you can't control it." H. James Harrington
  8. Timer Tempo médio: Tempo de resposta Tempo de processamento N

    bytes no request executionTime("ns.proc", 100)
  9. Por 24 horas, guarde as métricas em intervalos de 1

    minuto Por 7 dias, guarde as métricas em intervalos de 5 minutos Por 1 ano, guarde as métricas em intervalos de 1 hora
  10. Pode ser usado para encontrar gargalos e problemas de performance

    Detecção rápida de comportamento inesperado em novas versões
  11. Centraliza, filtra e realiza ações no stream de eventos Arquivo

    de configuração é um programa clojure Regras arbitrariamente complexas
  12. Send by Helder Mundim, Noun Project, https://thenounproject.com/term/send/43306/ Server by James

    Keuning, Noun Project, https://thenounproject.com/term/server/11319/ Layers by Lloyd Humphreys, Noun Project, https://thenounproject.com/term/layers/96716/ Puzzle Piece by iconsmind.com, Noun Project, https://thenounproject.com/term/puzzle-piece/73250/ Process by Takao Umehara, Noun Project, https://thenounproject.com/term/process/14970/ Abacus by Michelle Colonna, Noun Project, https://thenounproject.com/term/abacus/111924/ Stopwatch by Dmitry Baranovskiy, Noun Project, https://thenounproject.com/term/stopwatch/5060/ Alert by Laurent Sutterlity, Noun Project, https://thenounproject.com/term/alert/11062/ Alarm by Mister Pixel, Noun Project, https://thenounproject.com/term/alarm/36776/ Gauge by Olivier Guin, Noun Project, https://thenounproject.com/term/gauge/8760/ Chart by Alex Auda Samora, Noun Project, https://thenounproject.com/term/chart/34703/ Web-Design by Wilson Joseph, Noun Project, https://thenounproject.com/term/web-design/63344/ Database by Mister Pixel, Noun Project, https://thenounproject.com/term/database/36146/ Log by Arthur Schmitt, Noun Project, https://thenounproject.com/term/log/8496/ CC Icons