Documentation ¶
Index ¶
- Variables
- type Client
- type ClientDist
- func (c *ClientDist) AddClientVersion(clientName, clientVersion string)
- func (c ClientDist) GetClientDistribution() map[string]int
- func (c ClientDist) GetClientNames() []string
- func (c ClientDist) GetClientVersionDistribution() map[string]int
- func (c ClientDist) GetCountOfClient(clientName string) int
- func (c ClientDist) GetTotalCount() int
- type ErrorHandling
- type PeerStore
- type StringMapMetric
- type Version
Constants ¶
This section is empty.
Variables ¶
var ( ClientDistribution = prometheus.NewGaugeVec(prometheus.GaugeOpts{ Namespace: "crawler", Name: "observed_client_distribution", Help: "Number of peers from each of the clients observed", }, []string{"client"}, ) GeoDistribution = prometheus.NewGaugeVec(prometheus.GaugeOpts{ Namespace: "crawler", Name: "geographical_distribution", Help: "Number of peers from each of the crawled countries", }, []string{"country"}, ) TotPeers = prometheus.NewGauge(prometheus.GaugeOpts{ Namespace: "crawler", Name: "total_crawled_peers", Help: "The number of discovered peers with the crawler", }) ConnectedPeers = prometheus.NewGauge(prometheus.GaugeOpts{ Namespace: "crawler", Name: "connected_peers", Help: "The number of connected peers with the crawler", }) DeprecatedPeers = prometheus.NewGauge(prometheus.GaugeOpts{ Namespace: "crawler", Name: "deprecated_peers", Help: "The number of peers deprecated by the crawler", }) ClientVersionDistribution = prometheus.NewGaugeVec(prometheus.GaugeOpts{ Namespace: "crawler", Name: "observed_client_version_distribution", Help: "Number of peers from each of the clients versions observed", }, []string{"client_version"}, ) IpDistribution = prometheus.NewGaugeVec(prometheus.GaugeOpts{ Namespace: "crawler", Name: "observed_ip_distribution", Help: "Number of Ips hosting number of nodes", }, []string{"numbernodes"}, ) RttDistribution = prometheus.NewGaugeVec(prometheus.GaugeOpts{ Namespace: "crawler", Name: "observed_rtt_distribution", Help: "RTT distribution for the active discovered peers", }, []string{"secs"}, ) TotcontimeDistribution = prometheus.NewGaugeVec(prometheus.GaugeOpts{ Namespace: "crawler", Name: "observed_total_connected_time_distribution", Help: "Distribution of the connected time for each active discovered peer", }, []string{"mins"}, ) )
List of metrics that we are going to export
var ( // logging variables ModuleName = "PEERSTORE" Log = logrus.WithField( "module", ModuleName, ) // TODO: put it into a config-variable ExportLoopTime time.Duration = 30 * time.Minute )
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct {
Versions []Version
}
Client: stores the information about all versions of the client
func (*Client) AddVersion ¶
AddVersion This method adds one or creates a new version under the client @param inputVersion: the version to add
func (Client) ReturnTotalCount ¶
ReturnTotalCount This method returns the total number of nodes in any version
type ClientDist ¶
ClientDist: stores the distribution of all watched clients
func NewClientDist ¶
func NewClientDist() ClientDist
Constructor for ClientDist. Instances an empty map
func (*ClientDist) AddClientVersion ¶
func (c *ClientDist) AddClientVersion(clientName, clientVersion string)
AddClientVersion: This method will add one to the count, or create a new entry for the given version in the given client. @param clientName: the name of the client. @param clientVersion: the version to add or create in the given client.
func (ClientDist) GetClientDistribution ¶
func (c ClientDist) GetClientDistribution() map[string]int
GetClientDistribution: This method returns the number of nodes for each watched client. @return a map where key: clientName, value: totalCount.
func (ClientDist) GetClientNames ¶
func (c ClientDist) GetClientNames() []string
GetClientNames: This method returns the names of the watched clients. @return the string array containing the names.
func (ClientDist) GetClientVersionDistribution ¶
func (c ClientDist) GetClientVersionDistribution() map[string]int
GetClientVersionDistribution: This method calculates the distribution of clients and versions. @return a map where key: client_version, value:count.
func (ClientDist) GetCountOfClient ¶
func (c ClientDist) GetCountOfClient(clientName string) int
GetCountOfClient: This method returns the number of watched nodes under the given client. @param clientName: the client to count on. @return the number of nodes.
func (ClientDist) GetTotalCount ¶
func (c ClientDist) GetTotalCount() int
GetTotalCount: This method returns the total number of watched nodes. @return the total number.
type ErrorHandling ¶
type PeerStore ¶
type PeerStore struct { Storage *postgresql.PostgresDBService ExporterService *exporters.ExporterService // contains filtered or unexported fields }
func NewPeerStore ¶
func NewPeerStore(ctx context.Context, exporter *exporters.ExporterService, path string, endpoint string, netModel postgresql.NetworkModel) PeerStore
func (*PeerStore) GetPeerData ¶
GetPeerData: This method return a Peer object from the peerstore using the given peerID. @param peerID: the peerID to look for in string format. @return the found Peer object and an error if there was.
func (*PeerStore) GetPeerList ¶
GetPeerList: This method returns the list of PeerIDs in the DB. @return the list of PeerIDs in string format.
func (*PeerStore) ServeMetrics ¶ added in v1.1.0
func (ps *PeerStore) ServeMetrics()
ServeMetrics * This method will serve the global peerstore values to the * local prometheus instance
func (*PeerStore) StoreOrUpdatePeer ¶
StoreOrUpdatePeer: Updates the peer without overwritting all its content. If peer exists, aggregate data to the existing peer. Otherwise, store the peer. @param peer: the peer to store or update
type StringMapMetric ¶
type StringMapMetric struct {
// contains filtered or unexported fields
}
StringMapMetric: stores a standard map metric for prometheus.
func NewStringMapMetric ¶
func NewStringMapMetric() StringMapMetric
Constructor for StringMapMetric. creates an empty map.
func (*StringMapMetric) AddOneorCreate ¶
func (m *StringMapMetric) AddOneorCreate(inputKey string)
AddOneorCreate: In case the key does not exist: create. In case it exists, add one. @param inputKey: the key to add or create.
func (StringMapMetric) ObtainDistribution ¶
func (m StringMapMetric) ObtainDistribution() StringMapMetric
ObtainDistribution: This method will calculate the distribution of the curent metric. @return the distribution in a StringMapMetric object.
func (StringMapMetric) SetValues ¶
func (m StringMapMetric) SetValues(registered_name *prometheus.GaugeVec)
SetValues: Given a prometheus registered variable, dump the metrics into it. @param registered_name: the prometheus variable where to dump data.
func (*StringMapMetric) Traspose ¶
func (m *StringMapMetric) Traspose()
Traspose: This method will traspose the current metric. This is: keys are now values and values are now keys.