telemetry

package
v1.10.2 Latest Latest
Warning

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

Go to latest
Published: Feb 26, 2024 License: MIT, Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Collect

func Collect(ctx context.Context, metric interface{}) error

Collect collects the metric by persisting locally for later publication. If Collect is called before setting the metric store, it will simply log the metric without persisting it.

func SetMetricStore

func SetMetricStore(s MetricStore)

SetMetricStore sets the store implementation. Only the first call will have an effect. If Collect is called without setting a MetricStore, it will be a noop.

Types

type ChainStacksMetric

type ChainStacksMetric struct {
	Version ChainStacksMetricVersion `json:"version"`

	LastProcessedBlockNumbers map[tableland.ChainID]int64 `json:"last_processed_block_number"`
}

ChainStacksMetric contains information about each chain being synced.

type ChainStacksMetricVersion

type ChainStacksMetricVersion int64

ChainStacksMetricVersion is a type for versioning ChainStacks metrics.

const ChainStacksMetricV1 ChainStacksMetricVersion = iota

ChainStacksMetricV1 is the V1 version of ChainStacks metric.

type GitSummaryMetric

type GitSummaryMetric struct {
	Version GitSummaryMetricVersion `json:"version"`

	GitCommit     string `json:"git_commit"`
	GitBranch     string `json:"git_branch"`
	GitState      string `json:"git_state"`
	GitSummary    string `json:"git_summary"`
	BuildDate     string `json:"build_date"`
	BinaryVersion string `json:"binary_version"`
}

GitSummaryMetric contains Git information of the binary.

type GitSummaryMetricVersion

type GitSummaryMetricVersion int64

GitSummaryMetricVersion is a type for versioning GitSummary metrics.

const GitSummaryMetricV1 GitSummaryMetricVersion = iota

GitSummaryMetricV1 is the V1 version of GitSummary metric.

type Metric

type Metric struct {
	RowID     int64       `json:"-"`
	Version   int         `json:"version"`
	Timestamp time.Time   `json:"timestamp"`
	Type      MetricType  `json:"type"`
	Payload   interface{} `json:"payload"`
}

Metric defines a metric.

func (Metric) Serialize

func (m Metric) Serialize() ([]byte, error)

Serialize serializes the metric.

type MetricStore

type MetricStore interface {
	StoreMetric(context.Context, Metric) error
	Close() error
}

MetricStore specifies the methods for persisting a metric.

type MetricType

type MetricType int

MetricType defines the metric type.

const (
	// StateHashType is the type for the StateHashMetric.
	StateHashType MetricType = iota
	// GitSummaryType is the type for the GitSummaryMetric.
	GitSummaryType
	// ChainStacksSummaryType is the type for the ChainStacksMetric.
	ChainStacksSummaryType
	// ReadQueryType is the type for the ReadQueryMetric.
	ReadQueryType
	// NewBlockType is the type for the NewBlockMetric.
	NewBlockType
	// NewTablelandEventType is the type for the NewTablelandEventMetri.
	NewTablelandEventType
)

type NewBlockMetric

type NewBlockMetric struct {
	Version NewBlockMetricVersion `json:"version"`

	ChainID            int    `json:"chain_id"`
	BlockNumber        int64  `json:"block_number"`
	BlockTimestampUnix uint64 `json:"block_timestamp_unix"`
}

NewBlockMetric contains information about a newly detected block.

type NewBlockMetricVersion

type NewBlockMetricVersion int64

NewBlockMetricVersion is a type for versioning NewBlock metrics.

const NewBlockMetricV1 NewBlockMetricVersion = iota

NewBlockMetricV1 is the V1 version of NewBlock metric.

type NewTablelandEventMetric

type NewTablelandEventMetric struct {
	Version NewTablelandEventMetricVersion `json:"version"`

	Address     string `json:"address"`
	Topics      []byte `json:"topics"`
	Data        []byte `json:"data"`
	BlockNumber uint64 `json:"block_number"`
	TxHash      string `json:"tx_hash"`
	TxIndex     uint   `json:"tx_index"`
	BlockHash   string `json:"block_hash"`
	Index       uint   `json:"index"`
	ChainID     int64  `json:"chain_id"`
	EventJSON   string `json:"event_json"`
	EventType   string `json:"event_type"`
}

NewTablelandEventMetric contains information about a newly detected Tableland event.

type NewTablelandEventMetricVersion

type NewTablelandEventMetricVersion int64

NewTablelandEventMetricVersion is a type for versioning NewTablelandEvent metrics.

const NewTablelandEventMetricV1 NewTablelandEventMetricVersion = iota

NewTablelandEventMetricV1 is the V1 version of NewTablelandEvent metric.

type ReadQueryFormatOptions

type ReadQueryFormatOptions struct {
	Extract bool   `json:"extract"`
	Unwrap  bool   `json:"unwrap"`
	Output  string `json:"output"`
}

ReadQueryFormatOptions contains formatting configuration of a ReadQuery metric.

type ReadQueryMetric

type ReadQueryMetric struct {
	Version ReadQueryMetricVersion `json:"version"`

	IPAddress     string                 `json:"ip_address"`
	SQLStatement  string                 `json:"sql_statement"`
	FormatOptions ReadQueryFormatOptions `json:"format_options"`
	TookMilli     int64                  `json:"took_milli"`
}

ReadQueryMetric contains information about a read query.

type ReadQueryMetricVersion

type ReadQueryMetricVersion int64

ReadQueryMetricVersion is a type for versioning ReadQuery metrics.

const ReadQueryMetricV1 ReadQueryMetricVersion = iota

ReadQueryMetricV1 is the V1 version of ReadQuery metric.

type StateHashMetric

type StateHashMetric struct {
	Version StateHashMetricVersion `json:"version"`

	ChainID     int64  `json:"chain_id"`
	BlockNumber int64  `json:"block_number"`
	Hash        string `json:"hash"`
}

StateHashMetric defines a state hash metric.

type StateHashMetricVersion

type StateHashMetricVersion int64

StateHashMetricVersion is a type for versioning StateHash metrics.

const StateHashMetricV1 StateHashMetricVersion = iota

StateHashMetricV1 is the V1 version of StateHash metric.

Directories

Path Synopsis
migrations
Package migrations generated by go-bindata.// sources: migrations/001_system_metrics.up.sql migrations/002_system_metrics.down.sql
Package migrations generated by go-bindata.// sources: migrations/001_system_metrics.up.sql migrations/002_system_metrics.down.sql

Jump to

Keyboard shortcuts

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