Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor(metrics): metrics on by default #2129

Merged
merged 1 commit into from
Mar 28, 2024
Merged

refactor(metrics): metrics on by default #2129

merged 1 commit into from
Mar 28, 2024

Conversation

Arqu
Copy link
Collaborator

@Arqu Arqu commented Mar 27, 2024

Description

Now metrics default to serving on localhost:9090 but you can override with a custom port or turn off if you like with --metrics-port. If you want to actually expose the metrics endpoint to the world, it's assumed you will set up a config file with a custom metrics_addr.

I guess the config override could have been done in a bit more elegant way but didn't want to commit refactoring the NodeConfig nor did I want fancy extra task specific fn's.

The configuration is limited to the iroh node start path, the rest are ignored as they are expected to be short lived processes.

Notes & open questions

Change checklist

  • Self-review.
  • Documentation updates if relevant.
  • Tests if relevant.

@Arqu Arqu self-assigned this Mar 27, 2024
@rklaehn
Copy link
Contributor

rklaehn commented Mar 28, 2024

Looks quite reasonable.

What exactly is served on that port if it is enabled?

@Arqu
Copy link
Collaborator Author

Arqu commented Mar 28, 2024

It serves prometheus style metrics. You can find the metrics descriptions & definitions in each crates metrics.rs file.
Sample snapshot:

