Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
p2p
go-p2p-swarm
Commits
1142e3ca
Commit
1142e3ca
authored
Nov 16, 2015
by
Jeromy
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
remove prometheus dep
parent
0ad6dfa3
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
0 additions
and
31 deletions
+0
-31
swarm.go
swarm.go
+0
-31
No files found.
swarm.go
View file @
1142e3ca
...
...
@@ -24,7 +24,6 @@ import (
mafilter
"QmYhewVqJhkgEsm3AYVUbpT14q2P9V4Xb7np9JXKua6y7A/multiaddr-filter"
context
"QmacZi9WygGK7Me8mH53pypyscHzU386aUZXpr28GZgUct/context"
ma
"QmbWxL1aXQhBjc1XGjGF1f2KGBMCBYSuT2ThA8YXnXJK83/go-multiaddr"
prom
"github.com/prometheus/client_golang/prometheus"
logging
"QmWRypnfEwrgH4k93KEHN5hng7VjKYkWmzDYRuTZeh2Mgh/go-log"
)
...
...
@@ -33,13 +32,6 @@ var log = logging.Logger("swarm2")
var
PSTransport
pst
.
Transport
var
peersTotal
=
prom
.
NewGaugeVec
(
prom
.
GaugeOpts
{
Namespace
:
"ipfs"
,
Subsystem
:
"p2p"
,
Name
:
"peers_total"
,
Help
:
"Number of connected peers"
,
},
[]
string
{
"peer_id"
})
func
init
()
{
PSTransport
=
psmss
.
NewTransport
()
}
...
...
@@ -109,10 +101,6 @@ func NewSwarm(ctx context.Context, listenAddrs []ma.Multiaddr,
s
.
proc
=
goprocessctx
.
WithContextAndTeardown
(
ctx
,
s
.
teardown
)
s
.
SetConnHandler
(
nil
)
// make sure to setup our own conn handler.
// setup swarm metrics
prom
.
MustRegisterOrGet
(
peersTotal
)
s
.
Notify
((
*
metricsNotifiee
)(
s
))
err
=
s
.
setupInterfaces
(
listenAddrs
)
if
err
!=
nil
{
return
nil
,
err
...
...
@@ -321,22 +309,3 @@ func (n *ps2netNotifee) OpenedStream(s *ps.Stream) {
func
(
n
*
ps2netNotifee
)
ClosedStream
(
s
*
ps
.
Stream
)
{
n
.
not
.
ClosedStream
(
n
.
net
,
inet
.
Stream
((
*
Stream
)(
s
)))
}
type
metricsNotifiee
Swarm
func
(
nn
*
metricsNotifiee
)
Connected
(
n
inet
.
Network
,
v
inet
.
Conn
)
{
peersTotalGauge
(
n
.
LocalPeer
())
.
Set
(
float64
(
len
(
n
.
Conns
())))
}
func
(
nn
*
metricsNotifiee
)
Disconnected
(
n
inet
.
Network
,
v
inet
.
Conn
)
{
peersTotalGauge
(
n
.
LocalPeer
())
.
Set
(
float64
(
len
(
n
.
Conns
())))
}
func
(
nn
*
metricsNotifiee
)
OpenedStream
(
n
inet
.
Network
,
v
inet
.
Stream
)
{}
func
(
nn
*
metricsNotifiee
)
ClosedStream
(
n
inet
.
Network
,
v
inet
.
Stream
)
{}
func
(
nn
*
metricsNotifiee
)
Listen
(
n
inet
.
Network
,
a
ma
.
Multiaddr
)
{}
func
(
nn
*
metricsNotifiee
)
ListenClose
(
n
inet
.
Network
,
a
ma
.
Multiaddr
)
{}
func
peersTotalGauge
(
id
peer
.
ID
)
prom
.
Gauge
{
return
peersTotal
.
With
(
prom
.
Labels
{
"peer_id"
:
id
.
Pretty
()})
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment