Documentation ¶
Overview ¶
Package metrics provides a metric logging wrappers for Prometheus server.
Package metrics provides a metric logging wrappers for Prometheus server.
Package metrics provides a metric logging wrappers for Prometheus server.
Index ¶
- Variables
- type Counter
- func (counter *Counter) Add(x float64, labels map[string]string)
- func (counter *Counter) AddMetric(values map[string]string)
- func (counter *Counter) AddUint64(x uint64, labels map[string]string)
- func (counter *Counter) Deregister(reg *Registry)
- func (counter *Counter) Inc(labels map[string]string)
- func (counter *Counter) Register(reg *Registry)
- func (counter *Counter) WriteMetric(buf *strings.Builder, parentLabels string)
- type Gauge
- func (gauge *Gauge) Add(x float64, labels map[string]string)
- func (gauge *Gauge) AddMetric(values map[string]string)
- func (gauge *Gauge) Deregister(reg *Registry)
- func (gauge *Gauge) Register(reg *Registry)
- func (gauge *Gauge) Set(x float64, labels map[string]string)
- func (gauge *Gauge) TouchAll()
- func (gauge *Gauge) WriteMetric(buf *strings.Builder, parentLabels string)
- type Metric
- type MetricName
- type MetricReporter
- type MetricService
- type Registry
- type Segment
- type SegmentInstance
- type ServiceConfig
- type StringGauge
- func (stringGauge *StringGauge) AddMetric(values map[string]string)
- func (stringGauge *StringGauge) Deregister(reg *Registry)
- func (stringGauge *StringGauge) Register(reg *Registry)
- func (stringGauge *StringGauge) Set(key string, value string)
- func (stringGauge *StringGauge) WriteMetric(buf *strings.Builder, parentLabels string)
Constants ¶
This section is empty.
Variables ¶
var ( // NetworkIncomingConnections Number of incoming connections NetworkIncomingConnections = MetricName{Name: "algod_network_incoming_connections", Description: "Number of incoming connections"} // NetworkOutgoingConnections Number of outgoing connections NetworkOutgoingConnections = MetricName{Name: "algod_network_outgoing_connections", Description: "Number of outgoing connections"} // NetworkOutgoingUniqueConnections Total number of unique outgoing addresses connections ever seen by node. NetworkOutgoingUniqueConnections = MetricName{Name: "algod_network_unique_outgoing_connections", Description: "Number of unique outgoing connections"} // NetworkPeersGarbageCollected How many peers were not caught by event-based cleanup but instead polling garbage collection thread. NetworkPeersGarbageCollected = MetricName{Name: "algod_network_peer_gc", Description: "Number of peers garbage collected instead of normal inline close flow"} // NetworkSentBytesTotal Total number of bytes that were sent over the network NetworkSentBytesTotal = MetricName{Name: "algod_network_sent_bytes_total", Description: "Total number of bytes that were sent over the network"} // NetworkReceivedBytesTotal Total number of bytes that were received from the network NetworkReceivedBytesTotal = MetricName{Name: "algod_network_received_bytes_total", Description: "Total number of bytes that were received from the network"} // NetworkMessageReceivedTotal Total number of complete messages that were received from the network NetworkMessageReceivedTotal = MetricName{Name: "algod_network_message_received_total", Description: "Total number of complete messages that were received from the network"} // NetworkMessageSentTotal Total number of complete messages that were sent to the network NetworkMessageSentTotal = MetricName{Name: "algod_network_message_sent_total", Description: "Total number of complete messages that were sent to the network"} // NetworkConnectionsDroppedTotal Total number of connections that were dropped before a message NetworkConnectionsDroppedTotal = MetricName{Name: "algod_network_connections_dropped_total", Description: "Total number of connections that were dropped before a message"} // NetworkSentDecompressedBytesTotal Total number of bytes that were sent over the network prior of being compressed NetworkSentDecompressedBytesTotal = MetricName{Name: "algod_network_sent_decompressed_bytes_total", Description: "Total number of bytes that were sent over the network prior of being compressed"} // NetworkReceivedDecompressedBytesTotal Total number of bytes that were received from the network after of being decompressed NetworkReceivedDecompressedBytesTotal = MetricName{Name: "algod_network_received_decompressed_bytes_total", Description: "Total number of bytes that were received from the network after being decompressed"} // DuplicateNetworkMessageReceivedTotal Total number of duplicate messages that were received from the network DuplicateNetworkMessageReceivedTotal = MetricName{Name: "algod_network_duplicate_message_received_total", Description: "Total number of duplicate messages that were received from the network"} // DuplicateNetworkMessageReceivedBytesTotal The total number ,in bytes, of the duplicate messages that were received from the network DuplicateNetworkMessageReceivedBytesTotal = MetricName{Name: "algod_network_duplicate_message_received_bytes_total", Description: "The total number ,in bytes, of the duplicate messages that were received from the network"} // OutgoingNetworkMessageFilteredOutTotal Total number of messages that were not sent per peer request OutgoingNetworkMessageFilteredOutTotal = MetricName{Name: "algod_outgoing_network_message_filtered_out_total", Description: "Total number of messages that were not sent per peer request"} // OutgoingNetworkMessageFilteredOutBytesTotal Total number of bytes saved by not sending messages that were asked not to be sent by peer OutgoingNetworkMessageFilteredOutBytesTotal = MetricName{Name: "algod_outgoing_network_message_filtered_out_bytes_total", Description: "Total number of bytes saved by not sending messages that were asked not to be sent by peer"} // CryptoGenSigSecretsTotal Total number of calls to GenerateSignatureSecrets() CryptoGenSigSecretsTotal = MetricName{Name: "algod_crypto_signature_secrets_generate_total", Description: "Total number of calls to GenerateSignatureSecrets"} // CryptoSigSecretsSignTotal Total number of calls to SignatureSecrets.Sign CryptoSigSecretsSignTotal = MetricName{Name: "algod_crypto_signature_secrets_sign_total", Description: "Total number of calls to SignatureSecrets.Sign"} // CryptoSigSecretsSignBytesTotal Total number of calls to SignatureSecrets.signBytes CryptoSigSecretsSignBytesTotal = MetricName{Name: "algod_crypto_signature_secrets_bytes_sign_total", Description: "Total number of calls to SignatureSecrets.signBytes"} // CryptoSigSecretsVerifyTotal Total number of calls to SignatureVerifier.Verify CryptoSigSecretsVerifyTotal = MetricName{Name: "algod_crypto_signature_secrets_verify_total", Description: "Total number of calls to SignatureVerifier.Verify"} // CryptoVRFGenerateTotal Total number of calls to GenerateVRFSecrets() CryptoVRFGenerateTotal = MetricName{Name: "algod_crypto_vrf_generate_total", Description: "Total number of calls to GenerateVRFSecrets"} // CryptoVRFProveTotal Total number of calls to VRFSecrets.Prove CryptoVRFProveTotal = MetricName{Name: "algod_crypto_vrf_prove_total", Description: "Total number of calls to VRFSecrets.Prove"} // CryptoVRFHashTotal Total number of calls to VRFProof.Hash CryptoVRFHashTotal = MetricName{Name: "algod_crypto_vrf_hash_total", Description: "Total number of calls to VRFProof.Hash"} // CryptoVRFVerifyTotal Total number of calls to VRFVerifier.Verify CryptoVRFVerifyTotal = MetricName{Name: "algod_crypto_vrf_verify_total", Description: "Total number of calls to VRFVerifier.Verify"} // CryptoSigSecretsVerifyBytesTotal Total number of calls to SignatureVerifier.VerifyBytes CryptoSigSecretsVerifyBytesTotal = MetricName{Name: "algod_crypto_vrf_bytes_verify_total", Description: "Total number of calls to SignatureVerifier.VerifyBytes"} // LedgerTransactionsTotal Total number of transactions written to the ledger LedgerTransactionsTotal = MetricName{Name: "algod_ledger_transactions_total", Description: "Total number of transactions written to the ledger"} // LedgerRewardClaimsTotal Total number of reward claims written to the ledger LedgerRewardClaimsTotal = MetricName{Name: "algod_ledger_reward_claims_total", Description: "Total number of reward claims written to the ledger"} // LedgerRound Last round written to ledger LedgerRound = MetricName{Name: "algod_ledger_round", Description: "Last round written to ledger"} // AgreementMessagesHandled "Number of agreement messages handled" AgreementMessagesHandled = MetricName{Name: "algod_agreement_handled", Description: "Number of agreement messages handled"} // AgreementMessagesDropped "Number of agreement messages dropped" AgreementMessagesDropped = MetricName{Name: "algod_agreement_dropped", Description: "Number of agreement messages dropped"} // TransactionMessagesHandled "Number of transaction messages handled" TransactionMessagesHandled = MetricName{Name: "algod_transaction_messages_handled", Description: "Number of transaction messages handled"} // TransactionMessagesDroppedFromBacklog "Number of transaction messages dropped from backlog" TransactionMessagesDroppedFromBacklog = MetricName{Name: "algod_transaction_messages_dropped_backlog", Description: "Number of transaction messages dropped from backlog"} // TransactionMessagesDroppedFromPool "Number of transaction messages dropped from pool" TransactionMessagesDroppedFromPool = MetricName{Name: "algod_transaction_messages_dropped_pool", Description: "Number of transaction messages dropped from pool"} )
var ( // ErrMetricServiceAlreadyRunning Generated when we call Start and the metric service is already running ErrMetricServiceAlreadyRunning = errors.New("MetricService is already running") // ErrMetricServiceNotRunning is not currently running ErrMetricServiceNotRunning = errors.New("MetricService not running") // ErrMetricUnableToRegister unable to register ErrMetricUnableToRegister = errors.New("Unable to register metric") )
Functions ¶
This section is empty.
Types ¶
type Counter ¶
type Counter struct { deadlock.Mutex // contains filtered or unexported fields }
Counter represent a single counter variable.
func MakeCounter ¶
func MakeCounter(metric MetricName) *Counter
MakeCounter create a new counter with the provided name and description.
func (*Counter) AddUint64 ¶
AddUint64 increases counter by x If labels is nil this is much faster than Add() Calls through to Add() if labels is not nil.
func (*Counter) Deregister ¶
Deregister deregisters the counter with the default/specific registry
type Gauge ¶
type Gauge struct { deadlock.Mutex // contains filtered or unexported fields }
Gauge represent a single gauge variable.
func MakeGauge ¶
func MakeGauge(metric MetricName) *Gauge
MakeGauge create a new gauge with the provided name and description.
func (*Gauge) Deregister ¶
Deregister deregisters the gauge with the default/specific registry
type Metric ¶
type Metric interface { WriteMetric(buf *strings.Builder, parentLabels string) AddMetric(values map[string]string) }
Metric represent any collectable metric
type MetricName ¶
MetricName describes the name and description of a single metric
type MetricReporter ¶
type MetricReporter struct {
// contains filtered or unexported fields
}
MetricReporter represent a single running metric server instance
func MakeMetricReporter ¶
func MakeMetricReporter(serviceConfig ServiceConfig) *MetricReporter
MakeMetricReporter creates a new metrics server at the given endpoint.
func (*MetricReporter) ReporterLoop ¶
func (reporter *MetricReporter) ReporterLoop(ctx context.Context)
ReporterLoop is the main reporter loop. It waits until it receives a feedback from the node-exporter regarding the desired post-interval. then, it posts the collected metrics every such and such interval. Note that the context is used to "abort" this thread if needed.
type MetricService ¶
type MetricService struct {
// contains filtered or unexported fields
}
MetricService represent a single running metric server instance
func MakeMetricService ¶
func MakeMetricService(config *ServiceConfig) *MetricService
MakeMetricService creates a new metrics server at the given endpoint.
func (*MetricService) Shutdown ¶
func (server *MetricService) Shutdown() error
Shutdown the running server
type Registry ¶
type Registry struct {
// contains filtered or unexported fields
}
Registry represents a single set of metrics registry
func DefaultRegistry ¶
func DefaultRegistry() *Registry
DefaultRegistry retrieves the default registry
func (*Registry) AddMetrics ¶
AddMetrics will add all the metrics that were registered to this registry
func (*Registry) Deregister ¶
Deregister removes the given metric to the registry
type Segment ¶
type Segment struct {
// contains filtered or unexported fields
}
Segment represent a single segment variable.
func MakeSegment ¶
func MakeSegment(metric *MetricName) *Segment
MakeSegment create a new segment with the provided name and description.
func (*Segment) Deregister ¶
Deregister deregisters the counter with the default/specific registry
func (*Segment) EnterSegment ¶
func (segment *Segment) EnterSegment(labels map[string]string) (*SegmentInstance, error)
EnterSegment is called when a segment is entered.
type SegmentInstance ¶
type SegmentInstance struct {
// contains filtered or unexported fields
}
SegmentInstance is generated once a segments starts.
func (*SegmentInstance) LeaveSegment ¶
func (segInstance *SegmentInstance) LeaveSegment() error
LeaveSegment is expected to be called via a "defer" statement.
type ServiceConfig ¶
type ServiceConfig struct { NodeExporterListenAddress string Labels map[string]string NodeExporterPath string }
ServiceConfig would contain all the information we need in order to create a listening server endpoint. We migth want to support rolling port numbers so that we could easily support multiple endpoints per machine. ( note that multiple endpoints per machine doesn't solve the question "how would the prometheus server figure that out")
type StringGauge ¶
type StringGauge struct { deadlock.Mutex // contains filtered or unexported fields }
StringGauge represents a map of key value pairs available to be written with the AddMetric
func MakeStringGauge ¶
func MakeStringGauge() *StringGauge
MakeStringGauge create a new StringGauge.
func (*StringGauge) AddMetric ¶
func (stringGauge *StringGauge) AddMetric(values map[string]string)
AddMetric sets all the key value pairs in the provided map.
func (*StringGauge) Deregister ¶
func (stringGauge *StringGauge) Deregister(reg *Registry)
Deregister deregisters the StringGauge with the default/specific registry
func (*StringGauge) Register ¶
func (stringGauge *StringGauge) Register(reg *Registry)
Register registers the StringGauge with the default/specific registry
func (*StringGauge) Set ¶
func (stringGauge *StringGauge) Set(key string, value string)
Set updates a key with a value.
func (*StringGauge) WriteMetric ¶
func (stringGauge *StringGauge) WriteMetric(buf *strings.Builder, parentLabels string)
WriteMetric omit string gauges from the metrics report, not sure how they act with prometheus