trace

package
v0.23.8 Latest Latest
Warning

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

Go to latest
Published: Jan 31, 2022 License: AGPL-3.0 Imports: 11 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

This section is empty.

Functions

This section is empty.

Types

type InternalTracer

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

func (*InternalTracer) Extract

func (t *InternalTracer) Extract(format interface{}, carrier interface{}) (opentracing.SpanContext, error)

func (*InternalTracer) Inject

func (t *InternalTracer) Inject(sm opentracing.SpanContext, format interface{}, carrier interface{}) error

func (*InternalTracer) StartSpan

func (t *InternalTracer) StartSpan(operationName string, opts ...opentracing.StartSpanOption) opentracing.Span

type LogSpan added in v0.23.1

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

func NewLogSpan added in v0.23.1

func NewLogSpan(tracer *LogTracer, operationName SpanName) *LogSpan

func NewLogSpanWithParent added in v0.23.1

func NewLogSpanWithParent(tracer *LogTracer, operationName SpanName, parentSpanID uint64) *LogSpan

func (*LogSpan) BaggageItem added in v0.23.1

func (s *LogSpan) BaggageItem(restrictedKey string) string

func (*LogSpan) Context added in v0.23.1

func (s *LogSpan) Context() opentracing.SpanContext

func (*LogSpan) Finish added in v0.23.1

func (s *LogSpan) Finish()

func (*LogSpan) FinishWithOptions added in v0.23.1

func (s *LogSpan) FinishWithOptions(opts opentracing.FinishOptions)

func (*LogSpan) Log added in v0.23.1

func (s *LogSpan) Log(data opentracing.LogData)

func (*LogSpan) LogEvent added in v0.23.1

func (s *LogSpan) LogEvent(event string)

func (*LogSpan) LogEventWithPayload added in v0.23.1

func (s *LogSpan) LogEventWithPayload(event string, payload interface{})

func (*LogSpan) LogFields added in v0.23.1

func (s *LogSpan) LogFields(fields ...log.Field)

func (*LogSpan) LogKV added in v0.23.1

func (s *LogSpan) LogKV(alternatingKeyValues ...interface{})

func (*LogSpan) ProduceLog added in v0.23.1

func (s *LogSpan) ProduceLog()

func (*LogSpan) SetBaggageItem added in v0.23.1

func (s *LogSpan) SetBaggageItem(restrictedKey, value string) opentracing.Span

func (*LogSpan) SetOperationName added in v0.23.1

func (s *LogSpan) SetOperationName(operationName string) opentracing.Span

func (*LogSpan) SetTag added in v0.23.1

func (s *LogSpan) SetTag(key string, value interface{}) opentracing.Span

func (*LogSpan) Tracer added in v0.23.1

func (s *LogSpan) Tracer() opentracing.Tracer

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

func NewLogTracer added in v0.23.1

func NewLogTracer(log zerolog.Logger) *LogTracer

LogTracer creates a new tracer.

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 opentracing.Span,
	operationName SpanName,
	duration time.Duration,
	logs []opentracing.LogRecord,
	opts ...opentracing.StartSpanOption,
)

func (*LogTracer) StartBlockSpan added in v0.23.1

func (t *LogTracer) StartBlockSpan(
	ctx context.Context,
	blockID flow.Identifier,
	spanName SpanName,
	opts ...opentracing.StartSpanOption) (opentracing.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 ...opentracing.StartSpanOption) (opentracing.Span, context.Context, bool)

func (*LogTracer) StartSpanFromContext added in v0.23.1

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

func (*LogTracer) StartSpanFromParent added in v0.23.1

func (t *LogTracer) StartSpanFromParent(
	span opentracing.Span,
	operationName SpanName,
	opts ...opentracing.StartSpanOption,
) opentracing.Span

func (*LogTracer) StartTransactionSpan added in v0.23.1

func (t *LogTracer) StartTransactionSpan(
	ctx context.Context,
	transactionID flow.Identifier,
	spanName SpanName,
	opts ...opentracing.StartSpanOption) (opentracing.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 ...opentracing.StartSpanOption)

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 NoopSpan

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

func (*NoopSpan) BaggageItem

func (s *NoopSpan) BaggageItem(restrictedKey string) string

func (*NoopSpan) Context

func (s *NoopSpan) Context() opentracing.SpanContext

func (*NoopSpan) Finish

func (s *NoopSpan) Finish()

func (*NoopSpan) FinishWithOptions

func (s *NoopSpan) FinishWithOptions(opts opentracing.FinishOptions)

func (*NoopSpan) Log

func (s *NoopSpan) Log(data opentracing.LogData)

func (*NoopSpan) LogEvent

func (s *NoopSpan) LogEvent(event string)

func (*NoopSpan) LogEventWithPayload

func (s *NoopSpan) LogEventWithPayload(event string, payload interface{})

func (*NoopSpan) LogFields

func (s *NoopSpan) LogFields(fields ...log.Field)

func (*NoopSpan) LogKV

func (s *NoopSpan) LogKV(alternatingKeyValues ...interface{})

func (*NoopSpan) SetBaggageItem

func (s *NoopSpan) SetBaggageItem(restrictedKey, value string) opentracing.Span

func (*NoopSpan) SetOperationName

func (s *NoopSpan) SetOperationName(operationName string) opentracing.Span

func (*NoopSpan) SetTag

func (s *NoopSpan) SetTag(key string, value interface{}) opentracing.Span

func (*NoopSpan) Tracer

func (s *NoopSpan) Tracer() opentracing.Tracer

type NoopSpanContext

type NoopSpanContext struct{}

func (*NoopSpanContext) ForeachBaggageItem

func (c *NoopSpanContext) ForeachBaggageItem(handler func(k, v string) bool)

type NoopTracer

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

NoopTracer is the implementation of the Tracer interface

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 opentracing.Span,
	operationName SpanName,
	duration time.Duration,
	logs []opentracing.LogRecord,
	opts ...opentracing.StartSpanOption,
)

func (*NoopTracer) StartBlockSpan added in v0.22.0

func (t *NoopTracer) StartBlockSpan(
	ctx context.Context,
	entityID flow.Identifier,
	spanName SpanName,
	opts ...opentracing.StartSpanOption) (opentracing.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 ...opentracing.StartSpanOption) (opentracing.Span, context.Context, bool)

func (*NoopTracer) StartSpanFromContext

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

func (*NoopTracer) StartSpanFromParent

func (t *NoopTracer) StartSpanFromParent(
	span opentracing.Span,
	operationName SpanName,
	opts ...opentracing.StartSpanOption,
) opentracing.Span

func (*NoopTracer) StartTransactionSpan added in v0.22.0

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

func (*NoopTracer) WithSpanFromContext added in v0.15.0

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

type OpenTracer

type OpenTracer struct {
	opentracing.Tracer
	// contains filtered or unexported fields
}

OpenTracer is the implementation of the Tracer interface

func NewTracer

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

NewTracer creates a new tracer.

TODO (ramtin) : we might need to add a mutex lock (not sure if tracer itself is thread-safe)

func (*OpenTracer) Done

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

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

func (*OpenTracer) Ready

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

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

func (*OpenTracer) RecordSpanFromParent added in v0.14.5

func (t *OpenTracer) RecordSpanFromParent(
	span opentracing.Span,
	operationName SpanName,
	duration time.Duration,
	logs []opentracing.LogRecord,
	opts ...opentracing.StartSpanOption,
)

func (*OpenTracer) StartBlockSpan added in v0.22.0

func (t *OpenTracer) StartBlockSpan(
	ctx context.Context,
	blockID flow.Identifier,
	spanName SpanName,
	opts ...opentracing.StartSpanOption) (opentracing.Span, context.Context, bool)

func (*OpenTracer) StartCollectionSpan added in v0.22.0

func (t *OpenTracer) StartCollectionSpan(
	ctx context.Context,
	collectionID flow.Identifier,
	spanName SpanName,
	opts ...opentracing.StartSpanOption) (opentracing.Span, context.Context, bool)

func (*OpenTracer) StartSpanFromContext

func (t *OpenTracer) StartSpanFromContext(
	ctx context.Context,
	operationName SpanName,
	opts ...opentracing.StartSpanOption,
) (opentracing.Span, context.Context)

func (*OpenTracer) StartSpanFromParent

func (t *OpenTracer) StartSpanFromParent(
	span opentracing.Span,
	operationName SpanName,
	opts ...opentracing.StartSpanOption,
) opentracing.Span

func (*OpenTracer) StartTransactionSpan added in v0.22.0

func (t *OpenTracer) StartTransactionSpan(
	ctx context.Context,
	transactionID flow.Identifier,
	spanName SpanName,
	opts ...opentracing.StartSpanOption) (opentracing.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 (*OpenTracer) WithSpanFromContext added in v0.15.0

func (t *OpenTracer) WithSpanFromContext(ctx context.Context,
	operationName SpanName,
	f func(),
	opts ...opentracing.StartSpanOption)

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 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"

	EXEBroadcastExecutionReceipt SpanName = "exe.provider.broadcastExecutionReceipt"

	EXEComputeBlock            SpanName = "exe.computer.computeBlock"
	EXEComputeCollection       SpanName = "exe.computer.computeCollection"
	EXEComputeSystemCollection SpanName = "exe.computer.computeSystemCollection"
	EXEComputeTransaction      SpanName = "exe.computer.computeTransaction"
	EXERunTransaction          SpanName = "exe.computer.runTransaction"
	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"
	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

Jump to

Keyboard shortcuts

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