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

rm-hull / dot-block / 19118609388
43%

Build:
DEFAULT BRANCH: main
Ran 05 Nov 2025 10:42PM UTC
Jobs 1
Files 7
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

05 Nov 2025 10:42PM UTC coverage: 56.18% (+5.6%) from 50.564%
19118609388

push

github

web-flow
feat: Add top K clients and domains metrics (#6)

* feat: Add top K clients and domains metrics

This introduces the "Space Saver" streaming algorithm to efficiently
track the top 20 most active clients and the top 20 most requested
domains in the DNS dispatcher.

These statistics are exposed via Prometheus using new collectors.

Additionally, `StatsCollector` was updated to allow dynamic label
naming for better metric flexibility.

* Update internal/space_saver.go

Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>

* Update internal/space_saver.go

Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>

* refactor: Use TOP_K constant for DNS metrics

The hardcoded value `20` was used multiple times for defining the
limits for tracking top clients and domains in the DNS dispatcher.

This change introduces `TOP_K` to centralize this configuration
and improve code clarity and maintainability.

* test: Add unit tests for SpaceSaver

These tests cover core functionality of the SpaceSaver data
structure:

*   Initialization (`NewSpaceSaver`).
*   Adding items, including entry replacement logic.
*   Retrieving frequent items (`TopN`).
*   Concurrency safety checks using multiple goroutines.

* test: Add SpaceSaver replacement and TopN tests

Adds comprehensive tests for the SpaceSaver implementation:

*   Verifies that `Add` correctly handles entry replacement when the
    capacity is reached, ensuring new entry counts and error bounds
    are accurately set.
*   Tests `TopN` behavior in scenarios involving replacements to
    confirm sorting and accuracy under high entry turnover.

---------

Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>

82 of 97 new or added lines in 3 files covered. (84.54%)

300 of 534 relevant lines covered (56.18%)

0.61 hits per line

New Missed Lines in Diff

Lines Coverage ∆ File
5
92.75
internal/space_saver.go
10
81.06
-2.85% internal/dns.go
Jobs
ID Job ID Ran Files Coverage
1 19118609388.1 05 Nov 2025 10:42PM UTC 7
56.18
GitHub Action Run
Source Files on build 19118609388
  • Tree
  • List 7
  • Changed 1
  • Source Changed 0
  • Coverage Changed 1
Coverage ∆ File Lines Relevant Covered Missed Hits/Line
  • Back to Repo
  • 1393cf80 on github
  • Prev Build on main (#19116650580)
  • Next Build on main (#19119954583)
  • 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