Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
ログのメトリックを取ってみる話
Search
AGAWA Koji
November 04, 2016
Programming
1k
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
ログのメトリックを取ってみる話
logback / Prometheus
AGAWA Koji
November 04, 2016
More Decks by AGAWA Koji
See All by AGAWA Koji
Software Architecture in an AI-Driven World
atty303
79
47k
PipeCDプラグインへの期待 / Anticipating PipeCD Plugins
atty303
0
120
EmscriptenでC/C++アプリをWASM化してブラウザで動かしてみた
atty303
0
650
良いソフトウェアとコードレビュー / Good software and code review
atty303
38
18k
Scala + Caliban で作るGraphQL バックエンド / Making GraphQL Backend with Scala + Caliban
atty303
0
600
Scala.jsとAndroidでドメイン層を共有しよう / Scala.js and Android
atty303
0
810
もう一つのビルドツール mill で作る Docker イメージ / Build docker image with mill the yet another build tool
atty303
2
2.6k
Case of Ad Delivery System is Implemented by Scala and DDD
atty303
4
3.7k
ADC2016: Axion meets HashiCorp
atty303
0
830
Other Decks in Programming
See All in Programming
AIエージェントと協働するCLI開発 — BunとOpenClawで学んだこと
yoshikouki
1
240
代数的データ型って何が嬉しいの? #frontend_phpcon_do
kajitack
8
3.2k
セキュリティの専門家じゃなくてもできる。「セキュリティ意識」をアップデートして サプライチェーン攻撃への耐性を高めよう。
tk3fftk
5
660
コンテキストの使い捨てをやめる — ビジネスルール駆動開発と miko —
ioki
0
160
AIで効率化できた業務・日常
ochtum
0
110
DynamoDBには集計系のクエリがないけどなんとかしたい
musan
1
130
メソッドのジェネリクスでGoの夢は広がるか? / Kyoto.go #65
utgwkk
3
600
Semantic Version 単位で戦略を柔軟に変えて、パッケージアップデートを自動化する
daitasu
0
170
脅威をエンジニアリングの糧にして――現場編 / Turning Threats into Engineering Fuel — Field Edition
nrslib
0
260
柔軟なPDFレイアウトエディタを支える型システム設計 — Discriminated UnionとConditional Typeの実践
minako__ph
4
1.5k
Skillsは効率化、Agentsは"自分の拡張"——Builder時代のエージェント編成(CC Night 2026)
wemra
1
110
決定論的オーケストレーションの設計と実装 / Design and Implementation of Deterministic Orchestration
nrslib
3
1.2k
Featured
See All Featured
Fantastic passwords and where to find them - at NoRuKo
philnash
52
3.7k
The Illustrated Children's Guide to Kubernetes
chrisshort
51
52k
Taking LLMs out of the black box: A practical guide to human-in-the-loop distillation
inesmontani
PRO
3
2.3k
Designing Dashboards & Data Visualisations in Web Apps
destraynor
231
55k
Hiding What from Whom? A Critical Review of the History of Programming languages for Music
tomoyanonymous
2
840
Side Projects
sachag
455
43k
The Web Performance Landscape in 2024 [PerfNow 2024]
tammyeverts
12
1.2k
How to audit for AI Accessibility on your Front & Back End
davetheseo
0
400
DevOps and Value Stream Thinking: Enabling flow, efficiency and business value
helenjbeal
1
220
The AI Revolution Will Not Be Monopolized: How open-source beats economies of scale, even for LLMs
inesmontani
PRO
3
3.5k
How People are Using Generative and Agentic AI to Supercharge Their Products, Projects, Services and Value Streams Today
helenjbeal
1
200
Learning to Love Humans: Emotional Interface Design
aarron
275
41k
Transcript
ϩάͷϝτϦοΫΛऔͬͯΈΔ @atty303 / AI Studio Dev Group © 2016 CyberAgent,
Inc. 1
ELK stack ͱ͔Ͱϩάऩू͢ ΔΑ͋͘Δ © 2016 CyberAgent, Inc. 2
ϩάͷϝτϦοΫΛܭଌ͢ Δ͋Μ·Γͳͦ͞͏? © 2016 CyberAgent, Inc. 3
͜Μͳײ͡Ͱܭଌͯ͠·͢ 4 DEBUG Ϩϕϧ͔͠ग़͍ͯͳ͍ͷͰ͍·͍ͪ໘നΈ ͳ͍… © 2016 CyberAgent, Inc. 4
4 ϞχλϦϯάʹ Prometheus Λར༻ 4 Prometheus ެࣜͷ Java ΫϥΠΞϯτ 4
https://github.com/prometheus/ client_java 4 simpleclient_logback Ϟδϡʔϧ 4 ϨϕϧผʹϝοηʔδΛܭଌͯ͠ϝτϦ οΫͱͯ͠ग़ྗͯ͘͠ΕΔ Logback ͷ Appender © 2016 CyberAgent, Inc. 5
logback.xml <configuration> <appender name="COUNTER" class="io.prometheus.client.logback.InstrumentedAppender"> </appender> <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender"> <filter
class="ch.qos.logback.classic.filter.ThresholdFilter"> <level>${LOG_STDOUT_LEVEL:-INFO}</level> </filter> <encoder> <pattern>%.-1level %d{MMdd HH:mm:ss.SSS} %thread [%logger{36}] %msg%n</pattern> </encoder> </appender> <root level="DEBUG"> <appender-ref ref="COUNTER" /> <appender-ref ref="STDOUT" /> </root> </configuration> © 2016 CyberAgent, Inc. 6
ϙΠϯτ 4 ϧʔτϩΨʔશϩάΛ appender ʹૹΔ 4 STDOUT appender ͷ ThreasholdFilter
Ͱ ͳϩάΛϑΟϧλϦϯά 4 COUNTER appender ͕ϩάϨϕϧผͷϝο ηʔδΛΧϯτ © 2016 CyberAgent, Inc. 7
ϝτϦοΫܭଌͯ͘͠ΕΔ $ curl http://somewhere:58165/metrics # HELP logback_appender_total Log4j log statements
at various log levels # TYPE logback_appender_total counter logback_appender_total{level="debug",} 8.9142634E7 logback_appender_total{level="warn",} 0.0 logback_appender_total{level="trace",} 0.0 logback_appender_total{level="error",} 2728.0 logback_appender_total{level="info",} 11.0 © 2016 CyberAgent, Inc. 8
ϩάϨϕϧͷఆٛ DEBUG: ։ൃऀʹ͔͠ඞཁͳ͍ใ INFO: ΞϓϦέʔγϣϯͷॲཧঢ়گͳͲਖ਼ৗಈ࡞ Λ͍ͯ͠Δ࣌ͷใ WARN: Τϥʔ͕ग़͕ͨճ෮ग़དྷͨ࣌ͷใ ERROR: Τϥʔ͕ग़ͯճ෮ग़དྷ͖ͳ͍࣌ͷใ
4 ͪΌΜͱϩάϨϕϧͷҙຯ͚Λ͍ͯ͠ͳ͍ͱ ܭଌͯ͠ແҙຯ… © 2016 CyberAgent, Inc. 9
Ξϥʔτϧʔϧ IF rate(logback_appender_total{job="axion-inserter-admin",level="error"}[1m]) > 1 FOR 1m LABELS { severity
= "LOW" } ANNOTATIONS { summary = "Inserter: {{ $value }} error messages found at {{ $labels.instance }}" } 4 ͱΓ͋͑ͣ ERROR ϩά͕ग़͍ͯͨΒΞϥʔ τ 4 ϝοηʔδίϯςφΛݟʹߦ͘… nomad fs <alloc-id> alloc/logs/inserter.stdout.0 © 2016 CyberAgent, Inc. 10
…ͯͳӡ༻Λͯ͠·͢ © 2016 CyberAgent, Inc. 11
ྑ͍ͱ͜Ζ 4 ϩάऩूΑΓѹతʹτϥϑΟοΫ͕খ͍͞ͷ ͰؾָʹಋೖͰ͖Δ 4 ϩάϨϕϧ͚ͩͰҙ֎ͱগͳ͍࿑ྗͰࢹͰ ͖Δ 4 ࢹΛҙࣝͨ͠ϩάग़ྗඞཁ ©
2016 CyberAgent, Inc. 12
ѱ͍ͱ͜Ζ 4 ͕ى͖ͨͱ͖݁ہϝοηʔδΛݟʹߦ͔ ͳ͍ͱ͍͚ͳ͍ 4 ϩάऩूͷΈ͕༻ҙ͞Ε͍ͯΕͦͷ΄͏ ͕ྑ͍ © 2016 CyberAgent,
Inc. 13
GCP ͷ Stackdriver ͏Β·͍͠ © 2016 CyberAgent, Inc. 14
© 2016 CyberAgent, Inc. 15