Skip to content

fix(gcp/computeengine): stamp PaymentOption="monthly" to match peer GCP services (followup to #709) #718

Description

@cristim

Symptom

providers/gcp/services/computeengine/client.go:804 stamps rec.PaymentOption = "upfront" on every Compute Engine CUD recommendation it emits. Peer GCP services (cloudsql, memorystore, cloudstorage) consistently stamp "monthly". After PR #709's NormalizePaymentOption is in place, the normalizer coerces this to "monthly" with a WARN log — which means a WARN fires on every single GCP Compute Engine recommendation emitted by a healthy collector.

Root cause

GCP CUDs are billed monthly across the commitment term. There is no "upfront" billing tier in GCP. The buildCommitmentRequests function at providers/gcp/services/computeengine/client.go:350-373 confirms this — it takes only a Plan (TWELVE_MONTH / THIRTY_SIX_MONTH) and never reads PaymentOption.

The "upfront" literal at line 804 is leftover from when the codebase modelled all providers with AWS-style tokens. Other GCP services were fixed (or always correctly stamped "monthly"); this one was missed.

Fix

One-line change at providers/gcp/services/computeengine/client.go:804:

-    rec.PaymentOption = "upfront"
+    rec.PaymentOption = "monthly"

After this lands, the NormalizePaymentOption WARN log goes silent on the GCP Compute Engine path (no more all-upfront → monthly with WARN per rec), and the stamping is consistent across all GCP service emitters.

Tests

  • Update any test in providers/gcp/services/computeengine/client_test.go that asserts the stamped value (change expected "upfront" to "monthly").
  • Spot-check downstream consumers (internal/purchase/execution.go, internal/recommendations/*) to confirm they don't have a GCP-Compute-Engine-specific branch that depends on "upfront" — if they do, that's a separate bug surfaced by this fix.

Why this matters

  • Log hygiene: WARN-per-rec on a healthy pipeline pollutes ops dashboards and trains operators to ignore the WARN level.
  • Consistency: 4 GCP services should stamp the same canonical token. Drift here is technical debt.
  • Forward-compat: any future GCP service added by mirroring computeengine will inherit the bug; mirroring cloudsql/memorystore/cloudstorage won't.

Related

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions