Skip to content

Fix the SLI metadata KEYs for average-monthly-sli enpoint#233

Open
lukasz-wal wants to merge 2 commits intomainfrom
fix/sli-metadata-keys
Open

Fix the SLI metadata KEYs for average-monthly-sli enpoint#233
lukasz-wal wants to merge 2 commits intomainfrom
fix/sli-metadata-keys

Conversation

@lukasz-wal
Copy link
Copy Markdown
Collaborator

No description provided.

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 sliMetadata entries by meta.metric_type instead of metric.metric_id.
  • Cast meta.metric_type to StorageProviderUrlFinderSliMetricType when populating sliMetricType.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +543 to 546
sliDataResponse.sliMetadata[meta.metric_type] = {
sliMetricType:
meta.metric_type as StorageProviderUrlFinderSliMetricType,
sliMetricName: meta.name,
Copy link

Copilot AI Mar 24, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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).

Copilot uses AI. Check for mistakes.
@lukasz-wal lukasz-wal deployed to production-fidl March 27, 2026 11:14 — with GitHub Actions Active
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants