Skip to content

Map onionoo fields and descriptors fields as we are storing them in Metrics DB

Here is a possible mapping between onionoo api specs and what we are storing in Metrics DB

More information about individual fields as found in published descriptors can be found on the dir_spec

responses:
  ### BANDWIDTH.rs
  relaybandwidth:
    fingerprint:
      - server_descriptor.fingerprint
    write_history:
      - (server_descriptor/extra_info_descriptor).write_history
    read_history:
      - (server_descriptor/extra_info_descriptor).read_history
    overload_ratelimits:
      - extra_info_descriptor.overload_ratelimits_ratelimit
    overload_fd_exhausted:
      - overload_fd_exhausted(version,timestamp)
    overload_fd_ratelimits:
      - currently not published in onionoo

  bridgebandwidth:
    fingerprint:
      - server_descriptor.fingerprint
    write_history:
      - (server_descriptor/extra_info_descriptor).write_history
    read_history:
      - (server_descriptor/extra_info_descriptor).read_history
    overload_ratelimits:
      - extra_info_descriptor.overload_ratelimits_ratelimit
    overload_fd_exhausted:
      - overload_fd_exhausted(version,timestamp)
    overload_fd_ratelimits:
      - currently not published in onionoo

  ### SUMMARY.rs
  summaryresponse:
    version:
      - (network_status_tables/status_tables).version
    relays:
      relaysummary
    bridges:
      bridgesummary


  relaysummary:
    n:
      - server_status.nickname
    f:
      - server_status.fingerprint
    a:
      - server_status.or_addresses [Or-Addresses](https://gitlab.torproject.org/tpo/core/torspec/-/blob/main/dir-spec.txt#L900)
    r:
      - server_status.running

  bridgesummary:
    n:
      - server_status.nickname
    f:
      - server_status.fingerprint
    r:
      - server_status.running

###### CLIENTS.rs
  bridgeclient:
    fingerprint:
      - The hashed fingerprint of the bridge
    average_clients:
      - average clients counts 
(We do aggregate clients per country and we have per country aggregation of clients counted in bridges descriptors https://gitlab.torproject.org/tpo/core/torspec/-/blob/main/dir-spec.txt#L1021
https://gitlab.torproject.org/tpo/network-health/metrics/descriptorParser/-/blob/main/src/main/sql/extra_info_tables.sql#L16)

###### UPTIME.rs
  realyuptime:
    fingerprint:
      - server_descriptor.digest_sha1_hex
    uptime:
      - server_descriptor.uptime

  bridgeuptime:
    fingerprint:
      - server_descriptor.digest_sha1_hex
    uptime:
      - server_descriptor.uptime

###### WEIGHTS.rs
  relayweight:
    fingerprint:
      - network_status_totals.network_status_id
    consensus_weight_fraction:
      - network_status_totals.total_consensus_weight (?)
    guard_probability:
      - network_status_entry_weight.guard_weight_fraction
    middle_probability:
      - network_status_entry_weight.middle_weight_fraction
    exit_probability:
      - network_status_entry_weight.exit_weight_fraction
    consensus_weight:
      - ???

We do have calculated consensus weight in our time series DB:
https://gitlab.torproject.org/tpo/network-health/metrics/descriptorParser/-/blob/main/METRICS.md#from-consensuses

But also in psql:
https://gitlab.torproject.org/tpo/network-health/metrics/descriptorParser/-/blob/main/src/main/sql/network_status_tables.sql#L63
https://gitlab.torproject.org/tpo/network-health/metrics/descriptorParser/-/blob/main/src/main/sql/network_status_tables.sql#L32

###### DETAILS.rs
  relaydetails:
    nickname:
      server_descriptor.nickname
    fingerprint:
      server_status.fingerprint
    or_address:
      server_status.or_address
    exit_address:
      exit_node.exit_addresses
    dir_address:
      server_table.dir_port
    https://gitlab.torproject.org/tpo/network-health/metrics/descriptorParser/-/blob/main/src/main/sql/server_tables.sql#L12
    https://metrics.torproject.org/onionoo.html#details_relay_dir_address
    last_seen:
      - server_status.last_seen
    first_seen:
      - server_status.first_seen
    running:
      - server_status.running
    hibernating:
      - server_descriptor.is_hibernating
    flags:
      - server_status.flags
    country:
      - server_status.country
    country_name:
      - server_status.country_name
    as_name:
      - server_status.as_name
    consensus_weight:
      - network_status_totals.total_consensus_weight (?)
    verified_host_names:
      - server_status.verified_host_names
    last_restarted:
      - server_status.last_restarted
    bandwidth_rate:
      - server_descriptor.bandwidth_rate
    bandwidth_burst:
      - server_descriptor.bandwidth_burst
    observed_bandwidth:
      - server_descriptor.bandwidth_observed
    advertised_bandwidth:
      - This bandwidth value is the minimum of bandwidth_rate, bandwidth_burst, and observed_bandwidth. Missing if router descriptor containing this information cannot be found.
    overlaod_general_timestamp:
      - server_descriptor.overload_general_timestamp
    exit_policy:
      - server_status.exit_policy
    exit_policy_summary:
      - server_descriptor.exit_policy
    exit_policy_v6_summary:
      - server_descriptor.ipv6_default_policy
    contact:
      - server_descriptor.contacts
    version:
      - server_status.version
    platform:
      - server_status.platform
    recommended_version:
      - True||False based on version_status
    version_status:
      - server_status.version_status
    effective_family:
      - server_status.effective_family
    alleged_family:
      - server_status.declared_family
    indirect_family:
      - Not computed at this time
    consensus_weight_fraction:
      - network_status_totals.total_consensus_weight (?)
    guard_probability:
      - network_status_entry_weight.guard_weight_fraction
    middle_probability:
      - network_status_entry_weight.middle_weight_fraction
    exit_probability:
      - network_status_entry_weight.exit_weight_fraction
    measured:
      - network_vote_entry.bandwidth_measured
    unreachable_or_addresses:
      - not computed at this point


  bridgedetails:
    nickname:
      server_descriptor.nickname
    hashed_fingerprint:
      server_status.fingerprint
    or_address:
      server_status.or_address
    last_seen:
      - server_status.last_seen
    first_seen:
      - server_status.first_seen
    running:
      - server_status.running
    flags:
      - server_status.flags
    last_restarted:
      - server_status.last_restarted
    advertised_bandwidth:
      - ???
    overlaod_general_timestamp:
      - server_descriptor.overload_general_timestamp
    version:
      - server_status.version
    platform:
      - server_status.platform
    recommended_version:
      - True||False based on version status
    version_status:
      - server_status.version_status
    transports:
      - server_status.transports
    blocklist:
      - server_status.blocklist
    bridgedb_distributor:
      - server_status.bridgedb_distributor