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

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

Build:
DEFAULT BRANCH: main
Ran 08 Mar 2026 12:16AM UTC
Jobs 1
Files 19
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

08 Mar 2026 12:14AM UTC coverage: 17.466% (-1.2%) from 18.658%
22810208105

push

github

web-flow
feat: add fuel price snapshot statistics API and metrics (#28)

* feat: add fuel price snapshot statistics API and metrics

- Introduced `/v1/fuel-prices/snapshot-stats` endpoint.
- Added Prometheus gauge collector for real-time fuel statistics.
- Implemented memoized repository caching for stats queries.
- Updated `.vscode/launch.json` with required build tags.

```mermaid
graph TD
    A[API Request] --> B[Routes: SnapshotStats]
    B --> C[Repository: SnapshotStats]
    C --> D{Cache?}
    D -- Hit --> E[Return Cached Data]
    D -- Miss --> F[SQL Query]
    F --> G[Update Cache]
    G --> E
    C -- Metrics Loop --> H[Prometheus Collector]
```

* feat: refactor metrics tracking and separation

- Separated client HTTP metrics from fuel price statistics.
- Simplified `fuelPricesGaugeCollector` implementation.
- Implemented `ClientFetchMetrics` to track API request
  latencies, status codes, and items fetched.

```mermaid
graph LR
    subgraph Metrics
        A[ClientFetchMetrics] --> B(HTTP Latency)
        A --> C(Status Codes)
        A --> D(Items Total)
    end
    subgraph Stats
        E[FuelPricesCollector] --> F(Price Statistics)
    end
```

* refactor: scope snapshot variable inside loop

Move the `snapshot` variable declaration inside the `rows.Next()` loop
to ensure a fresh instance is used for each iteration, preventing
potential data leaks or overwrite issues across rows.

1 of 81 new or added lines in 6 files covered. (1.23%)

204 of 1168 relevant lines covered (17.47%)

0.19 hits per line

New Missed Lines in Diff

Lines Coverage ∆ File
1
0.0
0.0% cmd/api_server.go
1
0.0
0.0% cmd/bootstrap.go
1
0.0
0.0% internal/client_fetch.go
13
0.0
internal/routes/stats.go
25
55.34
-7.44% internal/repository.go
39
0.0
internal/metrics/fuel_prices_metrics.go
Jobs
ID Job ID Ran Files Coverage
1 22810208105.1 08 Mar 2026 12:16AM UTC 19
17.47
GitHub Action Run
Source Files on build 22810208105
  • Tree
  • List 19
  • Changed 4
  • Source Changed 0
  • Coverage Changed 4
Coverage ∆ File Lines Relevant Covered Missed Hits/Line
  • Back to Repo
  • cb39a394 on github
  • Prev Build on main (#22807613019)
  • Next Build on main (#22811084469)
  • 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