Skip to content

server: export the not-found and already-set API metrics - #172

Closed
RaphaelFakhri wants to merge 1 commit into
tailscale:mainfrom
RaphaelFakhri:w10-export-metrics
Closed

RaphaelFakhri wants to merge 1 commit into
tailscale:mainfrom
RaphaelFakhri:w10-export-metrics

Conversation

@RaphaelFakhri

Copy link
Copy Markdown

Publish the not-found and already-set API counters from Server.Metrics.

Server increments countCallNotFound for db.ErrNotFound results and countCallAlreadySet for db.ErrVersionClaimed and db.ErrInvalidVersion results, but Metrics only registered the calls, bad-request, forbidden and internal-error maps. The other two counters were collected and never exported.

This change registers them as counter_api_not_found and counter_api_already_set.

Testing:

  • Added TestServerMetrics, which triggers a not-found result and an already-set result through the client and checks the exported counters.
  • Without the change, go test ./server/ -run TestServerMetrics fails with both new counters at 0. With the change, it passes.
  • go test ./server/ ./db/ passes.

The server counts not-found and already-set API results in
countCallNotFound and countCallAlreadySet, but Metrics did not include
either map, so they were never published.

Signed-off-by: Raphael Fakhri <153192858+RaphaelFakhri@users.noreply.github.com>
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.

1 participant