metrics

package
v0.21.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 14, 2023 License: Apache-2.0 Imports: 21 Imported by: 0

Documentation

Index

Constants

View Source
const (
	AvailabilityLabel = "availability"
	SyncLabel         = "sync/freshness"
	LatencyLabel      = "latency"
)
View Source
const (
	MetricsListenFlagName = "metrics-listen-address"
	DisabledFlagOption    = "disabled"
)
View Source
const (
	RefererHeaderKey = "Referer"
)

Variables

View Source
var ReturnMaskedErrors = "false"

Functions

This section is empty.

Types

type AggregatedMetric

type AggregatedMetric struct {
	TotalLatency uint64
	RelaysCount  int64
	SuccessCount int64
	TotalCu      uint64
	TimeStamp    time.Time
}

type ConsumerMetricsManager

type ConsumerMetricsManager struct {
	// contains filtered or unexported fields
}

func NewConsumerMetricsManager

func NewConsumerMetricsManager(networkAddress string) *ConsumerMetricsManager

func (*ConsumerMetricsManager) SetBlock

func (pme *ConsumerMetricsManager) SetBlock(block int64)

func (*ConsumerMetricsManager) SetRelayMetrics

func (pme *ConsumerMetricsManager) SetRelayMetrics(relayMetric *RelayMetrics)

type MetricService

type MetricService struct {
	AggregatedMetricMap *map[string]map[string]map[string]map[RelaySource]*AggregatedMetric
	MetricsChannel      chan RelayMetrics
	ReportUrl           string
}

func NewMetricService

func NewMetricService() *MetricService

func (*MetricService) SendData

func (m *MetricService) SendData(data RelayMetrics)

func (*MetricService) SendEachProjectMetricData

func (m *MetricService) SendEachProjectMetricData()

type ProviderMetrics

type ProviderMetrics struct {
	// contains filtered or unexported fields
}

func NewProviderMetrics

func NewProviderMetrics(specID, apiInterface string, totalCUServicedMetric *prometheus.CounterVec,
	totalCUPaidMetric *prometheus.CounterVec,
	totalRelaysServicedMetric *prometheus.CounterVec,
	totalErroredMetric *prometheus.CounterVec,
	consumerQoSMetric *prometheus.GaugeVec,
) *ProviderMetrics

func (*ProviderMetrics) AddError

func (pm *ProviderMetrics) AddError()

func (*ProviderMetrics) AddPayment

func (pm *ProviderMetrics) AddPayment(cu uint64)

func (*ProviderMetrics) AddRelay

func (pm *ProviderMetrics) AddRelay(consumerAddress string, cu uint64, qos *pairingtypes.QualityOfServiceReport)

type ProviderMetricsManager

type ProviderMetricsManager struct {
	// contains filtered or unexported fields
}

func NewProviderMetricsManager

func NewProviderMetricsManager(networkAddress string) *ProviderMetricsManager

func (*ProviderMetricsManager) AddPayment

func (pme *ProviderMetricsManager) AddPayment(specID string, cu uint64)

func (*ProviderMetricsManager) AddProviderMetrics

func (pme *ProviderMetricsManager) AddProviderMetrics(specID, apiInterface string) *ProviderMetrics

func (*ProviderMetricsManager) SetBlock

func (pme *ProviderMetricsManager) SetBlock(latestLavaBlock int64)

func (*ProviderMetricsManager) SetLatestBlock

func (pme *ProviderMetricsManager) SetLatestBlock(specID string, block uint64)

type RPCConsumerLogs

type RPCConsumerLogs struct {
	MetricService   *MetricService
	StoreMetricData bool
	// contains filtered or unexported fields
}

func NewRPCConsumerLogs

func NewRPCConsumerLogs(consumerMetricsManager *ConsumerMetricsManager) (*RPCConsumerLogs, error)

func (*RPCConsumerLogs) AddMetricForGrpc

func (pl *RPCConsumerLogs) AddMetricForGrpc(data *RelayMetrics, err error, metadataValues *metadata.MD)

func (*RPCConsumerLogs) AddMetricForHttp

func (pl *RPCConsumerLogs) AddMetricForHttp(data *RelayMetrics, err error, headers map[string]string)

func (*RPCConsumerLogs) AddMetricForWebSocket

func (pl *RPCConsumerLogs) AddMetricForWebSocket(data *RelayMetrics, err error, c *websocket.Conn)

func (*RPCConsumerLogs) AnalyzeWebSocketErrorAndWriteMessage

func (pl *RPCConsumerLogs) AnalyzeWebSocketErrorAndWriteMessage(c *websocket.Conn, mt int, err error, msgSeed string, msg []byte, rpcType string)

Websocket healthy disconnections throw "websocket: close 1005 (no status)" error, We dont want to alert error monitoring for that purpses.

func (*RPCConsumerLogs) GetMessageSeed

func (pl *RPCConsumerLogs) GetMessageSeed() string

func (*RPCConsumerLogs) GetUniqueGuidResponseForError

func (pl *RPCConsumerLogs) GetUniqueGuidResponseForError(responseError error, msgSeed string) string

Input will be masked with a random GUID if returnMaskedErrors is set to true

func (*RPCConsumerLogs) LogRequestAndResponse

func (pl *RPCConsumerLogs) LogRequestAndResponse(module string, hasError bool, method, path, req, resp, msgSeed string, err error)

func (*RPCConsumerLogs) LogStartTransaction

func (pl *RPCConsumerLogs) LogStartTransaction(name string) func()

func (*RPCConsumerLogs) LogTestMode

func (rpccl *RPCConsumerLogs) LogTestMode(fiberCtx *fiber.Ctx)

type RelayAnalyticsDTO

type RelayAnalyticsDTO struct {
	ProjectHash  string
	Timestamp    string
	ChainID      string
	APIType      string
	Latency      uint64
	SuccessCount int64
	RelayCounts  int64
	TotalCu      uint64
	Source       RelaySource
}

type RelayMetrics

type RelayMetrics struct {
	ProjectHash  string
	Timestamp    time.Time
	ChainID      string
	APIType      string
	Latency      int64
	Success      bool
	ComputeUnits uint64
	Source       RelaySource
}

func NewRelayAnalytics

func NewRelayAnalytics(projectHash, chainId, apiType string) *RelayMetrics

type RelaySource

type RelaySource int
const (
	SdkSource RelaySource = iota + 1
	GatewaySource
	BadgesSource
)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL