Documentation
¶
Overview ¶
Package telemetry provides a set of functions for incrementing counters which track various events across the codebase. Typically, calls to these counter functions SHOULD be made inside deferred anonymous functions so that they will reference the final values of their inputs. Any instrumented piece of code which contains branching logic with respect its counter function inputs is subject to this constraint (i.e. MUST defer).
Index ¶
- Constants
- Variables
- func BurnedTokensFromModule(module string, amount float32)
- func ClaimComputeUnitsCounter(claimProofStage string, numComputeUnits uint64, serviceId string, ...)
- func ClaimCounter(claimProofStage string, numClaims uint64, serviceId string, ...)
- func ClaimRelaysCounter(claimProofStage string, numRelays uint64, serviceId string, ...)
- func EventSuccessCounter(eventType string, getValue func() float32, isSuccessful func() bool)
- func InitBlockMetrics(app *baseapp.BaseApp)
- func MetricNameKeys(metrics ...string) []string
- func MintedTokensFromModule(module string, amount float32)
- func New(appOpts servertypes.AppOptions) error
- func ProofRequirementCounter(reason string, serviceId string, applicationAddress string, ...)
- func RelayEMAGauge(relayEMA uint64, serviceId string)
- func RelayMiningDifficultyGauge(difficulty float32, serviceId string)
- func SessionSuppliersGauge(numCandidates int, maxPerSession int, serviceId string)
- func SlashedTokensFromModule(module string, amount float32)
- type PoktrollTelemetryConfig
Constants ¶
const (
// DefaultCardinalityLevel represents the default cardinality level for metrics collection
DefaultCardinalityLevel = "medium"
)
Default configuration values for telemetry
Variables ¶
var (
DefaultCounterFn = func() float32 { return 1 }
)
Functions ¶
func BurnedTokensFromModule ¶ added in v0.0.11
BurnedTokensFromModule is a function to track token burning from a specific module. The metric used is an increment counter, and the label includes the module name for context.
func ClaimComputeUnitsCounter ¶ added in v0.0.3
func ClaimComputeUnitsCounter( claimProofStage string, numComputeUnits uint64, serviceId string, applicationAddress string, supplierOperatorAddress string, err error, )
ClaimComputeUnitsCounter increments a counter which tracks the number of compute units which are represented by onchain claims at the given ClaimProofStage. If err is not nil, the counter is not incremented but Prometheus will ingest this event.
func ClaimCounter ¶ added in v0.0.3
func ClaimCounter( claimProofStage string, numClaims uint64, serviceId string, applicationAddress string, supplierOperatorAddress string, err error, )
ClaimCounter increments a counter which tracks the number of claims at the given ClaimProofStage. If err is not nil, the counter is not incremented but Prometheus will ingest this event.
func ClaimRelaysCounter ¶ added in v0.0.4
func ClaimRelaysCounter( claimProofStage string, numRelays uint64, serviceId string, applicationAddress string, supplierOperatorAddress string, err error, )
ClaimRelaysCounter increments a counter which tracks the number of relays represented by onchain claims at the given ClaimProofStage. If err is not nil, the counter is not incremented and an "error" label is added with the error's message. I.e., Prometheus will ingest this event.
func EventSuccessCounter ¶
EventSuccessCounter increments a counter with the given data type and success status.
func InitBlockMetrics ¶
InitBlockMetrics initializes the block-specific metrics for the application.
func MetricNameKeys ¶ added in v0.0.11
MetricNameKeys prefixes metrics with `poktroll` for easy identification. E.g., `("hodlers", "regret_level")` yields `poktroll_hodlers_regret_level` — great for tracking FOMO as hodlers rethink choices. Returns a slice of strings as `go-metric`, the underlying metrics library, expects.
func MintedTokensFromModule ¶ added in v0.0.11
MintedTokensFromModule is a function to track token minting from a specific module. The metric used is an increment counter, and the label includes the module name for context.
func New ¶ added in v0.0.11
func New(appOpts servertypes.AppOptions) error
New sets the globalTelemetryConfig for telemetry package.
func ProofRequirementCounter ¶ added in v0.0.3
func ProofRequirementCounter( reason string, serviceId string, applicationAddress string, supplierOperatorAddress string, err error, )
ProofRequirementCounter increments a counter which tracks the number of claims which require proof for the given proof requirement reason (i.e. not required, probabilistic selection, above compute unit threshold). If err is not nil, the counter is not incremented but Prometheus will ingest this event.
func RelayEMAGauge ¶ added in v0.0.3
RelayEMAGauge sets a gauge which tracks the relay EMA for a service. The serviceId is used as a label to be able to track the EMA for each service.
func RelayMiningDifficultyGauge ¶ added in v0.0.3
RelayMiningDifficultyGauge sets a gauge which tracks the integer representation of the relay mining difficulty. The serviceId is used as a label to be able to track the difficulty for each service.
func SessionSuppliersGauge ¶ added in v0.0.11
SessionSuppliersGauge sets a gauge which tracks the number of candidates available for session suppliers at the given maxPerSession value. The serviceId is used as a label to be able to track this information for each service.
func SlashedTokensFromModule ¶ added in v0.0.11
SlashedTokensFromModule is a function to track token slashing from a specific module. The metric used is an increment counter, and the label includes the module name for context.
Types ¶
type PoktrollTelemetryConfig ¶ added in v0.0.11
type PoktrollTelemetryConfig struct {
CardinalityLevel string `mapstructure:"cardinality-level"`
}
PoktrollTelemetryConfig represents the telemetry portion of the custom poktroll config section in `app.toml`.
func DefaultConfig ¶ added in v0.0.12
func DefaultConfig() PoktrollTelemetryConfig
DefaultConfig returns the default telemetry configuration