metrics

package
v1.6.1 Latest Latest
Warning

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

Go to latest
Published: Nov 5, 2024 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// Common.
	AppVersion       = "app_version"
	AppInfo          = "app_info"
	BlockHeight      = "block_height"
	Count            = "count"
	Detail           = "detail"
	Deterministic    = "deterministic"
	Distribution     = "distribution"
	Error            = "error"
	GitCommit        = "git_commit"
	HttpGet5xx       = "http_get_5xx"
	HttpGetHangup    = "http_get_hangup"
	HttpGetRequest   = "http_get_request"
	HttpGetResponse  = "http_get_response"
	HttpGetTimeout   = "http_get_timeout"
	Invalid          = "invalid"
	Latency          = "latency"
	Matched          = "matched"
	MessageType      = "message_type"
	Msg              = "msg"
	Negative         = "negative"
	NonDeterministic = "non_deterministic"
	Positive         = "positive"
	Reason           = "reason"
	Received         = "received"
	Rejected         = "rejected"
	SampleRate       = "sample_rate"
	SequenceNumber   = "sequence_number"
	Success          = "success"
	Valid            = "valid"
	ValidateBasic    = "validate_basic"
	CheckTx          = "check_tx"
	ReCheckTx        = "recheck_tx"
	DeliverTx        = "deliver_tx"
	ProcessProposal  = "process_proposal"

	// Common (Daemons).
	MainTaskLoop = "main_task_loop"

	// ABCI: Prepare / Process
	ConsensusRound     = "consensus_round"
	DisallowMsg        = "disallow_msg"
	Decode             = "decode"
	FundingTx          = "funding_tx"
	GetTxsInOrder      = "get_txs_in_order"
	Handler            = "handler"
	NumOtherTxs        = "num_other_txs"
	OperationsTx       = "operations_tx"
	OriginalNumTxs     = "original_num_txs"
	OtherTxs           = "other_txs"
	RemoveDisallowMsgs = "remove_disallow_msgs"
	PrepareProposalTxs = "prepare_proposal_txs"
	PrepareCheckState  = "prepare_check_state"
	PricesTx           = "prices_tx"
	TotalNumBytes      = "total_num_bytes"
	TotalNumTxs        = "total_num_txs"
	Validate           = "validate"

	RateLimit = "rate_limit"

	// Daemon
	DaemonServer    = "daemon_server"
	ValidResponse   = "valid_response"
	MissingResponse = "missing_response"

	// Epochs.
	EpochInfoName = "epoch_name"
	EpochNumber   = "epoch_number"
	IsEpochOne    = "is_epoch_one"

	// Block Time.
	BlockTimeMs = "block_time_ms"

	// Prices.
	CreateOracleMarket                           = "create_oracle_market"
	CurrentMarketPrices                          = "current_market_prices"
	GetValidMarketPriceUpdates                   = "get_valid_market_price_updates"
	IndexPriceDoesNotExist                       = "index_price_does_not_exist"
	IndexPriceIsZero                             = "index_price_is_zero"
	IndexPriceNotAccurate                        = "index_price_not_accurate"
	IndexPriceNotAvailForAccuracyCheck           = "index_price_not_available_for_accuracy_check"
	LastPriceUpdateForMarketBlock                = "last_price_update_for_market_block"
	MissingPriceUpdates                          = "missing_price_updates"
	NumMarketPricesToUpdate                      = "num_market_prices_to_update"
	PriceChangeRate                              = "price_change_rate"
	ProposedPriceChangesPriceUpdateDecision      = "proposed_price_changes_price_update_decision"
	ProposedPriceCrossesOraclePrice              = "proposed_price_crosses_oracle_price"
	ProposedPriceDoesNotMeetMinPriceChange       = "proposed_price_does_not_meet_min_price_change"
	RecentSmoothedPriceDoesNotMeetMinPriceChange = "recent_smoothed_price_doesnt_meet_min_price_change"
	RecentSmoothedPriceCrossesOraclePrice        = "recent_smoothed_price_crosses_old_price"
	StatefulPriceUpdateValidation                = "stateful_price_update_validation"
	UpdateMarketParam                            = "update_market_param"
	UpdateMarketPrices                           = "update_market_prices"
	UpdateSmoothedPrices                         = "update_smoothed_prices"

	// Pricefeed Daemon.
	Exchange                                = "exchange"
	ExchangeQueryHandlerApiRequest          = "exchange_query_handler_api_request"
	ExchangeSpecificError                   = "exchange_specific_error"
	GetAllPrices_MarketIdToPrice            = "get_all_prices_market_id_to_price"
	PriceEncoderUpdatePrice                 = "price_encoder_update_price"
	PricefeedDaemon                         = "pricefeed_daemon"
	ConfiguredMarketCount                   = "configured_market_count"
	ConfiguredMarketCountPerExchange        = "configured_market_count_per_exchange"
	ConfiguredExchangeCountPerMarket        = "configured_exchange_count_per_market"
	MarketUpdaterGetAllMarketParams         = "market_updater_get_all_market_params"
	MarketUpdaterApplyMarketUpdates         = "market_updater_apply_market_updates"
	MarketUpdaterUpdateMarkets              = "market_updater_update_markets"
	PriceEncoderPriceConversion             = "price_encoder_price_conversion"
	PriceFetcherQueryExchange               = "price_fetcher_query_exchange"
	PriceFetcherQueryForMarket              = "price_fetcher_query_for_market_sampled"
	PriceFetcherSubtaskLoop                 = "price_fetcher_subtask_loop"
	PriceFetcherSubtaskLoopAndSetCtxTimeout = "price_fetcher_subtask_loop_and_set_ctx_timeout"
	PriceUpdateCount                        = "price_update_count"
	PriceUpdaterSendPrices                  = "price_updater_send_prices"
	PriceUpdaterTaskLoop                    = "price_updater_task_loop"
	PriceUpdaterTransformPrices             = "price_updater_transform_prices"
	PriceUpdaterZeroPrices                  = "price_updater_zero_prices"

	// Pricefeed Server.
	GetValidPrices                = "get_valid_prices"
	ValidPrices                   = "valid_prices"
	NoMarketPrice                 = "no_market_price"
	NoValidMedianPrice            = "no_valid_median_price"
	PricefeedServer               = "pricefeed_server"
	PricefeedServerUpdatePrices   = "pricefeed_server_update_prices"
	PricefeedServerValidatePrices = "pricefeed_server_validate_prices"
	PriceIsInvalid                = "price_is_invalid"

	// Shared Pricefeed Server and Daemon.
	UpdatePrice = "update_price"

	// msgsender
	MessageSendSuccess    = "message_send_success"
	MessageSendError      = "message_send_error"
	SendOffchainData      = "send_offchain_data"
	SendOnchainData       = "send_onchain_data"
	OnchainMessageLength  = "onchain_message_length"
	OffchainMessageLength = "offchain_message_length"

	// Indexer events.
	TotalNumIndexerBlockEvents = "total_num_block_events"
	TotalNumIndexerTxnEvents   = "total_num_txn_events"
)

