Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
opendht
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Deploy
Model registry
Analyze
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
savoirfairelinux
opendht
Commits
9292c111
Commit
9292c111
authored
5 years ago
by
Sébastien Blin
Committed by
Adrien Béraud
5 years ago
Browse files
Options
Downloads
Patches
Plain Diff
proxy: count permanent put values by hash in stats
parent
a2afb5bb
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
include/opendht/dht_proxy_server.h
+4
-1
4 additions, 1 deletion
include/opendht/dht_proxy_server.h
src/dht_proxy_server.cpp
+6
-2
6 additions, 2 deletions
src/dht_proxy_server.cpp
tools/dhtproxy_stats.py
+4
-7
4 additions, 7 deletions
tools/dhtproxy_stats.py
with
14 additions
and
10 deletions
include/opendht/dht_proxy_server.h
+
4
−
1
View file @
9292c111
...
...
@@ -98,8 +98,10 @@ public:
struct
ServerStats
{
/** Current number of listen operations */
size_t
listenCount
{
0
};
/** Current number of permanent put operations */
/** Current number of permanent put operations
(hash used)
*/
size_t
putCount
{
0
};
/** Current number of permanent put values */
size_t
totalPermanentPuts
{
0
};
/** Current number of push tokens with at least one listen operation */
size_t
pushListenersCount
{
0
};
/** Average requests per second */
...
...
@@ -129,6 +131,7 @@ public:
Json
::
Value
result
;
result
[
"listenCount"
]
=
static_cast
<
Json
::
UInt64
>
(
listenCount
);
result
[
"putCount"
]
=
static_cast
<
Json
::
UInt64
>
(
putCount
);
result
[
"totalPermanentPuts"
]
=
static_cast
<
Json
::
UInt64
>
(
totalPermanentPuts
);
result
[
"pushListenersCount"
]
=
static_cast
<
Json
::
UInt64
>
(
pushListenersCount
);
result
[
"requestRate"
]
=
requestRate
;
if
(
nodeInfo
)
...
...
This diff is collapsed.
Click to expand it.
src/dht_proxy_server.cpp
+
6
−
2
View file @
9292c111
...
...
@@ -555,6 +555,10 @@ DhtProxyServer::updateStats(std::shared_ptr<NodeInfo> info) const
#ifdef OPENDHT_PUSH_NOTIFICATIONS
stats
.
pushListenersCount
=
pushListeners_
.
size
();
#endif
stats
.
totalPermanentPuts
=
0
;
std
::
for_each
(
puts_
.
begin
(),
puts_
.
end
(),
[
&
stats
](
const
auto
&
put
)
{
stats
.
totalPermanentPuts
+=
put
.
second
.
puts
.
size
();
});
stats
.
putCount
=
puts_
.
size
();
stats
.
listenCount
=
listeners_
.
size
();
stats
.
nodeInfo
=
std
::
move
(
info
);
...
...
This diff is collapsed.
Click to expand it.
tools/dhtproxy_stats.py
+
4
−
7
View file @
9292c111
...
...
@@ -7,7 +7,7 @@ stats_total = {"users":0, "pushListenersCount":0, "listenCount":0, "totalListene
for
i
in
range
(
80
,
101
):
print
(
"
Collecting stats for proxy
"
+
str
(
i
))
response
=
requests
.
request
(
'
STATS
'
,
'
http://
dhtproxy.jami.net
:
'
+
str
(
i
))
response
=
requests
.
request
(
'
STATS
'
,
'
http://
127.0.0.1
:
'
+
str
(
i
))
if
response
.
status_code
==
200
:
result
=
response
.
json
()
...
...
@@ -38,11 +38,8 @@ for i in range(80,101):
except
:
pass
try
:
total
=
0
for
h
,
v
in
result
[
"
puts
"
].
items
():
total
+=
int
(
v
)
stats
[
'
totalPermanentPuts
'
]
=
total
stats_total
[
'
totalPermanentPuts
'
]
+=
total
stats
[
'
totalPermanentPuts
'
]
=
int
(
result
[
"
totalPermanentPuts
"
])
stats_total
[
'
totalPermanentPuts
'
]
+=
int
(
result
[
"
totalPermanentPuts
"
])
except
:
pass
...
...
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