trace

package
v0.27.0 Latest Latest
Warning

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

Go to latest
Published: Aug 2, 2022 License: AGPL-3.0 Imports: 15 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 LogTracer added in v0.23.1

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

LogTracer is the implementation of the Tracer interface which passes all the traces back to the passed logger and print them this is mostly useful for debugging and testing TODO(rbtz): make private

func NewLogTracer added in v0.23.1

func NewLogTracer(log zerolog.Logger) *LogTracer

NewLogTracer creates a new zerolog-based tracer. TODO: Consider switching to go.opentelemetry.io/otel/exporters/stdout/stdouttrace

func (*LogTracer) Done added in v0.23.1

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

func (*LogTracer) Ready added in v0.23.1

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

func (*LogTracer) RecordSpanFromParent added in v0.23.1

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

func (*LogTracer) Start added in v0.27.0

func (t *LogTracer) Start(ctx context.Context, spanName string, _ ...trace.SpanStartOption) (context.Context, trace.Span)

Start implements trace.Tracer interface.

func (*LogTracer) StartBlockSpan added in v0.23.1

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

func (*LogTracer) StartCollectionSpan added in v0.23.1

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

func (*LogTracer) StartSpanFromContext added in v0.23.1

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

func (*LogTracer) StartSpanFromParent added in v0.23.1

func (t *LogTracer) StartSpanFromParent(
	span trace.Span,
	operationName SpanName,
	opts ...trace.SpanStartOption,
) trace.Span

func (*LogTracer) StartTransactionSpan added in v0.23.1

func (t *LogTracer) StartTransactionSpan(
	ctx context.Context,
	transactionID flow.Identifier,
	spanName SpanName,
	opts ...trace.SpanStartOption,
) (trace.Span, context.Context, bool)

StartTransactionSpan starts a span that will be aggregated under the given transaction. All spans for the same transaction will be aggregated under a root span

func (*LogTracer) WithSpanFromContext added in v0.23.1

func (t *LogTracer) 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.

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) 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) RecordSpanFromParent added in v0.14.5

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

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, bool)

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, bool)

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) StartTransactionSpan added in v0.22.0

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

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 Engine
	FollowerOnBlockProposal        SpanName = "follower.onBlockProposal"
	FollowerProcessBlockProposal   SpanName = "follower.processBlockProposal"
	FollowerProcessPendingChildren SpanName = "follower.processPendingChildren"

	// Builder
	COLBuildOn                  SpanName = "col.builder"
	COLBuildOnSetup             SpanName = "col.builder.setup"
	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"
	COLClusterStateMutatorExtendSetup                  SpanName = "col.state.mutator.extend.setup"
	COLClusterStateMutatorExtendCheckAncestry          SpanName = "col.state.mutator.extend.ancestry"
	COLClusterStateMutatorExtendCheckTransactionsValid SpanName = "col.state.mutator.extend.transactions.validity"
	COLClusterStateMutatorExtendCheckTransactionsDupes SpanName = "col.state.mutator.extend.transactions.dupes"
	COLClusterStateMutatorExtendDBInsert               SpanName = "col.state.mutator.extend.dbInsert"

	EXEHandleBlock             SpanName = "exe.ingestion.handleBlock"
	EXEHandleCollection        SpanName = "exe.ingestion.handleCollection"
	EXEHandleComputationResult SpanName = "exe.ingestion.handleComputationResult"
	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"
	EXEComputeCollection       SpanName = "exe.computer.computeCollection"
	EXEMergeCollectionView     SpanName = "exe.computer.mergeCollectionView"
	EXEComputeSystemCollection SpanName = "exe.computer.computeSystemCollection"
	EXEComputeTransaction      SpanName = "exe.computer.computeTransaction"
	EXERunTransaction          SpanName = "exe.computer.runTransaction"
	EXEPostProcessTransaction  SpanName = "exe.computer.postProcessTransaction"
	EXEMergeTransactionView    SpanName = "exe.computer.mergeTransactionView"

	EXEStateSaveExecutionResults          SpanName = "exe.state.saveExecutionResults"
	EXECommitDelta                        SpanName = "exe.state.commitDelta"
	EXEGetRegisters                       SpanName = "exe.state.getRegisters"
	EXEGetRegistersWithProofs             SpanName = "exe.state.getRegistersWithProofs"
	EXEGetExecutionResultID               SpanName = "exe.state.getExecutionResultID"
	EXEUpdateHighestExecutedBlockIfHigher SpanName = "exe.state.updateHighestExecutedBlockIfHigher"
	EXEHashEvents                         SpanName = "exe.state.hashEvents"

	// 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"
	FVMFrozenAccountCheckTransaction SpanName = "fvm.frozenAccountCheckTransaction"

	FVMEnvHash                      SpanName = "fvm.env.Hash"
	FVMEnvValueExists               SpanName = "fvm.env.valueExists"
	FVMEnvGetValue                  SpanName = "fvm.env.getValue"
	FVMEnvSetValue                  SpanName = "fvm.env.setValue"
	FVMEnvGetStorageUsed            SpanName = "fvm.env.getStorageUsed"
	FVMEnvGetStorageCapacity        SpanName = "fvm.env.getStorageCapacity"
	FVMEnvGetAccountBalance         SpanName = "fvm.env.getAccountBalance"
	FVMEnvResolveLocation           SpanName = "fvm.env.resolveLocation"
	FVMEnvGetCode                   SpanName = "fvm.env.getCode"
	FVMEnvGetAccountContractNames   SpanName = "fvm.env.getAccountContractNames"
	FVMEnvGetProgram                SpanName = "fvm.env.getCachedProgram"
	FVMEnvSetProgram                SpanName = "fvm.env.cacheProgram"
	FVMEnvProgramLog                SpanName = "fvm.env.programLog"
	FVMEnvEmitEvent                 SpanName = "fvm.env.emitEvent"
	FVMEnvGenerateUUID              SpanName = "fvm.env.generateUUID"
	FVMEnvDecodeArgument            SpanName = "fvm.env.decodeArgument"
	FVMEnvVerifySignature           SpanName = "fvm.env.verifySignature"
	FVMEnvGetCurrentBlockHeight     SpanName = "fvm.env.getCurrentBlockHeight"
	FVMEnvUnsafeRandom              SpanName = "fvm.env.unsafeRandom"
	FVMEnvGetBlockAtHeight          SpanName = "fvm.env.getBlockAtHeight"
	FVMEnvCreateAccount             SpanName = "fvm.env.createAccount"
	FVMEnvAddAccountKey             SpanName = "fvm.env.addAccountKey"
	FVMEnvGetAccountKey             SpanName = "fvm.env.getAccountKey"
	FVMEnvRemoveAccountKey          SpanName = "fvm.env.removeAccountKey"
	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) 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) 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, bool)

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, bool)

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) StartTransactionSpan added in v0.27.0

func (t *Tracer) StartTransactionSpan(
	ctx context.Context,
	transactionID flow.Identifier,
	spanName SpanName,
	opts ...trace.SpanStartOption,
) (trace.Span, context.Context, bool)

StartTransactionSpan starts a span that will be aggregated under the given transaction. All spans for the same transaction will be aggregated under a root 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