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
f5ba8a2a
Commit
f5ba8a2a
authored
6 years ago
by
Pierre Krieger
Committed by
Gav Wood
6 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Report the network PeerId to the telemetry (#1835)
* Report the network PeerId to the telemetry * Fix accidental paste
parent
8a3f52bd
Branches
Branches containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
substrate/core/network/src/service.rs
+8
-1
8 additions, 1 deletion
substrate/core/network/src/service.rs
substrate/core/service/src/lib.rs
+3
-1
3 additions, 1 deletion
substrate/core/service/src/lib.rs
with
11 additions
and
2 deletions
substrate/core/network/src/service.rs
+
8
−
1
View file @
f5ba8a2a
...
...
@@ -20,7 +20,7 @@ use std::{io, thread};
use
log
::{
warn
,
debug
,
error
,
trace
};
use
futures
::{
Async
,
Future
,
Stream
,
stream
,
sync
::
oneshot
};
use
parking_lot
::
Mutex
;
use
network_libp2p
::{
ProtocolId
,
PeerId
,
NetworkConfiguration
,
NodeIndex
,
ErrorKind
,
Severity
};
use
network_libp2p
::{
ProtocolId
,
NetworkConfiguration
,
NodeIndex
,
ErrorKind
,
Severity
};
use
network_libp2p
::{
start_service
,
parse_str_addr
,
Service
as
NetworkService
,
ServiceEvent
as
NetworkServiceEvent
};
use
network_libp2p
::{
Protocol
as
Libp2pProtocol
,
RegisteredProtocol
};
use
consensus
::
import_queue
::{
ImportQueue
,
Link
};
...
...
@@ -36,6 +36,8 @@ use crate::specialization::NetworkSpecialization;
use
tokio
::
prelude
::
task
::
AtomicTask
;
use
tokio
::
runtime
::
Runtime
;
pub
use
network_libp2p
::
PeerId
;
/// Type that represents fetch completion future.
pub
type
FetchFuture
=
oneshot
::
Receiver
<
Vec
<
u8
>>
;
...
...
@@ -180,6 +182,11 @@ impl<B: BlockT + 'static, S: NetworkSpecialization<B>> Service<B, S> {
self
.network
.lock
()
.average_upload_per_sec
()
}
/// Returns the network identity of the node.
pub
fn
local_peer_id
(
&
self
)
->
PeerId
{
self
.network
.lock
()
.peer_id
()
.clone
()
}
/// Called when a new block is imported by the client.
pub
fn
on_block_imported
(
&
self
,
hash
:
B
::
Hash
,
header
:
B
::
Header
)
{
let
_
=
self
...
...
This diff is collapsed.
Click to expand it.
substrate/core/service/src/lib.rs
+
3
−
1
View file @
f5ba8a2a
...
...
@@ -271,6 +271,7 @@ impl<Components: components::Components> Service<Components> {
// Telemetry
let
telemetry
=
config
.telemetry_url
.clone
()
.map
(|
url
|
{
let
is_authority
=
config
.roles
==
Roles
::
AUTHORITY
;
let
network_id
=
network
.local_peer_id
()
.to_base58
();
let
pubkey
=
format!
(
"{}"
,
public_key
);
let
name
=
config
.name
.clone
();
let
impl_name
=
config
.impl_name
.to_owned
();
...
...
@@ -286,7 +287,8 @@ impl<Components: components::Components> Service<Components> {
"config"
=>
""
,
"chain"
=>
chain_name
.clone
(),
"pubkey"
=>
&
pubkey
,
"authority"
=>
is_authority
"authority"
=>
is_authority
,
"network_id"
=>
network_id
.clone
()
);
}),
}))
...
...
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