Fix the SLI metadata KEYs for average-monthly-sli enpoint#233
Fix the SLI metadata KEYs for average-monthly-sli enpoint#233lukasz-wal wants to merge 2 commits intomainfrom
Conversation
There was a problem hiding this comment.
Pull request overview
This PR fixes the metadata map keys returned by the GET /storage-providers/average-monthly-sli endpoint so that SLI metadata is keyed by metric type (SLI code) rather than by the underlying metric UUID.
Changes:
- Key
sliMetadataentries bymeta.metric_typeinstead ofmetric.metric_id. - Cast
meta.metric_typetoStorageProviderUrlFinderSliMetricTypewhen populatingsliMetricType.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| sliDataResponse.sliMetadata[meta.metric_type] = { | ||
| sliMetricType: | ||
| meta.metric_type as StorageProviderUrlFinderSliMetricType, | ||
| sliMetricName: meta.name, |
There was a problem hiding this comment.
The new as StorageProviderUrlFinderSliMetricType cast removes compile-time protection against drift between the DB metric enum (Prisma) and the public SLI enum. If new DB metric types are added later, this can silently return an enum value that isn’t part of the documented SLI contract. Consider aligning these types (e.g., define the SLI type as a union derived from the Prisma metric types plus IPNI_REPORTING, or add a small runtime guard before populating sliMetadata).
No description provided.