# HELP iroh_requests_total Total number of requests received.
# TYPE iroh_requests_total counter
iroh_requests_total_total 0
# HELP iroh_bytes_sent Number of bytes streamed.
# TYPE iroh_bytes_sent counter
iroh_bytes_sent_total 0
# HELP iroh_bytes_received Number of bytes received.
# TYPE iroh_bytes_received counter
iroh_bytes_received_total 0
# HELP iroh_sync_new_entries_local Number of document entries added locally.
# TYPE iroh_sync_new_entries_local counter
iroh_sync_new_entries_local_total 0
# HELP iroh_sync_new_entries_remote Number of document entries added by peers.
# TYPE iroh_sync_new_entries_remote counter
iroh_sync_new_entries_remote_total 0
# HELP iroh_sync_new_entries_local_size Total size of entry contents added locally.
# TYPE iroh_sync_new_entries_local_size counter
iroh_sync_new_entries_local_size_total 0
# HELP iroh_sync_new_entries_remote_size Total size of entry contents added by peers.
# TYPE iroh_sync_new_entries_remote_size counter
iroh_sync_new_entries_remote_size_total 0
# HELP iroh_sync_sync_via_connect_success Number of successful syncs (via connect).
# TYPE iroh_sync_sync_via_connect_success counter
iroh_sync_sync_via_connect_success_total 0
# HELP iroh_sync_sync_via_connect_failure Number of failed syncs (via connect).
# TYPE iroh_sync_sync_via_connect_failure counter
iroh_sync_sync_via_connect_failure_total 0
# HELP iroh_sync_sync_via_accept_success Number of successful syncs (via accept).
# TYPE iroh_sync_sync_via_accept_success counter
iroh_sync_sync_via_accept_success_total 0
# HELP iroh_sync_sync_via_accept_failure Number of failed syncs (via accept).
# TYPE iroh_sync_sync_via_accept_failure counter
iroh_sync_sync_via_accept_failure_total 0
# HELP magicsock_rebind_calls rebind_calls.
# TYPE magicsock_rebind_calls counter
magicsock_rebind_calls_total 0
# HELP magicsock_re_stun_calls restun_calls.
# TYPE magicsock_re_stun_calls counter
magicsock_re_stun_calls_total 1
# HELP magicsock_update_endpoints update_endpoints.
# TYPE magicsock_update_endpoints counter
magicsock_update_endpoints_total 1
# HELP magicsock_send_relay_queued send_relay_queued.
# TYPE magicsock_send_relay_queued counter
magicsock_send_relay_queued_total 0
# HELP magicsock_send_relay_error_chan send_relay_error_chan.
# TYPE magicsock_send_relay_error_chan counter
magicsock_send_relay_error_chan_total 0
# HELP magicsock_send_relay_error_closed send_relay_error_closed.
# TYPE magicsock_send_relay_error_closed counter
magicsock_send_relay_error_closed_total 0
# HELP magicsock_send_relay_error_queue send_relay_error_queue.
# TYPE magicsock_send_relay_error_queue counter
magicsock_send_relay_error_queue_total 0
# HELP magicsock_send_ipv4 send_ipv4.
# TYPE magicsock_send_ipv4 counter
magicsock_send_ipv4_total 0
# HELP magicsock_send_ipv4_error send_ipv4_error.
# TYPE magicsock_send_ipv4_error counter
magicsock_send_ipv4_error_total 0
# HELP magicsock_send_ipv6 send_ipv6.
# TYPE magicsock_send_ipv6 counter
magicsock_send_ipv6_total 0
# HELP magicsock_send_ipv6_error send_ipv6_error.
# TYPE magicsock_send_ipv6_error counter
magicsock_send_ipv6_error_total 0
# HELP magicsock_send_relay send_relay.
# TYPE magicsock_send_relay counter
magicsock_send_relay_total 0
# HELP magicsock_send_relay_error send_relay_error.
# TYPE magicsock_send_relay_error counter
magicsock_send_relay_error_total 0
# HELP magicsock_send_data send_data.
# TYPE magicsock_send_data counter
magicsock_send_data_total 0
# HELP magicsock_send_data_network_down send_data_network_down.
# TYPE magicsock_send_data_network_down counter
magicsock_send_data_network_down_total 0
# HELP magicsock_recv_data_relay recv_data_relay.
# TYPE magicsock_recv_data_relay counter
magicsock_recv_data_relay_total 0
# HELP magicsock_recv_data_ipv4 recv_data_ipv4.
# TYPE magicsock_recv_data_ipv4 counter
magicsock_recv_data_ipv4_total 0
# HELP magicsock_recv_data_ipv6 recv_data_ipv6.
# TYPE magicsock_recv_data_ipv6 counter
magicsock_recv_data_ipv6_total 0
# HELP magicsock_recv_datagrams recv_datagrams.
# TYPE magicsock_recv_datagrams counter
magicsock_recv_datagrams_total 0
# HELP magicsock_send_disco_udp disco_send_udp.
# TYPE magicsock_send_disco_udp counter
magicsock_send_disco_udp_total 0
# HELP magicsock_send_disco_relay disco_send_relay.
# TYPE magicsock_send_disco_relay counter
magicsock_send_disco_relay_total 0
# HELP magicsock_sent_disco_udp disco_sent_udp.
# TYPE magicsock_sent_disco_udp counter
magicsock_sent_disco_udp_total 0
# HELP magicsock_sent_disco_relay disco_sent_relay.
# TYPE magicsock_sent_disco_relay counter
magicsock_sent_disco_relay_total 0
# HELP magicsock_sent_disco_ping disco_sent_ping.
# TYPE magicsock_sent_disco_ping counter
magicsock_sent_disco_ping_total 0
# HELP magicsock_sent_disco_pong disco_sent_pong.
# TYPE magicsock_sent_disco_pong counter
magicsock_sent_disco_pong_total 0
# HELP magicsock_sent_disco_call_me_maybe disco_sent_callmemaybe.
# TYPE magicsock_sent_disco_call_me_maybe counter
magicsock_sent_disco_call_me_maybe_total 0
# HELP magicsock_recv_disco_bad_peer disco_recv_bad_peer.
# TYPE magicsock_recv_disco_bad_peer counter
magicsock_recv_disco_bad_peer_total 0
# HELP magicsock_recv_disco_bad_key disco_recv_bad_key.
# TYPE magicsock_recv_disco_bad_key counter
magicsock_recv_disco_bad_key_total 0
# HELP magicsock_recv_disco_bad_parse disco_recv_bad_parse.
# TYPE magicsock_recv_disco_bad_parse counter
magicsock_recv_disco_bad_parse_total 0
# HELP magicsock_recv_disco_udp disco_recv_udp.
# TYPE magicsock_recv_disco_udp counter
magicsock_recv_disco_udp_total 0
# HELP magicsock_recv_disco_relay disco_recv_relay.
# TYPE magicsock_recv_disco_relay counter
magicsock_recv_disco_relay_total 0
# HELP magicsock_recv_disco_ping disco_recv_ping.
# TYPE magicsock_recv_disco_ping counter
magicsock_recv_disco_ping_total 0
# HELP magicsock_recv_disco_pong disco_recv_pong.
# TYPE magicsock_recv_disco_pong counter
magicsock_recv_disco_pong_total 0
# HELP magicsock_recv_disco_call_me_maybe disco_recv_callmemaybe.
# TYPE magicsock_recv_disco_call_me_maybe counter
magicsock_recv_disco_call_me_maybe_total 0
# HELP magicsock_recv_disco_call_me_maybe_bad_node disco_recv_callmemaybe_bad_node.
# TYPE magicsock_recv_disco_call_me_maybe_bad_node counter
magicsock_recv_disco_call_me_maybe_bad_node_total 0
# HELP magicsock_recv_disco_call_me_maybe_bad_disco disco_recv_callmemaybe_bad_disco.
# TYPE magicsock_recv_disco_call_me_maybe_bad_disco counter
magicsock_recv_disco_call_me_maybe_bad_disco_total 0
# HELP magicsock_relay_home_change relay_home_change.
# TYPE magicsock_relay_home_change counter
magicsock_relay_home_change_total 1
# HELP magicsock_num_direct_conns_added number of direct connections to a peer we have added.
# TYPE magicsock_num_direct_conns_added counter
magicsock_num_direct_conns_added_total 0
# HELP magicsock_num_direct_conns_removed number of direct connections to a peer we have removed.
# TYPE magicsock_num_direct_conns_removed counter
magicsock_num_direct_conns_removed_total 0
# HELP magicsock_num_relay_conns_added num_relay_conns added.
# TYPE magicsock_num_relay_conns_added counter
magicsock_num_relay_conns_added_total 1
# HELP magicsock_num_relay_conns_removed num_relay_conns removed.
# TYPE magicsock_num_relay_conns_removed counter
magicsock_num_relay_conns_removed_total 0
# HELP netcheck_stun_packets_dropped Incoming STUN packets dropped due to a full receiving queue..
# TYPE netcheck_stun_packets_dropped counter
netcheck_stun_packets_dropped_total 0
# HELP netcheck_stun_packets_sent_ipv4 Number of IPv4 STUN packets sent.
# TYPE netcheck_stun_packets_sent_ipv4 counter
netcheck_stun_packets_sent_ipv4_total 3
# HELP netcheck_stun_packets_sent_ipv6 Number of IPv6 STUN packets sent.
# TYPE netcheck_stun_packets_sent_ipv6 counter
netcheck_stun_packets_sent_ipv6_total 0
# HELP netcheck_stun_packets_recv_ipv4 Number of IPv4 STUN packets received.
# TYPE netcheck_stun_packets_recv_ipv4 counter
netcheck_stun_packets_recv_ipv4_total 3
# HELP netcheck_stun_packets_recv_ipv6 Number of IPv6 STUN packets received.
# TYPE netcheck_stun_packets_recv_ipv6 counter
netcheck_stun_packets_recv_ipv6_total 0
# HELP netcheck_reports Number of reports executed by netcheck, including full reports.
# TYPE netcheck_reports counter
netcheck_reports_total 1
# HELP netcheck_reports_full Number of full reports executed by netcheck.
# TYPE netcheck_reports_full counter
netcheck_reports_full_total 0
# HELP netcheck_reports_error Number of executed reports resulting in an error.
# TYPE netcheck_reports_error counter
netcheck_reports_error_total 0
# HELP portmap_probes_started Number of probing tasks started..
# TYPE portmap_probes_started counter
portmap_probes_started_total 1
# HELP portmap_local_port_updates Number of updates to the local port..
# TYPE portmap_local_port_updates counter
portmap_local_port_updates_total 1
# HELP portmap_mapping_attempts Number of mapping tasks started..
# TYPE portmap_mapping_attempts counter
portmap_mapping_attempts_total 2
# HELP portmap_mapping_failures Number of failed mapping tasks.
# TYPE portmap_mapping_failures counter
portmap_mapping_failures_total 1
# HELP portmap_external_address_updated Number of times the external address obtained via port mapping was updated..
# TYPE portmap_external_address_updated counter
portmap_external_address_updated_total 0
# HELP portmap_upnp_probes Number of UPnP probes executed..
# TYPE portmap_upnp_probes counter
portmap_upnp_probes_total 2
# HELP portmap_upnp_probes_failed Number of failed Upnp probes.
# TYPE portmap_upnp_probes_failed counter
portmap_upnp_probes_failed_total 1
# HELP portmap_upnp_available Number of UPnP probes that found it available..
# TYPE portmap_upnp_available counter
portmap_upnp_available_total 0
# HELP portmap_upnp_gateway_updated Number of UPnP probes that resulted in a gateway different to the previous one..
# TYPE portmap_upnp_gateway_updated counter
portmap_upnp_gateway_updated_total 0
# HELP portmap_pcp_probes Number of PCP probes executed..
# TYPE portmap_pcp_probes counter
portmap_pcp_probes_total 1
# HELP portmap_pcp_available Number of PCP probes that found it available..
# TYPE portmap_pcp_available counter
portmap_pcp_available_total 0
# HELP relayserver_bytes_sent Number of bytes sent..
# TYPE relayserver_bytes_sent counter
relayserver_bytes_sent_total 0
# HELP relayserver_bytes_recv Number of bytes received..
# TYPE relayserver_bytes_recv counter
relayserver_bytes_recv_total 0
# HELP relayserver_send_packets_sent Number of 'send' packets relayed..
# TYPE relayserver_send_packets_sent counter
relayserver_send_packets_sent_total 0
# HELP relayserver_send_packets_recv Number of 'send' packets received..
# TYPE relayserver_send_packets_recv counter
relayserver_send_packets_recv_total 0
# HELP relayserver_send_packets_dropped Number of 'send' packets dropped..
# TYPE relayserver_send_packets_dropped counter
relayserver_send_packets_dropped_total 0
# HELP relayserver_disco_packets_sent Number of disco packets sent..
# TYPE relayserver_disco_packets_sent counter
relayserver_disco_packets_sent_total 0
# HELP relayserver_disco_packets_recv Number of disco packets received..
# TYPE relayserver_disco_packets_recv counter
relayserver_disco_packets_recv_total 0
# HELP relayserver_disco_packets_dropped Number of disco packets dropped..
# TYPE relayserver_disco_packets_dropped counter
relayserver_disco_packets_dropped_total 0
# HELP relayserver_other_packets_sent Number of packets sent that were not disco packets or 'send' packets.
# TYPE relayserver_other_packets_sent counter
relayserver_other_packets_sent_total 0
# HELP relayserver_other_packets_recv Number of packets received that were not disco packets or 'send' packets.
# TYPE relayserver_other_packets_recv counter
relayserver_other_packets_recv_total 0
# HELP relayserver_other_packets_dropped Number of times a non-disco, non-'send; packet was dropped..
# TYPE relayserver_other_packets_dropped counter
relayserver_other_packets_dropped_total 0
# HELP relayserver_packets_forwarded_out Number of times the server has sent a forwarded packet.
# TYPE relayserver_packets_forwarded_out counter
relayserver_packets_forwarded_out_total 0
# HELP relayserver_packets_forwarded_in Number of times the server has received a forwarded packet..
# TYPE relayserver_packets_forwarded_in counter
relayserver_packets_forwarded_in_total 0
# HELP relayserver_got_ping Number of times the server has received a Ping from a client..
# TYPE relayserver_got_ping counter
relayserver_got_ping_total 0
# HELP relayserver_sent_pong Number of times the server has sent a Pong to a client..
# TYPE relayserver_sent_pong counter
relayserver_sent_pong_total 0
# HELP relayserver_unknown_frames Number of unknown frames sent to this server..
# TYPE relayserver_unknown_frames counter
relayserver_unknown_frames_total 0
# HELP relayserver_added_pkt_fwder Number of times a packeted forwarded was added to this server..
# TYPE relayserver_added_pkt_fwder counter
relayserver_added_pkt_fwder_total 0
# HELP relayserver_removed_pkt_fwder Number of times a packet forwarded was removed to this server..
# TYPE relayserver_removed_pkt_fwder counter
relayserver_removed_pkt_fwder_total 0
# HELP relayserver_accepts Number of times this server has accepted a connection..
# TYPE relayserver_accepts counter
relayserver_accepts_total 0
# HELP relayserver_disconnects Number of clients that have then disconnected..
# TYPE relayserver_disconnects counter
relayserver_disconnects_total 0
# EOF

