Slide 1

Slide 1 text

Life with Datadog Takeshi Kondo / @chaspy 2021/01/24 July Tech Festa Winter 2021

Slide 2

Slide 2 text

Who am I chaspy chaspy_ Lead Software Engineer Site Reliability at Quipper Takeshi Kondo

Slide 3

Slide 3 text

Japan Datadog User Group Organizer • https://datadog-jp.connpass.com/

Slide 4

Slide 4 text

Software Design 2݄߸ʹDatadog ϋϯζΦϯهࣄΛدߘ • ʲୈ2ಛूʳγεςϜ؂ࢹͷ࢝Ίํɾଓ͚ํ ୈ3ষ Datadog Ͱ࣮ફ͢ΔSaaS؂ࢹ https://twitter.com/chaspy_/status/1350270946767081472?s=20 Datadog ॳ৺ऀͷํ͸ͥͻʂ

Slide 5

Slide 5 text

TγϟπͱۺԼ͍͖ͨͩ·ͨ͠ https://twitter.com/chaspy_/status/1352577570278043649?s=20 ཉ͍͠ͻͱ͸ meetup Ͱ࿩ͨ͠Γ ϞϒϓϩࢀՃ͢Δͱ΋Β͑Δ͔΋ʂ

Slide 6

Slide 6 text

ࠓ೔͸ Datadog ΁ͷѪΛޠΓ·͢ https://www.datadoghq.com/about/resources/ Monitoring SaaS

Slide 7

Slide 7 text

ࠓ೔ͷൃද • ର৅ • γεςϜӡ༻ऀ • Monitoring SaaS ʹڵຯ͕͋Δͻͱ • Datadog ʹڵຯ͕͋Δͻͱ • ΰʔϧ • Datadog ͷྑ͞Λ஌Δ • Datadog ͷ༷ʑͳԠ༻ػೳΛ஌Δ͜ͱͰ׆༻ͷώϯτΛಘΔ

Slide 8

Slide 8 text

Agenda • Datadog ͷ޷͖ͳͱ͜Ζ • ϓϩμΫτѪᷓΕΔαϙʔτ • ϦονͰΩϡʔτͳ GUI • SLO Summary & Alert • Datadog ͱͷੜ׆ • Monitor Summary • Weekly Summary • Alfred ͱͷ૊Έ߹Θͤ • Datadog ͱͷੜ׆ Ԡ༻ฤ • Datadog Cost ͱͷ޲͖߹͍ํ • ৽نαʔϏεͱ Datadog • Custom Metrics ͷ׆༻

Slide 9

Slide 9 text

Agenda • Datadog ͷ޷͖ͳͱ͜Ζ • ϓϩμΫτѪᷓΕΔαϙʔτ • ϦονͰΩϡʔτͳ GUI • SLO Summary & Alert • Datadog ͱͷੜ׆ • Monitor Summary • Weekly Summary • Alfred ͱͷ૊Έ߹Θͤ • Datadog ͱͷੜ׆ Ԡ༻ฤ • Datadog Cost ͱͷ޲͖߹͍ํ • ৽نαʔϏεͱ Datadog • Custom Metrics ͷ׆༻

Slide 10

Slide 10 text

