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

月間動画再生数2億回を支える TVerのオブザーバビリティ

月間動画再生数2億回を支える TVerのオブザーバビリティ

2022/03/11
Observability Conference 2022

イベントURL :
https://event.cloudnativedays.jp/o11y2022

TVer Inc.

March 11, 2022
Tweet

More Decks by TVer Inc.

Other Decks in Technology

Transcript

  1. New Relic OneಋೖʹΑΔվળͷτϥΠ [࠶ܝ] ϞχλϦϯάपΓͷ՝୊ • Ϣʔβʔମݧͷ೺Ѳ • Մ༻ੑ΍ύϑΥʔϚϯεͷՄࢹԽ •

    ໰୊ൃੜ࣌ͷਝ଎ͳղܾ • ϓϩΞΫςΟϒͳϞχλϦϯά • SLI / SLOʹΑΔ৴པੑͷՄࢹԽ γεςϜͷ؍ଌൣғΛ޿͛Δඞཁ͕͋Δ
  2. New Relic OneಋೖʹΑΔվળͷτϥΠ Why New Relic One • ڧྗͳϑϩϯτΤϯυϞχλϦϯά •

    ΦϒβʔόϏϦςΟϓϥοτϑΥʔϜ • શํҐͰͷϞχλϦϯά͕Մೳ
  3. New Relic OneಋೖʹΑΔվળͷτϥΠ New Relic Oneͷಋೖঢ়گ (2021೥12݄) • ΠϯςάϨʔγϣϯ •

    ΠϯϑϥετϥΫνϟʔϞχλϦϯά • ϒϥ΢βϞχλϦϯά • ϞόΠϧϞχλϦϯά • ֎ܗ؂ࢹ
  4. ΦϒβʔόϏϦςΟ࠶ઃܭ New Relicͷߟ͑ΔΦϒβʔόϏϦςΟ(2) “New Relic ͸ϝτϦΫεɺΠϕϯτɺϩάɺ͓ΑͼτϨʔε 
 ʢMELT : Metrics,

    Events, Logs, TracesʣΛՄ؍ଌੑ࣮ݱͷ 
 جຊతͳσʔλλΠϓͩͱߟ͍͑ͯ·͢ɻ 
 ͢΂ͯΛܭଌ͠ɺMELTΛ࢖༻ͯ͠γεςϜ಺ͷؔ܎ͱґଘؔ܎ɺ 
 ͦͯͦ͠ͷৄࡉͳύϑΥʔϚϯεͱਖ਼ৗੑΛҡ࣋͢Δ͜ͱ͕ 
 Մ؍ଌੑΛ࣮ݱ͢ΔͨΊʹॏཁͰ͢ɻ” Metrics, Events, Logs, Traces ͬͯͳΜͩʁ
 https://newrelic.com/jp/blog/how-to-relic/metrics-events-logs-and-traces
  5. ΦϒβʔόϏϦςΟ࠶ઃܭ Googleͷߟ͑ΔΦϒβʔόϏϦςΟ(2)
 “ϗϫΠτϘοΫε ϞχλϦϯά ϞχλϦϯάͱΦϒβʔόϏϦςΟ͸ɺϫʔΫϩʔυ͔ΒϞχλϦϯά γεςϜ ʹૹ৴͞ΕΔγάφϧʹґଘ͠·͢ɻ࠷΋Ұൠతͳཁૉͱͯ͠͸ɺࢦඪɺϩάɺ τϨʔεͷ 3 ͕ͭ͋Γ·͢ɻҰ෦ͷϞχλϦϯά

    γεςϜͰ͸ΠϕϯτΛ௥੻͠ ͯใࠂ͠·͢ɻΠϕϯτ͸ɺγεςϜͰͷϢʔβʔͷૢ࡞΍γεςϜࣗମͷঢ়ଶ ͷมԽΛද͠·͢ɻ” DevOps ଌఆ: ϞχλϦϯάͱΦϒβʔόϏϦςΟ
 https://cloud.google.com/architecture/devops/devops-measurement-monitoring-and-observability
  6. ΦϒβʔόϏϦςΟ࠶ઃܭ [ํ਑] શͯͷγεςϜͰMELTΛܭଌ͢Δ • ☑ ΠϯςάϨʔγϣϯ (֦ॆ) • ☑ ΠϯϑϥετϥΫνϟʔϞχλϦϯά

    • ☑ ϒϥ΢βϞχλϦϯά • ☑ ϞόΠϧϞχλϦϯά • ☑ ֎ܗ؂ࢹ • ☐ APM (௥Ճ) • ☐ Log Management (௥Ճ)
  7. ΦϒβʔόϏϦςΟ࠶ઃܭ [before]
 ෦෼తʹMELT͕
 ຬͨ͞Ε͍ͯΔঢ়ଶ 
 ɾAWS Integration
 ɹMetrics & Events

    ɾBrowser(Mobile)Agent
 ɹMetrics & Events ɾInfrastructure Agent
 ɹMetrics & Events
  8. ΦϒβʔόϏϦςΟ࠶ઃܭ [after]
 MELT͕શͯ
 ຬͨ͞Ε͍ͯΔঢ়ଶ 
 ɾAWS Integration
 ɹMetrics & Events

    ɾCloudWatch Logs
 ɹto New Relic One
 ɹLogs ɾBrowser(Mobile)Agent
 ɹMetrics & Events ɾGo Agent
 ɹMetrics & Traces ɾInfrastructure Agent
 ɹMetrics & Events
  9. ΞϓϦέʔγϣϯϞχλϦϯά (APM) import ( "github.com/newrelic/go-agent/v3/newrelic" "github.com/newrelic/go-agent/v3/integrations/nrecho-v3" ) func main() {

    app, err := newrelic.NewApplication( newrelic.ConfigAppName("my test app"), newrelic.ConfigLicense("__YOUR_NEW_RELIC_LICENSE_KEY__"), ) } GoΞϓϦέʔγϣϯ΁ͷಋೖ
  10. ΞϓϦέʔγϣϯϞχλϦϯά (APM) ಋೖ࣌ͷۤ࿑࿩ • New Relic Go Agentͷಋೖ͕͠ΜͲ͍ ◦ ਖ਼֬ͳτϨʔε৘ใΛٻΊΔ৔߹ɺ


    ෳ਺ͷfunctionʹίʔυΛૠೖ͢Δඞཁ͕͋Δ ◦ ΫϦʔϯͳಋೖํ๏͕ग़ͨ৔߹ɺ
 ૠೖͨ͠ίʔυΛফ͢ඞཁ͕͋ΔͷͰ͸ʁ ◦ pprofΛ׆༻Ͱ͖ͳ͍͔ʁ nrseg (budougumi0617)
 https://github.com/budougumi0617/nrseg
  11. ΞϓϦέʔγϣϯϞχλϦϯά (APM) ղܾ • New Relic Go Agentͷಋೖ͕͠ΜͲ͍ ◦ ࣮͸func

    main()ʹಋೖ͢Δ͚ͩͰ
 ͋Δఔ౓ͷσʔλ͕ಘΒΕΔࣄ͕൑໌ ◦ DBपΓͷτϨʔε͸ޙ೔ରԠʹͨ͠
 (ContextपΓͰ௥Ճͷ࣮૷͕ඞཁͳͨΊ)
  12. ΞϓϦέʔγϣϯϞχλϦϯά (APM) ಋೖͰಘΒΕͨޮՌ • APIͷύϑΥʔϚϯεվળʹܨ͕ͬͨ ◦ ஗͍APIͷϨΠςϯγ͕ՄࢹԽ͞Εͨ ◦ Ωϟογϡར༻౳Ͱվળ •

    ༏ઌతʹվળ͢΂͖ର৅͕໌֬ʹͳͬͨ ◦ APIผͷݺͼग़͠ճ਺ͱ࣮ߦ͕࣌ؒՄࢹԽ͞Εͨ • ΞϓϦέʔγϣϯΤϥʔͷௐ͕ࠪਝ଎ʹͳͬͨ ◦ ࠷௿ݶͷτϦΞʔδ͕Ͱ͖ΔΑ͏ʹͳͬͨ
  13. ϒϥ΢βϞχλϦϯά ಋೖ࣌ͷۤ࿑࿩ • ίωΫςουTV΁ͷಋೖ͕ͭΒ͔ͬͨ ◦ PageViewͰΧελϜΞτϦϏϡʔτ͕औಘͰ͖ͳ͍ ◦ ϖʔδϩʔυͷλΠϛϯά͕೉͍͠ ◦ ϑϩϯτΤϯυԿ΋Θ͔Βͳ͍

    ϖʔδϩʔυλΠϛϯάͷϓϩηε
 https://docs.newrelic.com/jp/docs/browser/new-relic-browser/page-load-timing-resources/page-load-timing-process/
  14. ϞόΠϧϞχλϦϯά ϞόΠϧϞχλϦϯάͱ͸ • ΞϓϦܦ༝ͰͷΤϯυϢʔβʔϞχλϦϯά • RUM (Real User Monitoring) ओͳ༻్

    • ύϑΥʔϚϯε෼ੳ • ΫϥογϡͷτϥϒϧγϡʔςΟϯά • Ϣʔβʔମݧͷ೺Ѳ
  15. before ☐ Ϣʔβʔମݧͷ೺Ѳ ☐ Մ༻ੑ΍ύϑΥʔϚϯεͷՄࢹԽ ☐ ໰୊ൃੜ࣌ͷਝ଎ͳղܾ ☐ ϓϩΞΫςΟϒͳϞχλϦϯά ☐

    SLI / SLOʹΑΔ৴པੑͷՄࢹԽ ·ͱΊ (ϞχλϦϯάपΓͷ՝୊) after ☑ Ϣʔβʔମݧͷ೺Ѳ ☑ Մ༻ੑ΍ύϑΥʔϚϯεͷՄࢹԽ ☑ ໰୊ൃੜ࣌ͷਝ଎ͳղܾ ☐ ϓϩΞΫςΟϒͳϞχλϦϯά ☐ SLI / SLOʹΑΔ৴པੑͷՄࢹԽ