@Arqu Arqu added this pull request to the merge queue Mar 28, 2024
Merged via the queue into main with commit ff88f65 Mar 28, 2024
21 checks passed
@Arqu Arqu deleted the arqu/metrics_are_back branch March 28, 2024 11:44
ppodolsky pushed a commit to izihawa/iroh that referenced this pull request Apr 1, 2024
## Description

Now metrics default to serving on `localhost:9090` but you can override
with a custom port or turn off if you like with `--metrics-port`. If you
want to actually expose the metrics endpoint to the world, it's assumed
you will set up a config file with a custom `metrics_addr`.

I guess the config override could have been done in a bit more elegant
way but didn't want to commit refactoring the `NodeConfig` nor did I
want fancy extra task specific fn's.

The configuration is limited to the iroh node start path, the rest are
ignored as they are expected to be short lived processes.

## Notes & open questions

<!-- Any notes, remarks or open questions you have to make about the PR.
-->

## Change checklist

- [ ] Self-review.
- [ ] Documentation updates if relevant.
- [ ] Tests if relevant.
ppodolsky pushed a commit to izihawa/iroh that referenced this pull request Apr 4, 2024
## Description

Now metrics default to serving on `localhost:9090` but you can override
with a custom port or turn off if you like with `--metrics-port`. If you
want to actually expose the metrics endpoint to the world, it's assumed
you will set up a config file with a custom `metrics_addr`.

