[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[tor-commits] [tor] 05/06: metrics: Fix naming and documentation



This is an automated email from the git hooks/post-receive script.

dgoulet pushed a commit to branch main
in repository tor.

commit a1c40c8511b841db773e82bd8024ef3581262900
Author: David Goulet <dgoulet@xxxxxxxxxxxxxx>
AuthorDate: Thu Oct 27 10:45:08 2022 -0400

    metrics: Fix naming and documentation
    
    After nickm's review, minor changes to names and comments.
    
    Related to #40194
    
    Signed-off-by: David Goulet <dgoulet@xxxxxxxxxxxxxx>
---
 src/core/or/connection_edge.c     | 6 +++---
 src/feature/relay/relay_metrics.c | 2 +-
 src/feature/stats/rephist.c       | 7 ++++---
 src/feature/stats/rephist.h       | 4 ++--
 4 files changed, 10 insertions(+), 9 deletions(-)

diff --git a/src/core/or/connection_edge.c b/src/core/or/connection_edge.c
index 2a79d0cf58..5ef7a0982b 100644
--- a/src/core/or/connection_edge.c
+++ b/src/core/or/connection_edge.c
@@ -4120,7 +4120,7 @@ connection_exit_begin_resolve(cell_t *cell, or_circuit_t *circ)
     return -1;
 
   /* Note the RESOLVE stream as seen. */
-  rep_hist_note_stream(RELAY_COMMAND_RESOLVE);
+  rep_hist_note_exit_stream(RELAY_COMMAND_RESOLVE);
 
   /* This 'dummy_conn' only exists to remember the stream ID
    * associated with the resolve request; and to make the
@@ -4246,7 +4246,7 @@ connection_exit_connect(edge_connection_t *edge_conn)
 
   /* Note the BEGIN stream as seen. We do this after the Exit policy check in
    * order to only account for valid streams. */
-  rep_hist_note_stream(RELAY_COMMAND_BEGIN);
+  rep_hist_note_exit_stream(RELAY_COMMAND_BEGIN);
 
 #ifdef HAVE_SYS_UN_H
   if (conn->socket_family != AF_UNIX) {
@@ -4344,7 +4344,7 @@ connection_exit_connect_dir(edge_connection_t *exitconn)
   log_info(LD_EXIT, "Opening local connection for anonymized directory exit");
 
   /* Note the BEGIN_DIR stream as seen. */
-  rep_hist_note_stream(RELAY_COMMAND_BEGIN_DIR);
+  rep_hist_note_exit_stream(RELAY_COMMAND_BEGIN_DIR);
 
   exitconn->base_.state = EXIT_CONN_STATE_OPEN;
 
diff --git a/src/feature/relay/relay_metrics.c b/src/feature/relay/relay_metrics.c
index beae0e3f2f..814afa6006 100644
--- a/src/feature/relay/relay_metrics.c
+++ b/src/feature/relay/relay_metrics.c
@@ -160,7 +160,7 @@ fill_single_stream_value(metrics_store_entry_t *sentry, uint8_t cmd)
 {
   metrics_store_entry_add_label(sentry,
           metrics_format_label("type", relay_command_to_string(cmd)));
-  metrics_store_entry_update(sentry, rep_hist_get_stream_seen(cmd));
+  metrics_store_entry_update(sentry, rep_hist_get_exit_stream_seen(cmd));
 }
 
 /** Fill function for the RELAY_METRICS_NUM_STREAMS metric. */
diff --git a/src/feature/stats/rephist.c b/src/feature/stats/rephist.c
index 962450e72b..021ef6d96e 100644
--- a/src/feature/stats/rephist.c
+++ b/src/feature/stats/rephist.c
@@ -1639,7 +1639,7 @@ rep_hist_note_exit_stream_opened(uint16_t port)
   log_debug(LD_HIST, "Opened exit stream to port %d", port);
 }
 
-/*** Streams statistics ***/
+/*** Exit streams statistics ***/
 
 /** Number of BEGIN streams seen. */
 static uint64_t streams_begin_seen;
@@ -1650,7 +1650,7 @@ static uint64_t streams_resolve_seen;
 
 /** Note a stream as seen for the given relay command. */
 void
-rep_hist_note_stream(unsigned int cmd)
+rep_hist_note_exit_stream(unsigned int cmd)
 {
   switch (cmd) {
   case RELAY_COMMAND_BEGIN:
@@ -1663,13 +1663,14 @@ rep_hist_note_stream(unsigned int cmd)
     streams_resolve_seen++;
     break;
   default:
+    tor_assert_nonfatal_unreached_once();
     break;
   }
 }
 
 /** Return number of stream seen for the given command. */
 uint64_t
-rep_hist_get_stream_seen(unsigned int cmd)
+rep_hist_get_exit_stream_seen(unsigned int cmd)
 {
   switch (cmd) {
   case RELAY_COMMAND_BEGIN:
diff --git a/src/feature/stats/rephist.h b/src/feature/stats/rephist.h
index c1352ae7f8..02d23a4c1b 100644
--- a/src/feature/stats/rephist.h
+++ b/src/feature/stats/rephist.h
@@ -48,8 +48,8 @@ uint64_t rep_hist_get_conn_created(bool initiated, unsigned int type);
 uint64_t rep_hist_get_conn_opened(bool initiated, unsigned int type);
 uint64_t rep_hist_get_conn_rejected(unsigned int type);
 
-void rep_hist_note_stream(unsigned int cmd);
-uint64_t rep_hist_get_stream_seen(unsigned int cmd);
+void rep_hist_note_exit_stream(unsigned int cmd);
+uint64_t rep_hist_get_exit_stream_seen(unsigned int cmd);
 
 void rep_hist_buffer_stats_init(time_t now);
 void rep_hist_buffer_stats_add_circ(circuit_t *circ,

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.
_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits