trace

package
v0.33.17-new-ingestion... Latest Latest
Warning

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

Go to latest
Published: Apr 30, 2024 License: AGPL-3.0 Imports: 13 Imported by: 17

Documentation

Index

Constants

View Source
const DefaultEntityCacheSize = 1000
View Source
const EntityTypeBlock = "Block"
View Source
const EntityTypeCollection = "Collection"
View Source
const EntityTypeTransaction = "Transaction"
View Source
const SensitivityCaptureAll = 0

Variables

Functions

func IsSampled added in v0.27.0

func IsSampled(span trace.Span) bool

Types

type NoopTracer

type NoopTracer struct{}

NoopTracer is the implementation of the Tracer interface. TODO(rbtz): make private

func NewNoopTracer

func NewNoopTracer() *NoopTracer

NewTracer creates a new tracer.

func (*NoopTracer) BlockRootSpan added in v0.30.0

func (t *NoopTracer) BlockRootSpan(entityID flow.Identifier) trace.Span

func (*NoopTracer) Done

func (t *NoopTracer) Done() <-chan struct{}

Done returns a channel that will close when shutdown is complete.

func (*NoopTracer) Ready

func (t *NoopTracer) Ready() <-chan struct{}

Ready returns a channel that will close when the network stack is ready.

func (*NoopTracer) ShouldSample added in v0.30.0

func (t *NoopTracer) ShouldSample(entityID flow.Identifier) bool

func (*NoopTracer) StartBlockSpan added in v0.22.0

func (t *NoopTracer) StartBlockSpan(
	ctx context.Context,
	entityID flow.Identifier,
	spanName SpanName,
	opts ...trace.SpanStartOption,
) (
	trace.Span,
	context.Context,
)

func (*NoopTracer) StartCollectionSpan added in v0.22.0

func (t *NoopTracer) StartCollectionSpan(
	ctx context.Context,
	entityID flow.Identifier,
	spanName SpanName,
	opts ...trace.SpanStartOption,
) (
	trace.Span,
	context.Context,
)

func (*NoopTracer) StartSampledSpanFromParent added in v0.30.0

func (t *NoopTracer) StartSampledSpanFromParent(
	parentSpan trace.Span,
	entityID flow.Identifier,
	operationName SpanName,
	opts ...trace.SpanStartOption,
) trace.Span

func (*NoopTracer) StartSpanFromContext

func (t *NoopTracer) StartSpanFromContext(
	ctx context.Context,
	operationName SpanName,
	opts ...trace.SpanStartOption,
) (
	trace.Span,
	context.Context,
)

func (*NoopTracer) StartSpanFromParent

func (t *NoopTracer) StartSpanFromParent(
	parentSpan trace.Span,
	operationName SpanName,
	opts ...trace.SpanStartOption,
) trace.Span

func (*NoopTracer) WithSpanFromContext added in v0.15.0

func (t *NoopTracer) WithSpanFromContext(
	ctx context.Context,
	operationName SpanName,
	f func(),
	opts ...trace.SpanStartOption,
)

type SpanName

type SpanName string
const (

	// Extend
	ProtoStateMutatorExtend                SpanName = "proto.state.mutator.extend"
	ProtoStateMutatorExtendCheckHeader     SpanName = "proto.state.mutator.extend.checkHeader"
	ProtoStateMutatorExtendCheckGuarantees SpanName = "proto.state.mutator.extend.checkGuarantees"
	ProtoStateMutatorExtendCheckSeals      SpanName = "proto.state.mutator.extend.checkSeals"
	ProtoStateMutatorExtendCheckReceipts   SpanName = "proto.state.mutator.extend.checkReceipts"
	ProtoStateMutatorExtendDBInsert        SpanName = "proto.state.mutator.extend.dbInsert"

	// HeaderExtend
	ProtoStateMutatorHeaderExtend              SpanName = "proto.state.mutator.headerExtend"
	ProtoStateMutatorHeaderExtendGetLastSealed SpanName = "proto.state.mutator.headerExtend.lastSealed"

	// mutator.Finalize
	ProtoStateMutatorFinalize SpanName = "proto.state.mutator.finalize"

	// Builder
	CONBuilderBuildOn SpanName = "con.builder.buildOn"

	// Finalizer
	CONFinalizerFinalizeBlock SpanName = "con.finalizer.finalizeBlock"

	// Ingestion
	CONIngOnCollectionGuarantee SpanName = "con.ingestion.onCollectionGuarantee"

	// Compliance
	CONCompOnBlockProposal      SpanName = "con.compliance.onBlockProposal"
	ConCompProcessBlockProposal SpanName = "con.compliance.processBlockProposal"
	CONCompOnBlockVote          SpanName = "con.compliance.onBlockVote"

	// Matching
	CONMatchProcessReceipt    SpanName = "con.matching.processReceipt"
	CONMatchProcessReceiptVal SpanName = "con.matching.processReceipt.validation"

	// Sealing
	CONSealingProcessFinalizedBlock           SpanName = "con.sealing.processFinalizedBlock"
	CONSealingCheckForEmergencySealableBlocks SpanName = "con.sealing.processFinalizedBlock.checkEmergencySealing"
	CONSealingPruning                         SpanName = "con.sealing.processFinalizedBlock.pruning"
	CONSealingRequestingPendingApproval       SpanName = "con.sealing.processFinalizedBlock.requestPendingApprovals"
	CONSealingProcessIncorporatedResult       SpanName = "con.sealing.processIncorporatedResult"
	CONSealingProcessApproval                 SpanName = "con.sealing.processApproval"

	// Follower Core
	FollowerProcessFinalizedBlock  SpanName = "follower.processFinalizedBlock"
	FollowerProcessCertifiedBlocks SpanName = "follower.processCertifiedBlocks"
	FollowerExtendPendingTree      SpanName = "follower.extendPendingTree"
	FollowerExtendProtocolState    SpanName = "follower.extendProtocolState"

	// Builder
	COLBuildOn                  SpanName = "col.builder"
	COLBuildOnGetBuildCtx       SpanName = "col.builder.getBuildCtx"
	COLBuildOnUnfinalizedLookup SpanName = "col.builder.unfinalizedLookup"
	COLBuildOnFinalizedLookup   SpanName = "col.builder.finalizedLookup"
	COLBuildOnCreatePayload     SpanName = "col.builder.createPayload"
	COLBuildOnCreateHeader      SpanName = "col.builder.createHeader"
	COLBuildOnDBInsert          SpanName = "col.builder.dbInsert"

	// Cluster State
	COLClusterStateMutatorExtend                       SpanName = "col.state.mutator.extend"
	COLClusterStateMutatorExtendCheckHeader            SpanName = "col.state.mutator.extend.checkHeader"
	COLClusterStateMutatorExtendGetExtendCtx           SpanName = "col.state.mutator.extend.getExtendCtx"
	COLClusterStateMutatorExtendCheckAncestry          SpanName = "col.state.mutator.extend.checkAncestry"
	COLClusterStateMutatorExtendCheckReferenceBlock    SpanName = "col.state.mutator.extend.checkRefBlock"
	COLClusterStateMutatorExtendCheckTransactionsValid SpanName = "col.state.mutator.extend.checkTransactionsValid"
	COLClusterStateMutatorExtendDBInsert               SpanName = "col.state.mutator.extend.dbInsert"

	EXEHandleBlock          SpanName = "exe.ingestion.handleBlock"
	EXEHandleCollection     SpanName = "exe.ingestion.handleCollection"
	EXEExecuteBlock         SpanName = "exe.ingestion.executeBlock"
	EXESaveExecutionResults SpanName = "exe.ingestion.saveExecutionResults"

	EXEUploadCollections         SpanName = "exe.manager.uploadCollections"
	EXEAddToExecutionDataService SpanName = "exe.manager.addToExecutionDataService"

	EXEBroadcastExecutionReceipt SpanName = "exe.provider.broadcastExecutionReceipt"

	EXEComputeBlock       SpanName = "exe.computer.computeBlock"
	EXEComputeTransaction SpanName = "exe.computer.computeTransaction"

	EXEStateSaveExecutionResults          SpanName = "exe.state.saveExecutionResults"
	EXECommitDelta                        SpanName = "exe.state.commitDelta"
	EXEGetExecutionResultID               SpanName = "exe.state.getExecutionResultID"
	EXEUpdateHighestExecutedBlockIfHigher SpanName = "exe.state.updateHighestExecutedBlockIfHigher"

	// Verification node
	//
	// assigner engine
	VERProcessFinalizedBlock SpanName = "ver.processFinalizedBlock"
	// children of VERProcessFinalizedBlock
	VERAssignerHandleFinalizedBlock   SpanName = "ver.assigner.handleFinalizedBlock"
	VERAssignerHandleExecutionReceipt SpanName = "ver.assigner.handleExecutionReceipt"
	VERAssignerChunkAssignment        SpanName = "ver.assigner.chunkAssignment"
	VERAssignerProcessChunk           SpanName = "ver.assigner.processChunk"

	// fetcher engine
	VERProcessAssignedChunk SpanName = "ver.processAssignedChunk"
	// children of VERProcessAssignedChunk
	VERFetcherHandleAssignedChunk   SpanName = "ver.fetcher.handleAssignedChunk"
	VERFetcherHandleChunkDataPack   SpanName = "ver.fetcher.handleChunkDataPack"
	VERFetcherValidateChunkDataPack SpanName = "ver.fetcher.validateChunkDataPack"
	VERFetcherPushToVerifier        SpanName = "ver.fetcher.pushToVerifier"

	// requester engine
	VERProcessChunkDataPackRequest SpanName = "ver.processChunkDataPackRequest"
	// children of VERProcessChunkDataPackRequest
	VERRequesterHandleChunkDataRequest   SpanName = "ver.requester.handleChunkDataRequest"
	VERRequesterHandleChunkDataResponse  SpanName = "ver.requester.handleChunkDataResponse"
	VERRequesterDispatchChunkDataRequest SpanName = "ver.requester.dispatchChunkDataRequest"

	VERProcessExecutionReceipt SpanName = "ver.processExecutionReceipt"
	// children of VERProcessExecutionReceipt
	VERFindHandleExecutionReceipt SpanName = "ver.find.handleExecutionReceipt"
	VERFindOnFinalizedBlock       SpanName = "ver.finder.OnFinalizedBlock"
	VERFindCheckCachedReceipts    SpanName = "ver.finder.checkCachedReceipts"
	VERFindCheckPendingReceipts   SpanName = "ver.finder.checkPendingReceipts"
	VERFindCheckReadyReceipts     SpanName = "ver.finder.checkReadyReceipts"
	VERFindProcessResult          SpanName = "ver.finder.processResult"
	VERFindOnResultProcessed      SpanName = "ver.finder.onResultProcessed"

	VERProcessExecutionResult SpanName = "ver.processExecutionResult"
	// children of VERProcessExecutionResult
	VERMatchHandleExecutionResult SpanName = "ver.match.handleExecutionResult"
	VERMatchHandleChunkDataPack   SpanName = "ver.match.handleChunkDataPack"
	VERMatchMyChunkAssignments    SpanName = "ver.match.myChunkAssignments"
	VERVerVerifyWithMetrics       SpanName = "ver.verify.verifyWithMetrics"
	VERVerChunkVerify             SpanName = "ver.verify.ChunkVerifier.Verify"
	VERVerGenerateResultApproval  SpanName = "ver.verify.GenerateResultApproval"

	// Flow Virtual Machine
	FVMVerifyTransaction           SpanName = "fvm.verifyTransaction"
	FVMSeqNumCheckTransaction      SpanName = "fvm.seqNumCheckTransaction"
	FVMExecuteTransaction          SpanName = "fvm.executeTransaction"
	FVMDeductTransactionFees       SpanName = "fvm.deductTransactionFees"
	FVMTransactionStorageUsedCheck SpanName = "fvm.env.transactionStorageUsedCheck"
	FVMInvokeContractFunction      SpanName = "fvm.invokeContractFunction"

	FVMEnvValueExists                 SpanName = "fvm.env.valueExists"
	FVMEnvGetValue                    SpanName = "fvm.env.getValue"
	FVMEnvSetValue                    SpanName = "fvm.env.setValue"
	FVMEnvAllocateStorageIndex        SpanName = "fvm.env.allocateStorageIndex"
	FVMEnvGetAccount                  SpanName = "fvm.env.getAccount"
	FVMEnvGetStorageUsed              SpanName = "fvm.env.getStorageUsed"
	FVMEnvGetStorageCapacity          SpanName = "fvm.env.getStorageCapacity"
	FVMEnvGetAccountBalance           SpanName = "fvm.env.getAccountBalance"
	FVMEnvGetAccountAvailableBalance  SpanName = "fvm.env.getAccountAvailableBalance"
	FVMEnvResolveLocation             SpanName = "fvm.env.resolveLocation"
	FVMEnvGetCode                     SpanName = "fvm.env.getCode"
	FVMEnvGetAccountContractNames     SpanName = "fvm.env.getAccountContractNames"
	FVMEnvGetOrLoadProgram            SpanName = "fvm.env.getOrLoadCachedProgram"
	FVMEnvProgramLog                  SpanName = "fvm.env.programLog"
	FVMEnvEmitEvent                   SpanName = "fvm.env.emitEvent"
	FVMEnvEncodeEvent                 SpanName = "fvm.env.encodeEvent"
	FVMEnvGenerateUUID                SpanName = "fvm.env.generateUUID"
	FVMEnvGenerateAccountLocalID      SpanName = "fvm.env.generateAccountLocalID"
	FVMEnvDecodeArgument              SpanName = "fvm.env.decodeArgument"
	FVMEnvHash                        SpanName = "fvm.env.Hash"
	FVMEnvVerifySignature             SpanName = "fvm.env.verifySignature"
	FVMEnvValidatePublicKey           SpanName = "fvm.env.validatePublicKey"
	FVMEnvBLSVerifyPOP                SpanName = "fvm.env.blsVerifyPOP"
	FVMEnvBLSAggregateSignatures      SpanName = "fvm.env.blsAggregateSignatures"
	FVMEnvBLSAggregatePublicKeys      SpanName = "fvm.env.blsAggregatePublicKeys"
	FVMEnvGetCurrentBlockHeight       SpanName = "fvm.env.getCurrentBlockHeight"
	FVMEnvGetBlockAtHeight            SpanName = "fvm.env.getBlockAtHeight"
	FVMEnvRandom                      SpanName = "fvm.env.unsafeRandom"
	FVMEnvRandomSourceHistoryProvider SpanName = "fvm.env.randomSourceHistoryProvider"
	FVMEnvCreateAccount               SpanName = "fvm.env.createAccount"
	FVMEnvAddAccountKey               SpanName = "fvm.env.addAccountKey"
	FVMEnvAddEncodedAccountKey        SpanName = "fvm.env.addEncodedAccountKey"
	FVMEnvAccountKeysCount            SpanName = "fvm.env.accountKeysCount"
	FVMEnvGetAccountKey               SpanName = "fvm.env.getAccountKey"
	FVMEnvRevokeAccountKey            SpanName = "fvm.env.revokeAccountKey"
	FVMEnvRevokeEncodedAccountKey     SpanName = "fvm.env.revokeEncodedAccountKey"
	FVMEnvUpdateAccountContractCode   SpanName = "fvm.env.updateAccountContractCode"
	FVMEnvGetAccountContractCode      SpanName = "fvm.env.getAccountContractCode"
	FVMEnvRemoveAccountContractCode   SpanName = "fvm.env.removeAccountContractCode"
	FVMEnvGetSigningAccounts          SpanName = "fvm.env.getSigningAccounts"

	FVMCadenceTrace SpanName = "fvm.cadence.trace"
)

Span names

func (SpanName) Child added in v0.22.0

func (s SpanName) Child(subOp string) SpanName

type Tracer added in v0.27.0

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

Tracer is the implementation of the Tracer interface TODO(rbtz): make private

func NewTracer

func NewTracer(
	log zerolog.Logger,
	serviceName string,
	chainID string,
	sensitivity uint,
) (
	*Tracer,
	error,
)

NewTracer creates a new OpenTelemetry-based tracer.

func (*Tracer) BlockRootSpan added in v0.30.0

func (t *Tracer) BlockRootSpan(blockID flow.Identifier) trace.Span

func (*Tracer) Done added in v0.27.0

func (t *Tracer) Done() <-chan struct{}

Done returns a channel that will close when shutdown is complete.

func (*Tracer) Ready added in v0.27.0

func (t *Tracer) Ready() <-chan struct{}

Ready returns a channel that will close when the network stack is ready.

func (*Tracer) RecordSpanFromParent added in v0.27.0

func (t *Tracer) RecordSpanFromParent(
	parentSpan trace.Span,
	operationName SpanName,
	duration time.Duration,
	attrs []attribute.KeyValue,
	opts ...trace.SpanStartOption,
)

func (*Tracer) ShouldSample added in v0.30.0

func (t *Tracer) ShouldSample(entityID flow.Identifier) bool

func (*Tracer) StartBlockSpan added in v0.27.0

func (t *Tracer) StartBlockSpan(
	ctx context.Context,
	blockID flow.Identifier,
	spanName SpanName,
	opts ...trace.SpanStartOption,
) (
	trace.Span,
	context.Context,
)

func (*Tracer) StartCollectionSpan added in v0.27.0

func (t *Tracer) StartCollectionSpan(
	ctx context.Context,
	collectionID flow.Identifier,
	spanName SpanName,
	opts ...trace.SpanStartOption,
) (
	trace.Span,
	context.Context,
)

func (*Tracer) StartSampledSpanFromParent added in v0.30.0

func (t *Tracer) StartSampledSpanFromParent(
	parentSpan trace.Span,
	entityID flow.Identifier,
	operationName SpanName,
	opts ...trace.SpanStartOption,
) trace.Span

func (*Tracer) StartSpanFromContext added in v0.27.0

func (t *Tracer) StartSpanFromContext(
	ctx context.Context,
	operationName SpanName,
	opts ...trace.SpanStartOption,
) (
	trace.Span,
	context.Context,
)

func (*Tracer) StartSpanFromParent added in v0.27.0

func (t *Tracer) StartSpanFromParent(
	parentSpan trace.Span,
	operationName SpanName,
	opts ...trace.SpanStartOption,
) trace.Span

func (*Tracer) WithSpanFromContext added in v0.27.0

func (t *Tracer) WithSpanFromContext(ctx context.Context,
	operationName SpanName,
	f func(),
	opts ...trace.SpanStartOption,
)

WithSpanFromContext encapsulates executing a function within an span, i.e., it starts a span with the specified SpanName from the context, executes the function f, and finishes the span once the function returns.

Jump to

Keyboard shortcuts

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