Datadog ͷ޷͖ͳͱ͜Ζɿαϙʔτ͕͍͢͝ • Ϩεϙϯε͕ૣ͍(΄΅࣮֬ʹ24hҎ಺ʹؼͬͯ͘Δʣ • ճ౴͕త֬ • Ͱ͖ͳ͍͜ͱͰ΋ϫʔΫΞϥ΢ϯυΛҊ಺ͯ͘͠ΕΔ • ϓϩμΫτΛྑ͘͠Α͏ͱ͍͏࢟੎͕ݟ͑Δ

Slide 11

Slide 11 text

αϙʔτʹ͓ئ͍͢Δํ๏ • جຊνέοτΛىථͯ͠Δʢӳޠʣ • Help -> resource -> Tickets & Email Support • Ͳ͏ͯ͠΋ӳޠແཧͳΒ೔ຊޠͰͷճ౴Λ͓ئ͍͢Ε͹೔ຊ αϙʔτʹӦۀ࣌ؒͯ͘͠ΕΔΒ͍͠ • Event Stream ʹ @support-datadog Λଧͯ͹ live chat ΋Ͱ ͖ΔΒ͍͠ʢ΍ͬͨ͜ͱͳ͍͕ʣ

Slide 12

Slide 12 text

աڈͷ࣭໰ྫ • Terraform Ͱ SLO ͷ Apply ͕ Invalid Query ͰౖΒΕΔ • Monitor Summary Λ metrics ͱͯ͠औΕͳ͍͔૬ஊ • EKS Control Plane ͷ metrics औಘํ๏ • SLO ҧ൓ͨ͠ͱ͖ʹΞϥʔτΛඈ͹͢ํ๏ • API Key ͷ਺Λ૿΍ͤͳ͍͔૬ஊ

Slide 13

Slide 13 text

աڈͷ࣭໰ྫ • Terraform Ͱ SLO ͷ Apply ͕ Invalid Query ͰౖΒΕΔ • Monitor Summary Λ metrics ͱͯ͠औΕͳ͍͔૬ஊ • EKS Control Plane ͷ metrics औಘํ๏ • SLO ҧ൓ͨ͠ͱ͖ʹΞϥʔτΛඈ͹͢ํ๏ • API Key ͷ਺Λ૿΍ͤͳ͍͔૬ஊ

Slide 14

Slide 14 text

Monitor Summary Λ metrics ͱͯ͠औΕͳ͍͔૬ஊ • Monitor Summary ஌ͬͯ·͔͢ʁ • िʹҰ౓ϝʔϧདྷͯΔ΍ͭ • https://app.datadoghq.com/report/monitor • ࣮͸ GUI ͔Βಋઢ͕ͳ͍ʢϝʔϧ͔Β͔͠ඈ΂ͳ͍ʣ

Slide 15

Slide 15 text

Monitor Summary

Slide 16

Slide 16 text

Monitor Summary ೚ҙͷνϟϯωϧͷΞϥʔτ ͚ͩϑΟϧλ͍ͨ͠

Slide 17

Slide 17 text

Raw data(CSV) ͕ api ͰऔΕΔΒ͍͠ • CSV ͕μ΢ϯϩʔυͰ͖Δ • ͜ͷ CSV ͔Β custom metrics ΛૹΔίʔυΛॻ͍ͨ https://app.datadoghq.com/report/hourly_data/monitor https://docs.datadoghq.com/monitors/faq/how-can-i-export-alert-history/?tab=us

Slide 18

Slide 18 text

SLO ҧ൓ͨ͠ͱ͖ʹΞϥʔτΛඈ͹͢ํ๏ • ౰࣌͸·ͩ SLO Error Budget Alert ͷػೳ͸ͳ͔ͬͨ • Product Manager ͕ग़ͯ͘Δɻͦͷػೳ͸ઈࢍ։ൃதͰɺ ϢʔβΠϯλϏϡʔΛͤͯ͘͞Εͳ͍͔ͱݴͬͯ͘Δ • Support Ticket ্Ͱ͍͔࣭ͭ͘໰ʹ౴͑Δ • ͦͷޙແࣄ SLO Alert Beta ϦϦʔε!

Slide 19

Slide 19 text

Τϯήʔδϝϯτͷߴ·Γ

Slide 20

Slide 20 text

ϦονͰΩϡʔτͳGUI

Slide 21

Slide 21 text

ϦονͰΩϡʔτͳGUI • ՄࢹԽͷํ๏͕ଟ͍ • ͙͢ʹ൓ө͞ΕΔ • ؔ਺͕ଟ͍ • ίϐϖָ͕

Slide 22

Slide 22 text

࣮ࡍʹάϥϑΛ͍ͬͯ͡ΈΑ͏

Slide 23

Slide 23 text

SLO Summary & Alert

Slide 24

Slide 24 text

SLO Summary & Alert

Slide 25

Slide 25 text

Datadog ͷ SLO ػೳ͸ͳͯ͘͸ͳΒͳ͍૬๮ https://quipper.hatenablog.com/entry/2020/01/30/slo-review

Slide 26

Slide 26 text

Terraform ؅ཧ & generator Ͱ৽نαʔϏε࡞ ੒࣌ʹ΋؆୯ʹ࡞੒Ͱ͖Δ ࣮ࡍʹݟͯΈΑ͏

Slide 27

Slide 27 text

Agenda • Datadog ͷ޷͖ͳͱ͜Ζ • ϓϩμΫτѪᷓΕΔαϙʔτ • ϦονͰΩϡʔτͳ GUI • SLO Summary & Alert • Datadog ͱͷੜ׆ • Monitor Summary • Weekly Summary • Alfred ͱͷ૊Έ߹Θͤ • Datadog ͱͷੜ׆ Ԡ༻ฤ • Datadog Cost ͱͷ޲͖߹͍ํ • ৽نαʔϏεͱ Datadog • Custom Metrics ͷ׆༻

Slide 28

Slide 28 text

Monitor Summary Λຖே Daily Standup Ͱݟ͍ͯΔ

Slide 29

Slide 29 text

Monitor Summary • >muted:false tag:(("severity:alert" OR "severity:emergency") AND "team:sre") • ͢΂ͯͷ Alert ʹ severity tag ͱ team tag ͕͍͍ͭͯΔ • ࣗ෼ͨͪͷ୲౰ͷΞϥʔτͷΈΛ Daily Standup Ͱ Check • NG ͩͬͨΒ೔ຖͷ୲౰ऀ͕ରॲ͢Δ

Slide 30

Slide 30 text

Weekly Summary • ͜͏͍͏ϝʔϧ͕དྷ͍ͯ·͢ • [Monitor Report] You received xxx alerts

Slide 31

Slide 31 text

Weekly Summary • ࣮͸͜͜ͰݟΕΔ • https://app.datadoghq.com/report/monitor • ΫϦοΫ͢Δͱि΍࣌ؒଳ΍Ξϥʔτνϟϯωϧɺmonitor ͰߜΓࠐΈ͕Ͱ͖Δ • ͜ΕΛݟͯΞϥʔτͷ਺ࣗମͷਪҠΛ௥͍ͬͯΔ

Slide 32

Slide 32 text

Alfred ͱͷ૊Έ߹Θͤ • Dashboard, monitor, SLO Λαοͱ։͚ΔΑ͏ʹ • Web Search ొ࿥͍ͯ͠Δ • ddd https://app.datadoghq.com/dashboard/lists?q={query} • ddm https://app.datadoghq.com/monitors/manage?q={query} • ddslo https://app.datadoghq.com/slo?query={query}

Slide 33

Slide 33 text

Agenda • Datadog ͷ޷͖ͳͱ͜Ζ • ϓϩμΫτѪᷓΕΔαϙʔτ • ϦονͰΩϡʔτͳ GUI • SLO Summary & Alert • Datadog ͱͷੜ׆ • Monitor Summary • Weekly Summary • Alfred ͱͷ૊Έ߹Θͤ • Datadog ͱͷੜ׆ Ԡ༻ฤ • Datadog Cost ͱͷ޲͖߹͍ํ • ৽نαʔϏεͱ Datadog • Custom Metrics ͷ׆༻

Slide 34

Slide 34 text

Datadog Cost ͷܭࢉࣜ • ݄ؒͷϗετ਺ͷ 99 percentile (max Ͱ͸ͳ͍) • ϗετ਺Λ࡟ݮ͢Δͱ Datadog Cost ΋ݮΔ • ϗετ਺ΛݮΒ͔͢͠ͳ͍ʢԦಓͳ͠ʣ

Slide 35

Slide 35 text

৽نαʔϏεͱ Datadog • ৽نαʔϏεߏங࣌ʹ͸"Production Readiness Checklist" ͕͋Δ https://quipper.hatenablog.com/entry/2020/01/30/production-readiness-with-all

Slide 36

Slide 36 text

Production Readiness Checklist - Monitoring / Logging

Slide 37

Slide 37 text

Template Dashboard

Slide 38

Slide 38 text

࣮ࡍʹ Template Dashboard ΛݟͯΈΑ͏

Slide 39

Slide 39 text

Production Readiness Checklist - SLI/SLO • Generator Λ࢖ͬͯ࡞ͬͯ Dashboard ʹ௥Ճ͢Δ͚ͩʂ • SLO ࣗମΛԿʹ͢Δ͔͸ Design Doc ϑΣʔζͰࡦఆ͢Δ

Slide 40

Slide 40 text

Custom metrics ͷ׆༻ྫ • CI Ͱ͔͔ͬͨ࣌ؒΛଌఆ • Docker build ͷ࣌ؒɺ֤ςετͷ࣌ؒͳͲ • CircleCI ͷίετΛଌఆɺՄࢹԽ • Dependabot ʹΑͬͯ open ʹͳͬͯΔ PR ਺ΛՄࢹԽ • εύΠΫΞΫηεΛ๷͙ͨΊʹෛՙ৘ใΛ custom metrics ͱͯ͠ૹ ΓɺKubernetes HPA ͔Βར༻

Slide 41

Slide 41 text

Kubernetes meetup tokyo #38 Ͱ࿩͠·ͨ͠ https://twitter.com/chaspy_/status/1352194206962388995?s=20 https://speakerdeck.com/chaspy/v2beta2-and-examples-of-using-hpa-external-metrics-with-datadog https://quipper.hatenablog.com/entry/2020/11/30/scheduled-scaling-with-hpa

Slide 42

Slide 42 text

Custom metric ͱͯ͠਎ͷճΓͷ৘ใΛૹΔϝϦοτ • ݱঢ়ΛՄࢹԽͰ͖Δ • ೚ҙͷλά౳ͰϑΟϧλ/আ֎Ͱ͖Δ • Metric ͔ΒΞϥʔτΛൃ๒Ͱ͖Δ

Slide 43

Slide 43 text

Custom metrics ΛૹΔ design pattern • Kubernetes ؀ڥͩͱ Autodiscovery ػೳ͕ศར https://docs.datadoghq.com/agent/kubernetes/integrations/?tab=kubernetes API ͕͋Δ֎෦γεςϜ Custom metric ੜ੒͢Δ܅ (Kubernetes Deployment) API Ͱσʔλऔಘ Datadog-agent http Ͱ prometheus ܗࣜͰ metric Λ export

Slide 44

Slide 44 text

Custom metrics ΛૹΔ design pattern • Kubernetes ؀ڥͩͱ Autodiscovery ػೳ͕ศར https://docs.datadoghq.com/agent/kubernetes/integrations/?tab=kubernetes API ͕͋Δ֎෦γεςϜ Custom metric ੜ੒͢Δ܅ (Kubernetes Deployment) API Ͱσʔλऔಘ Datadog-agent 1 annotations: 2 ad.datadoghq.com/timed-exam-schedule-exporter.check_names: | 3 ["prometheus"] 4 ad.datadoghq.com/timed-exam-schedule-exporter.init_configs: | 5 [{}] 6 ad.datadoghq.com/timed-exam-schedule-exporter.instances: | 7 [ 8 { 9 "prometheus_url": "http://%%host%%:8080/metrics", 10 "namespace": "namespace", 11 "metrics": ["*"] 12 } 13 ]

Slide 45

Slide 45 text

Custom metrics ΛૹΔ design pattern • Kubernetes ؀ڥͩͱ Autodiscovery ػೳ͕ศར https://docs.datadoghq.com/agent/kubernetes/integrations/?tab=kubernetes API ͕͋Δ֎෦γεςϜ Custom metric ੜ੒͢Δ܅ (Kubernetes Deployment) API Ͱσʔλऔಘ Datadog-agent • GitHub ͷ PR ΍ issue • AWS Security Event(GuardDuty / ECR Image Scan) • OS ͝ͱͷ EC2 Horst ਺ • RDS ͷ version ͝ͱͷΫϥελ਺

Slide 46

Slide 46 text

·ͱΊ • Datadog Ͱ෼͔Βͳ͍͜ͱ͕͋ͬͨΒ... • ͙͢ʹ Support ʹฉ͜͏ʂૣͯ͘ஸೡʂ • Japan Datadog User Group ͷ Slack Ͱฉ͍ͯ΋ okʂ • Monitor Summary ͱ Weekly Report Ͱ Monitor ࣗମ΋ݮΒͯ͠ ͍͜͏ • Custom metrics ͦ͜ Datadog ͷ୉ޣຯɺͲΜͲΜ׆༻͠Α͏ʂ

Slide 47

Slide 47 text

More • ࣮ࡍͷάϥϑͱ͔ݟ͍ͨͻͱ͸࿥ըͷͳ͍࣌ʹདྷͯʂ • ͜ͷ͋ͱͷ zoom breakout room Ͱ΋Α͠ • ݸผʹ Twitter Ͱ࿈བྷ͘ΕΕ͹ Datadog ૬ஊ৐Γ·͢

Slide 48

Slide 48 text

એ఻

Slide 49

Slide 49 text

Thank you! chaspy chaspy_ Lead Software Engineer Site Reliability at Quipper Takeshi Kondo