Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
polkadot-sdk
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
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
parity
Mirrored projects
polkadot-sdk
Commits
00ae1fa6
Commit
00ae1fa6
authored
3 years ago
by
Squirrel
Committed by
GitHub
3 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Stop sending network_state to telemetry (#9026)
(We send network information to prometheus)
parent
828d1d74
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
substrate/client/service/src/metrics.rs
+1
-24
1 addition, 24 deletions
substrate/client/service/src/metrics.rs
with
1 addition
and
24 deletions
substrate/client/service/src/metrics.rs
+
1
−
24
View file @
00ae1fa6
...
...
@@ -27,7 +27,7 @@ use sp_runtime::traits::{NumberFor, Block, SaturatedConversion, UniqueSaturatedI
use
sp_transaction_pool
::{
PoolStatus
,
MaintainedTransactionPool
};
use
sp_utils
::
metrics
::
register_globals
;
use
sc_client_api
::{
ClientInfo
,
UsageProvider
};
use
sc_network
::{
config
::
Role
,
NetworkStatus
,
NetworkService
,
network_state
::
NetworkState
};
use
sc_network
::{
config
::
Role
,
NetworkStatus
,
NetworkService
};
use
std
::
sync
::
Arc
;
use
std
::
time
::
Duration
;
use
wasm_timer
::
Instant
;
...
...
@@ -171,30 +171,18 @@ impl MetricsService {
let
mut
timer
=
Delay
::
new
(
Duration
::
from_secs
(
0
));
let
timer_interval
=
Duration
::
from_secs
(
5
);
let
net_state_duration
=
Duration
::
from_secs
(
30
);
let
mut
last_net_state
=
Instant
::
now
();
loop
{
// Wait for the next tick of the timer.
(
&
mut
timer
)
.await
;
let
now
=
Instant
::
now
();
let
from_net_state
=
now
.duration_since
(
last_net_state
);
// Try to get the latest network information.
let
net_status
=
network
.status
()
.await
.ok
();
let
net_state
=
if
from_net_state
>=
net_state_duration
{
last_net_state
=
now
;
network
.network_state
()
.await
.ok
()
}
else
{
None
};
// Update / Send the metrics.
self
.update
(
&
client
.usage_info
(),
&
transactions
.status
(),
net_status
,
net_state
,
);
// Schedule next tick.
...
...
@@ -207,7 +195,6 @@ impl MetricsService {
info
:
&
ClientInfo
<
T
>
,
txpool_status
:
&
PoolStatus
,
net_status
:
Option
<
NetworkStatus
<
T
>>
,
net_state
:
Option
<
NetworkState
>
,
)
{
let
now
=
Instant
::
now
();
let
elapsed
=
(
now
-
self
.last_update
)
.as_secs
();
...
...
@@ -300,15 +287,5 @@ impl MetricsService {
}
}
}
// Send network state information, if any.
if
let
Some
(
net_state
)
=
net_state
{
telemetry!
(
self
.telemetry
;
SUBSTRATE_INFO
;
"system.network_state"
;
"state"
=>
net_state
,
);
}
}
}
This diff is collapsed.
Click to expand it.
Preview
0%
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