Skip to content

feat(azure): add idle Cosmos DB for Gremlin API check (#20) - #22

Merged
raphgm merged 1 commit into
raphgm:mainfrom
DYNOSuprovo:feat/cosmosdb-gremlin-idle-ru-20
Sep 21, 2026
Merged

raphgm merged 1 commit into
raphgm:mainfrom
DYNOSuprovo:feat/cosmosdb-gremlin-idle-ru-20

Conversation

@DYNOSuprovo

Copy link
Copy Markdown
Contributor

Resolves #20

Description

This PR implements the idle Cosmos DB provisioned throughput check for the Gremlin (Graph) API, following the project's standard 4-file check pattern:

  1. Source Plugin: src/cloudcost/sources/azure/cosmosdb_gremlin_idle_ru.py (AzureCosmosDbGremlinIdleRuSource)
    • Discovers non-serverless Cosmos DB accounts configured with Gremlin API (EnableGremlin capability).
    • Collects provisioned throughput across both database-level (az cosmosdb gremlin database throughput show) and graph-level (az cosmosdb gremlin graph throughput show) scopes.
    • Fetches consumption metrics via Azure Monitor (TotalRequestUnits over lookback_days).
  2. SQL Policy: policies/cosmosdb_gremlin_idle_ru.sql
    • Billed cost calculation based on official Azure Retail Prices for provisioned RU/s ($0.008/hr per 100 RU/s = (provisioned_ru / 100.0) * 0.008 * 730).
    • Flags accounts where provisioned RU > 0 and consumed RU < 1% of provisioned RU.
  3. Pipeline Config: cloudcost.cosmosdb-gremlin-idle-real.yml
  4. Engine Runner Registration: Registered in src/cloudcost/engine/runner.py.
  5. Tests: Added comprehensive policy test suite in tests/policies/test_cosmosdb_gremlin_idle_ru.py (5 tests covering idle accounts, active accounts, zero provisioned RU, mixed tables, and empty tables).
  6. Documentation: Updated README.md under Databases & messaging to include Gremlin API.

Verification

  • Ran all unit tests locally with pytest and DuckDB:
    uv run pytest tests/ -v
    ============================= 50 passed in 11.59s =============================
    

@raphgm raphgm left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

Verified: pulled the branch, ran all 50 tests locally (matches the PR's claimed count), all pass. Source file follows the established Cosmos-API pattern exactly (same structure as cosmosdb_mongo_idle_ru.py / cosmosdb_cassandra_idle_ru.py from earlier), correctly uses its own CLI surface (az cosmosdb gremlin ...) and resource scope. Real, well-scoped PR closing #20. Author has solid trust signals (3-year-old account, 159 repos). Approving.

@raphgm
raphgm merged commit 66d30cd into raphgm:main Sep 21, 2026
1 check passed
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.

Add idle Azure Cosmos DB for Gremlin API check

2 participants