Keep the metric fields alphabetized within each category.

View Source
const (
	LatencyMetricSampleRate    = 0.01
	AvailableMarketsSampleRate = .1
)
View Source
const (
	// Price labels.
	ExchangeId = "exchange_id"
	MarketId   = "market_id"
	StatusCode = "status_code"

	Callback = "callback"

	Daemon = "daemon"
)
View Source
const (
	// Measure Since
	DaemonGetPreviousBlockInfoLatency     = "daemon_get_previous_block_info_latency"
	DaemonGetAllMarketPricesLatency       = "daemon_get_all_market_prices_latency"
	DaemonGetMarketPricesPaginatedLatency = "daemon_get_market_prices_paginated_latency"
	DaemonGetAllPerpetualsLatency         = "daemon_get_all_perpetuals_latency"
	DaemonGetPerpetualsPaginatedLatency   = "daemon_get_perpetuals_paginated_latency"
	MevLatency                            = "mev_latency"
)

Clob Metrics Keys

Variables

This section is empty.

Functions

func AddSample

func AddSample(key string, val float32)

AddSample provides a wrapper functionality for emitting a sample metric.

func AddSampleWithLabels

func AddSampleWithLabels(key string, val float32, labels ...gometrics.Label)

AddSampleWithLabels provides a wrapper functionality for emitting a sample metric with the provided labels.

