• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

rm-hull / fuel-prices-api / 22929805669
46%

Build:
DEFAULT BRANCH: main
Ran 10 Mar 2026 11:59PM UTC
Jobs 1
Files 20
Run time 1min
Badge
Embed ▾
README BADGES
x

If you need to use a raster PNG badge, change the '.svg' to '.png' in the link

Markdown

Textile

RDoc

HTML

Rst

10 Mar 2026 11:58PM UTC coverage: 26.814%. Remained the same
22929805669

push

github

web-flow
perf: optimize fuel price stats views (#33)

* feat: add fuel price distribution metrics

- Add `fuel_price_distribution_stats` SQL view to calculate price
buckets.
- Expose price distribution data via `SnapshotStatistics` model.
- Add Prometheus gauge metric `fuel_prices_govuk_api_price_distribution`
  to track sample counts per price bucket.
- Include database migration to support new distribution analytics.

* feat: refactor distribution data into buckets

Migrate `Distribution` model to use a `map[int]int` for buckets instead
of individual records per price point. This reduces payload size and
improves query grouping logic when exporting fuel price statistics.

```mermaid
graph LR
    subgraph OldStructure
    A[Row 1: Bucket 10]
    B[Row 2: Bucket 20]
    end

    subgraph NewStructure
    C[Distribution { Buckets: {10: X, 20: Y} }]
    end

    A --> C
    B --> C
```

* feat: separate distribution and snapshot stats

Split statistics logic and endpoints to allow independent querying of
snapshot and distribution data.

- Updated `FuelPricesRepository` interfaces and implementation.
- Refactored `metrics.fuelPricesGaugeCollector` to handle separate data
  fetchers.
- Moved endpoints to `/v1/fuel-prices/stats/snapshot` and
  `/v1/fuel-prices/stats/distribution`.

```mermaid
sequenceDiagram
    participant API as API Server
    participant Repo as Repository
    participant DB as SQLite DB

    API->>Repo: DistributionStats()
    Repo->>Repo: Check Cache
    Repo->>DB: Query Distribution
    DB-->>Repo: Result
    Repo-->>API: DistributionStatistics
```

* refactor: split metrics collectors into dedicated files

Separated `Snapshot` and `Distribution` metric collectors into their own
files to improve maintainability and decouple their registration logic.

```mermaid
graph TD
    subgraph metrics [metrics package]
        A[bootstrap.go] --> B[snapshot_metrics.go]
        A --> C[distribution_metrics.go]
    end
```

* chore: remove legacy snapshot... (continued)

351 of 1309 relevant lines covered (26.81%)

0.29 hits per line

Jobs
ID Job ID Ran Files Coverage
1 22929805669.1 10 Mar 2026 11:59PM UTC 20
26.81
GitHub Action Run
Source Files on build 22929805669
  • Tree
  • List 20
  • Changed 0
  • Source Changed 0
  • Coverage Changed 0
Coverage ∆ File Lines Relevant Covered Missed Hits/Line
  • Back to Repo
  • b7f1c714 on github
  • Prev Build on main (#22929444349)
  • Next Build on main (#22930001784)
  • Delete
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc