Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Tor
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
orbea
Tor
Commits
2b97c1dd
Commit
2b97c1dd
authored
3 years ago
by
George Kadianakis
Browse files
Options
Downloads
Plain Diff
Merge remote-tracking branch 'tor-gitlab/mr/385'
parents
45b59871
d4fbfb54
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
src/feature/relay/relay_metrics.c
+2
-2
2 additions, 2 deletions
src/feature/relay/relay_metrics.c
src/feature/stats/rephist.c
+26
-7
26 additions, 7 deletions
src/feature/stats/rephist.c
src/feature/stats/rephist.h
+5
-2
5 additions, 2 deletions
src/feature/stats/rephist.h
with
33 additions
and
11 deletions
src/feature/relay/relay_metrics.c
+
2
−
2
View file @
2b97c1dd
...
...
@@ -265,7 +265,7 @@ fill_onionskins_values(void)
metrics_store_entry_add_label
(
sentry
,
metrics_format_label
(
"action"
,
"processed"
));
metrics_store_entry_update
(
sentry
,
rep_hist_get_circuit_handshake_assigned
(
t
));
rep_hist_get_circuit_
n_
handshake_assigned
(
t
));
sentry
=
metrics_store_add
(
the_store
,
rentry
->
type
,
rentry
->
name
,
rentry
->
help
);
...
...
@@ -273,7 +273,7 @@ fill_onionskins_values(void)
metrics_store_entry_add_label
(
sentry
,
metrics_format_label
(
"action"
,
"dropped"
));
metrics_store_entry_update
(
sentry
,
rep_hist_get_circuit_handshake_dropped
(
t
));
rep_hist_get_circuit_
n_
handshake_dropped
(
t
));
tor_free
(
type_label
);
}
}
...
...
This diff is collapsed.
Click to expand it.
src/feature/stats/rephist.c
+
26
−
7
View file @
2b97c1dd
...
...
@@ -1998,12 +1998,18 @@ rep_hist_note_desc_served(const char * desc)
/** Internal statistics to track how many requests of each type of
* handshake we've received, and how many we've assigned to cpuworkers.
* Useful for seeing trends in cpu load.
*
* They are reset at every heartbeat.
* @{ */
STATIC
int
onion_handshakes_requested
[
MAX_ONION_HANDSHAKE_TYPE
+
1
]
=
{
0
};
STATIC
int
onion_handshakes_assigned
[
MAX_ONION_HANDSHAKE_TYPE
+
1
]
=
{
0
};
STATIC
uint64_t
onion_handshakes_dropped
[
MAX_ONION_HANDSHAKE_TYPE
+
1
]
=
{
0
};
/**@}*/
/** Counters keeping the same stats as above but for the entire duration of the
* process (not reset). */
static
uint64_t
stats_n_onionskin_assigned
[
MAX_ONION_HANDSHAKE_TYPE
+
1
]
=
{
0
};
static
uint64_t
stats_n_onionskin_dropped
[
MAX_ONION_HANDSHAKE_TYPE
+
1
]
=
{
0
};
/** A new onionskin (using the <b>type</b> handshake) has arrived. */
void
rep_hist_note_circuit_handshake_requested
(
uint16_t
type
)
...
...
@@ -2017,8 +2023,10 @@ rep_hist_note_circuit_handshake_requested(uint16_t type)
void
rep_hist_note_circuit_handshake_assigned
(
uint16_t
type
)
{
if
(
type
<=
MAX_ONION_HANDSHAKE_TYPE
)
if
(
type
<=
MAX_ONION_HANDSHAKE_TYPE
)
{
onion_handshakes_assigned
[
type
]
++
;
stats_n_onionskin_assigned
[
type
]
++
;
}
}
/** We've just drop an onionskin (using the <b>type</b> handshake) due to being
...
...
@@ -2026,8 +2034,9 @@ rep_hist_note_circuit_handshake_assigned(uint16_t type)
void
rep_hist_note_circuit_handshake_dropped
(
uint16_t
type
)
{
if
(
type
<=
MAX_ONION_HANDSHAKE_TYPE
)
onion_handshakes_dropped
[
type
]
++
;
if
(
type
<=
MAX_ONION_HANDSHAKE_TYPE
)
{
stats_n_onionskin_dropped
[
type
]
++
;
}
}
/** Get the circuit handshake value that is requested. */
...
...
@@ -2050,14 +2059,24 @@ rep_hist_get_circuit_handshake_assigned, (uint16_t type))
return
onion_handshakes_assigned
[
type
];
}
/** Get the circuit handshake value that is dropped. */
/** Get the total number of circuit handshake value that is assigned. */
MOCK_IMPL
(
uint64_t
,
rep_hist_get_circuit_n_handshake_assigned
,
(
uint16_t
type
))
{
if
(
BUG
(
type
>
MAX_ONION_HANDSHAKE_TYPE
))
{
return
0
;
}
return
stats_n_onionskin_assigned
[
type
];
}
/** Get the total number of circuit handshake value that is dropped. */
MOCK_IMPL
(
uint64_t
,
rep_hist_get_circuit_handshake_dropped
,
(
uint16_t
type
))
rep_hist_get_circuit_
n_
handshake_dropped
,
(
uint16_t
type
))
{
if
(
BUG
(
type
>
MAX_ONION_HANDSHAKE_TYPE
))
{
return
0
;
}
return
onion_handshakes
_dropped
[
type
];
return
stats_n_onionskin
_dropped
[
type
];
}
/** Log our onionskin statistics since the last time we were called. */
...
...
This diff is collapsed.
Click to expand it.
src/feature/stats/rephist.h
+
5
−
2
View file @
2b97c1dd
...
...
@@ -63,7 +63,11 @@ void rep_hist_log_circuit_handshake_stats(time_t now);
MOCK_DECL
(
int
,
rep_hist_get_circuit_handshake_requested
,
(
uint16_t
type
));
MOCK_DECL
(
int
,
rep_hist_get_circuit_handshake_assigned
,
(
uint16_t
type
));
MOCK_DECL
(
uint64_t
,
rep_hist_get_circuit_handshake_dropped
,
(
uint16_t
type
));
MOCK_DECL
(
uint64_t
,
rep_hist_get_circuit_n_handshake_assigned
,
(
uint16_t
type
));
MOCK_DECL
(
uint64_t
,
rep_hist_get_circuit_n_handshake_dropped
,
(
uint16_t
type
));
void
rep_hist_hs_stats_init
(
time_t
now
);
void
rep_hist_hs_stats_term
(
void
);
...
...
@@ -90,7 +94,6 @@ extern uint32_t rephist_total_num;
#ifdef TOR_UNIT_TESTS
extern
int
onion_handshakes_requested
[
MAX_ONION_HANDSHAKE_TYPE
+
1
];
extern
int
onion_handshakes_assigned
[
MAX_ONION_HANDSHAKE_TYPE
+
1
];
extern
uint64_t
onion_handshakes_dropped
[
MAX_ONION_HANDSHAKE_TYPE
+
1
];
#endif
#ifdef REPHIST_PRIVATE
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment