reporters

package
v0.38.0-preview.0.0.7 Latest Latest
Warning

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

Go to latest
Published: Nov 27, 2024 License: AGPL-3.0 Imports: 29 Imported by: 2

Documentation

Index

Constants

View Source
const (
	CBORTagInlineCollisionGroup   = 253
	CBORTagExternalCollisionGroup = 254
)
View Source
const FungibleTokenTrackerReportPrefix = "fungible_token_report"

Variables

This section is empty.

Functions

func FlowTokenTypeID added in v0.25.1

func FlowTokenTypeID(chain flow.Chain) string

func NewBalanceReporter added in v0.25.1

func NewBalanceReporter(
	chain flow.Chain,
	snapshot snapshot.StorageSnapshot,
) *balanceProcessor

func NewStorageSnapshotFromPayload added in v0.30.0

func NewStorageSnapshotFromPayload(
	payloads []ledger.Payload,
) snapshot.MapStorageSnapshot

NewStorageSnapshotFromPayload returns an instance of StorageSnapshot with entries loaded from payloads (should only be used for migration)

Types

type AccountReporter

type AccountReporter struct {
	Log   zerolog.Logger
	RWF   ReportWriterFactory
	Chain flow.Chain
}

AccountReporter iterates through registers keeping a map of register sizes reports on storage metrics

func (*AccountReporter) Name

func (r *AccountReporter) Name() string

func (*AccountReporter) Report

func (r *AccountReporter) Report(payload []ledger.Payload, commit ledger.State) error

type AtreeReporter added in v0.26.2

type AtreeReporter struct {
	Log zerolog.Logger
	RWF ReportWriterFactory
}

AtreeReporter iterates payloads and generates payload and atree stats.

func (*AtreeReporter) Name added in v0.26.2

func (r *AtreeReporter) Name() string

func (*AtreeReporter) Report added in v0.26.2

func (r *AtreeReporter) Report(payloads []ledger.Payload, commit ledger.State) error

type ExportReport added in v0.26.0

type ExportReport struct {
	EpochCounter            uint64
	PreviousStateCommitment flow.StateCommitment
	CurrentStateCommitment  flow.StateCommitment
	ReportSucceeded         bool
}

type ExportReporter added in v0.26.0

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

ExportReporter writes data that can be leveraged outside of extraction

func NewExportReporter added in v0.26.0

func NewExportReporter(
	logger zerolog.Logger,
	getBeforeMigrationSCFunc GetStateCommitmentFunc,
) *ExportReporter

func (*ExportReporter) Name added in v0.26.0

func (e *ExportReporter) Name() string

func (*ExportReporter) Report added in v0.26.0

func (e *ExportReporter) Report(payload []ledger.Payload, commit ledger.State) error

type FungibleTokenTracker added in v0.25.1

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

FungibleTokenTracker iterates through stored cadence values over all accounts and check for any value with the given resource typeID

func NewFungibleTokenTracker added in v0.25.1

func NewFungibleTokenTracker(logger zerolog.Logger, rwf ReportWriterFactory, chain flow.Chain, vaultTypeIDs []string) *FungibleTokenTracker

func (*FungibleTokenTracker) Name added in v0.25.1

func (r *FungibleTokenTracker) Name() string

func (*FungibleTokenTracker) Report added in v0.25.1

func (r *FungibleTokenTracker) Report(payloads []ledger.Payload, commit ledger.State) error

Report creates a fungible_token_report_*.json file that contains data on all fungible token Vaults in the state commitment. I recommend using gojq to browse through the data, because of the large uint64 numbers which jq won't be able to handle.

type GetStateCommitmentFunc added in v0.26.0

type GetStateCommitmentFunc func() flow.StateCommitment

type ReportFileWriter

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

func (*ReportFileWriter) Close

func (r *ReportFileWriter) Close()

func (*ReportFileWriter) Write

func (r *ReportFileWriter) Write(dataPoint interface{})

type ReportFileWriterFactory

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

func NewReportFileWriterFactory

func NewReportFileWriterFactory(outputDir string, log zerolog.Logger) *ReportFileWriterFactory

func NewReportFileWriterFactoryWithFormat added in v0.35.17

func NewReportFileWriterFactoryWithFormat(outputDir string, log zerolog.Logger, format ReportFormat) *ReportFileWriterFactory

func (*ReportFileWriterFactory) Filename added in v0.25.1

func (r *ReportFileWriterFactory) Filename(dataNamespace string) string

func (*ReportFileWriterFactory) ReportWriter

func (r *ReportFileWriterFactory) ReportWriter(dataNamespace string) ReportWriter

type ReportFormat added in v0.35.17

type ReportFormat uint8
const (
	// ReportFormatJSONArray represents format encoded as JSON array at the top level.
	ReportFormatJSONArray ReportFormat = iota

	// ReportFormatJSONL represents format encoded as JSONL.
	// ReportFormatJSONL should be used when report might be large enough to
	// crash tools like jq (if JSON array is used instead of JSONL).
	ReportFormatJSONL
)

type ReportNilWriter

type ReportNilWriter struct {
}

ReportNilWriter does nothing. Can be used as the final fallback writer

func (ReportNilWriter) Close

func (r ReportNilWriter) Close()

func (ReportNilWriter) Write

func (r ReportNilWriter) Write(_ interface{})

type ReportWriter

type ReportWriter interface {
	Write(dataPoint interface{})
	Close()
}

ReportWriter writes data from reports

func NewReportFileWriter

func NewReportFileWriter(fileName string, log zerolog.Logger, format ReportFormat) ReportWriter

type ReportWriterFactory

type ReportWriterFactory interface {
	ReportWriter(dataNamespace string) ReportWriter
}

TODO janezp: we should be able to switch the report writer to write to a database.

type TokenDataPoint added in v0.25.1

type TokenDataPoint struct {
	// Path is the storage path of the composite the vault was found in
	Path string `json:"path"`
	// Address is the owner of the composite the vault was found in
	Address string `json:"address"`
	// Balance is the balance of the flow vault
	Balance uint64 `json:"balance"`
	// token type
	TypeID string `json:"type_id"`
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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