Skip to content

storage: Add a timed decorator to count calls and time it

Add @timed decorator around all storage.api.server endpoints.

Test Plan

from docker-dev:

Start storage server:

docker-compose down --volumes; SWH_SERVICE=swh-storage; docker-compose build $SWH_SERVICE; docker-compose up $SWH_SERVICE

Then in another shell:

docker-compose exec swh-storage bash -c 'ngrep -d lo udp and port 8125

Run some ingestion and check we see counters like the following:

U 127.0.0.1:39597 -> 127.0.0.1:8125
  swh_storage_request_duration_seconds:0.003577995812520385|ms|#endpoint:get_storage
#
U 127.0.0.1:52223 -> 127.0.0.1:8125
  swh_storage_request_count:1|c|#endpoint:snapshot_add
#
U 127.0.0.1:35545 -> 127.0.0.1:8125
  swh_storage_request_duration_seconds:0.005665002390742302|ms|#endpoint:get_storage
#
U 127.0.0.1:39042 -> 127.0.0.1:8125
  swh_storage_request_count:1|c|#endpoint:fetch_history_end
#
U 127.0.0.1:55143 -> 127.0.0.1:8125
  swh_storage_request_duration_seconds:0.0034950062399730086|ms|#endpoint:get_storage
#
U 127.0.0.1:56208 -> 127.0.0.1:8125
  swh_storage_request_count:1|c|#endpoint:origin_visit_update
#
U 127.0.0.1:58816 -> 127.0.0.1:8125
  swh_storage_request_duration_seconds:0.003449007635936141|ms|#endpoint:get_storage
(swh2)

Also tox is fine for non regression.


Migrated from D1311 (view on Phabricator)

Merge request reports

Loading