func GetCallbackMetricFromCtx

func GetCallbackMetricFromCtx(ctx sdk.Context) string

GetCallbackMetricFromCtx determines the callback metric based on the context. Note that DeliverTx is implied if the context is not CheckTx or ReCheckTx. This function is unable to account for other callbacks like PrepareCheckState or EndBlocker.

func GetLabelForBoolValue

func GetLabelForBoolValue(labelName string, labelValue bool) gometrics.Label

GetLabelForBoolValue returns a telemetry label for a given label and bool value.

func GetLabelForIntValue

func GetLabelForIntValue(labelName string, labelValue int) gometrics.Label

GetLabelForIntValue returns a telemetry label for a given label and int value.

func GetLabelForStringValue

func GetLabelForStringValue(labelName, labelValue string) gometrics.Label

GetLabelForStringValue returns a telemetry label for a given label and string value.

func GetMetricValueFromBigInt

func GetMetricValueFromBigInt(i *big.Int) float32

GetMetricValueFromBigInt returns a telemetry value (float32) from an integer value. Any rounding information is ignored, so this function should only be used for metrics.

func IncrCountMetricWithLabels

func IncrCountMetricWithLabels(module, metric string, labels ...gometrics.Label)

IncrCountMetricWithLabels increases a count metric from a module with the provided labels by a count of 1.

func IncrCounter

func IncrCounter(key string, val float32)

IncrCounter provides a wrapper functionality for emitting a counter metric with global labels (if any).

func IncrCounterWithLabels

func IncrCounterWithLabels(key string, val float32, labels ...Label)

IncrCounterWithLabels provides a wrapper functionality for emitting a counter metric with global labels (if any) along with the provided labels.

func IncrSuccessOrErrorCounter

func IncrSuccessOrErrorCounter(err error, module, handler, callback string, labels ...gometrics.Label)

IncrSuccessOrErrorCounter increments either the success or error counter for a given handler based on whether the given error is nil or not. This function is intended to be called in a defer block at the top of any function which returns an error.

func ModuleMeasureSince

func ModuleMeasureSince(module, key string, start time.Time)

ModuleMeasureSince provides a wrapper functionality for emitting a time measure metric with global labels (if any). Please try to use `AddSample` instead. TODO(CLOB-1022) Roll our own calculations for timing on top of AddSample instead of using MeasureSince.

func ModuleMeasureSinceWithLabels

func ModuleMeasureSinceWithLabels(
	module string,
	keys []string,
	start time.Time,
	labels []gometrics.Label,
)

ModuleMeasureSinceWithLabels provides a short hand method for emitting a time measure metric for a module with labels. Global labels are not included in this metric. Please try to use `AddSampleWithLabels` instead. TODO(CLOB-1022) Roll our own calculations for timing on top of AddSample instead of using MeasureSince.

func SetGauge

func SetGauge(key string, val float32)

SetGauge provides a wrapper functionality for emitting a gauge metric with global labels (if any).

func SetGaugeWithLabels

func SetGaugeWithLabels(key string, val float32, labels ...gometrics.Label)

SetGaugeWithLabels provides a wrapper functionality for emitting a gauge metric with global labels (if any) along with the provided labels.

Types

type Label

type Label = gometrics.Label

Jump to

Keyboard shortcuts

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