# Metrics Store คืออะไรนะ? ทำไมถึงเป็นสิ่งที่ควรมีใน Modern Data Stack?

**URL:** <https://discuss.dataengineercafe.io/t/metrics-store-modern-data-stack/124>\
**Category:** General Discussion เรื่อง Data Engineering\
**Tags:** metrics\
**Created:** [March 5, 2022, 5:15am UTC](https://discuss.dataengineercafe.io/t/metrics-store-modern-data-stack/124 "2022-03-05T05:15:16Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![zkan](https://yyz1.discourse-cdn.com/flex035/user_avatar/discuss.dataengineercafe.io/zkan/32/2_2.png) [@zkan](https://discuss.dataengineercafe.io/u/zkan)\
**Post date:** [March 5, 2022, 5:15am UTC](https://discuss.dataengineercafe.io/t/metrics-store-modern-data-stack/124/1 "2022-03-05T05:15:16Z")

</div>

เช้านี้ย้อนมาอ่านเว็บที่เปิดค้างไว้แล้วเจอบทความนี้ [Understanding the Metrics Store. Why, What and How Enterprise Adopt Metric Store | Kyligence](https://medium.com/kyligence/understanding-the-metrics-store-c213341e4c25)

เค้าอธิบายได้เข้าใจง่ายดีครับ

> **A metrics store** is, in the simplest words, a middle layer between upstream data warehouses/data sources and downstream business applications. It can be called the _Metrics Platform, Headless BI, the Metrics Layer,_ or the _Metrics Store_ — — they are ultimately the same thing.

เราสามารถมองเป็นการ decouple ส่วนของ metrics ต่างๆ ออกมาจาก business intelligence (BI) tool พวก Tableau หรือ Data Studio ก็ได้ ลองดูรูปด้านล่างนี้จากคุณ Benn Stancil ประกอบ

 ![Metrics Layer](https://canada1.discourse-cdn.com/flex035/uploads/dataengineercafe/original/1X/a1dd1ee54c6dc8394cd8bf6d32b137daf2de3434.png)  
รูปจาก [The missing piece of the modern data stack](https://benn.substack.com/p/metrics-layer)

คนที่ใช้พวก BI น่าจะพอเข้าใจ ผมก็เป็นคนหนึ่งที่ใช้ Data Studio บ่อย ในหลายๆ ครั้งเราก็ไปคำนวณ metrics บน Data Studio เลย เพราะว่ารวดเร็วกว่ามาปรับ query ใหม่ ซึ่งแน่นอนว่าก็จะมีปัญหาอย่างในบทความเค้าบอก

- Inconsistency of key metrics definition — ต่างคนต่าง define metrics ที่ตัวเองใช้
- Inability to reuse defined metrics — เอาไปใช้ร่วมกันไม่ได้ หรือยากลำบาก
- The difficulty for business users to define metrics with SQL — อันนี้แน่นอน ก็ถ้าไม่สามารถมาเขียน SQL ได้ ไปทำบน BI ของตัวเองก็ตอบโจทย์กว่า

ปัญหาพวกนี้ metrics store ก็จะเข้ามาช่วยแก้ ซึ่งแน่นอนว่าใครที่อยากจะเริ่มสร้าง data stack ใหม่ๆ ควรคิดถึงการทำ metrics store ไว้ด้วยนะ ผมคิดว่าช่วยเรื่องที่น่าปวดหัวที่เขียนไว้ข้างบนได้เยอะเลยทีเดียว

ในบทความมีกล่าวถึงแพลตฟอร์มที่ชื่อว่า [Pandora](https://medium.com/kyligence/enterprise-metric-platform-in-action-1-6f6e6bb866f8) แล้วเค้าก็อธิบายเปรียบเทียบขั้นตอนการทำงาน before กับ after ให้ดูเป็นรูป

 ![Kyligence — Metric Platform Case Study](https://canada1.discourse-cdn.com/flex035/uploads/dataengineercafe/original/1X/5d0eb53e439ea072afcc9601fc781b3636063186.png)  
รูปจาก [Data Analytics Workflow: Before vs After | by Lori Lu | Medium](https://medium.com/kyligence/enterprise-metric-platform-in-action-1-6f6e6bb866f8)

น่าสนใจเลยทีเดียวว่าเค้าทำแพลตฟอร์มขึ้นมาแล้วให้คนเข้าไป initiate ตั้งแต่ Day 1 เลยได้อย่างไร 👍 ถ้าทำออกมาไม่ดีพอ คนก็จะกลับไปสร้าง metrics บน BI กันอยู่ดี

มาถึงตรงนี้แล้ว คิดว่าน่าจะพอเห็นภาพเรื่องความสำคัญของ metric store กันแล้วเนอะ บริษัทดังๆ อย่างที่ Airbnb เค้าก็สร้างแพลตฟอร์มขึ้นมาใหม่เลยชื่อ [Minerva](https://medium.com/airbnb-engineering/how-airbnb-achieved-metric-consistency-at-scale-f23cc53dea70) หรือที่ Uber ก็สร้างมาชื่อ [uMetric](https://eng.uber.com/umetric/)

ไว้ถ้าผมได้เริ่มสร้างสิ่งนี้ในองค์กร จะเอามาเล่าให้อ่านกันนะ ส่วนใครมีโอกาสใช้ หรือกำลังพัฒนาอยู่ มีคำแนะนำ หรืออยากเล่าประสบการณ์ สามารถเขียนมาแบ่งปันกันได้นะครับ 😊
