swh.counters.api.server module#

swh.counters.api.server.make_app(config: Dict[str, Any]) RPCServerApp[source]#

Initialize the remote api application.

swh.counters.api.server.index()[source]#
swh.counters.api.server.load_and_check_config(config_file: str) Dict[str, Any][source]#
Check the minimal configuration is set to run the api or raise an

error explanation.

Parameters:
  • config_file – Path to the configuration file to load

  • type – configuration type. For ‘local’ type, more checks are done.

Raises:

Error if the setup is not as expected

Returns:

configuration as a dict

swh.counters.api.server.make_app_from_configfile()[source]#

Run the WSGI app from the webserver, loading the configuration from a configuration file.

SWH_CONFIG_FILENAME environment variable defines the configuration path to load.

swh.counters.api.server.get_metrics()[source]#

expose the counters values in a prometheus format

detailed format: # HELP swh_archive_object_total Software Heritage Archive object counters # TYPE swh_archive_object_total gauge swh_archive_object_total{col=”value”,object_type=”<collection>”} <value> …

swh.counters.api.server.get_history_file_content(filename: str)[source]#