I guess the config override could have been done in a bit more elegant
way but didn't want to commit refactoring the `NodeConfig` nor did I
want fancy extra task specific fn's.

The configuration is limited to the iroh node start path, the rest are
ignored as they are expected to be short lived processes.

## Notes & open questions

<!-- Any notes, remarks or open questions you have to make about the PR.
-->

## Change checklist

- [ ] Self-review.
- [ ] Documentation updates if relevant.
- [ ] Tests if relevant.
ppodolsky pushed a commit to izihawa/iroh that referenced this pull request Apr 4, 2024
## Description

Now metrics default to serving on `localhost:9090` but you can override
with a custom port or turn off if you like with `--metrics-port`. If you
want to actually expose the metrics endpoint to the world, it's assumed
you will set up a config file with a custom `metrics_addr`.

I guess the config override could have been done in a bit more elegant
way but didn't want to commit refactoring the `NodeConfig` nor did I
want fancy extra task specific fn's.

The configuration is limited to the iroh node start path, the rest are
ignored as they are expected to be short lived processes.

## Notes & open questions

<!-- Any notes, remarks or open questions you have to make about the PR.
-->

## Change checklist

- [ ] Self-review.
- [ ] Documentation updates if relevant.
- [ ] Tests if relevant.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

None yet

2 participants