SYSTEM Cited by 1 source
Lyft Metric Semantic Layer (MSL)¶
Overview¶
The Metric Semantic Layer (MSL) is Lyft's internal centralized Python package that serves as the single, authoritative repository for every "Golden Metric" definition in the company. It solves concepts/metric-definition-drift — the problem of different teams using different SQL definitions for the same metric — by providing one canonical definition that all downstream consumers resolve.
Architecture¶
MSL is implemented as a versioned Python package (not a service). Its core components:
- YAML configurations — each metric is a YAML file declaring metadata (owners, data sources, allowed dimensions, time granularities) and the metric's SQL logic via Jinja templates.
- Jinja SQL templates — parameterized SQL blocks that generate the final query based on requested time granularity, dimensions, and date range. Chosen for DRY compliance and low learning curve.
- Python access methods / APIs —
get_sql()and related functions that resolve a metric name + parameters into executable SQL. - MCP server — Model Context Protocol integration enabling AI agents to query metric definitions in natural language.
Access channels¶
| Channel | Use case |
|---|---|
Python API (from metrics_source import get_sql) |
Programmatic SQL generation for pipelines, notebooks, services |
| systems/amundsen integration | Discoverability — search/browse metric definitions, ownership, DQ info |
| Self-service Metric UI | No-code SQL generation for non-technical users |
| MCP (Model Context Protocol) | AI agents / LLM tools query metrics in natural language |
Governance model¶
- Only Golden Metrics (≥2 distinct use cases) are onboarded — see concepts/golden-metric-selection-criteria
- Every metric has a Business Owner (team) + Operational Owner (team) — see concepts/dual-owner-metric-governance
- All definition changes require dual approval — see patterns/dual-owner-approval-for-metric-changes
Deployment model¶
The Python package is versioned. Updates are deployed to all dependent applications through automated code refactors — consumers automatically receive the latest metric definitions without manual action.
Seen in¶
- sources/2026-06-10-lyft-metric-semantic-layer — original announcement and architecture description (Lyft Engineering, 2026-06-10)