reqctx

package
v1.5.5 Latest Latest
Warning

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

Go to latest
Published: Apr 17, 2024 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var WithLogger = logging.WithLogger

Functions

func Logger

func Logger(ctx context.Context) *zap.Logger

func ModuleExecutionTracing added in v1.1.4

func ModuleExecutionTracing(ctx context.Context) bool

func ReqStats

func ReqStats(ctx context.Context) *metrics.Stats

func Tracer

func Tracer(ctx context.Context) ttrace.Tracer

func WithModuleExecutionTracing added in v1.1.4

func WithModuleExecutionTracing(ctx context.Context) context.Context

func WithReqStats

func WithReqStats(ctx context.Context, stats *metrics.Stats) context.Context

func WithRequest

func WithRequest(ctx context.Context, req *RequestDetails) context.Context

func WithTier2RequestParameters added in v1.5.0

func WithTier2RequestParameters(ctx context.Context, parameters Tier2RequestParameters) context.Context

func WithTracer

func WithTracer(ctx context.Context, tracer ttrace.Tracer) context.Context

Types

type ISpan

type ISpan interface {
	// End completes the Span. The Span is considered complete and ready to be
	// delivered through the rest of the telemetry pipeline after this method
	// is called. Therefore, updates to the Span are not allowed after this
	// method has been called.
	End(options ...ttrace.SpanEndOption)

	// AddEvent adds an event with the provided name and options.
	AddEvent(name string, options ...ttrace.EventOption)

	// IsRecording returns the recording state of the Span. It will return
	// true if the Span is active and events can be recorded.
	IsRecording() bool

	// RecordError will record err as an exception span event for this span. An
	// additional call to SetStatus is required if the Status of the Span should
	// be set to Error, as this method does not change the Span status. If this
	// span is not being recorded or err is nil then this method does nothing.
	RecordError(err error, options ...ttrace.EventOption)

	// SpanContext returns the SpanContext of the Span. The returned SpanContext
	// is usable even after the End method has been called for the Span.
	SpanContext() ttrace.SpanContext

	// SetStatus sets the status of the Span in the form of a code and a
	// description, provided the status hasn't already been set to a higher
	// value before (OK > Error > Unset). The description is only included in a
	// status when the code is for an error.
	SetStatus(code codes.Code, description string)

	// SetName sets the Span name.
	SetName(name string)

	// SetAttributes sets kv as attributes of the Span. If a key from kv
	// already exists for an attribute of the Span it will be overwritten with
	// the value contained in kv.
	SetAttributes(kv ...attribute.KeyValue)

	// TracerProvider returns a TracerProvider that can be used to generate
	// additional Spans on the same telemetry pipeline as the current Span.
	TracerProvider() ttrace.TracerProvider

	EndWithErr(e *error)
}

func Span

func Span(ctx context.Context) ISpan

func WithModuleExecutionSpan added in v1.1.4

func WithModuleExecutionSpan(ctx context.Context, name string) (context.Context, ISpan)

func WithSpan

func WithSpan(ctx context.Context, name string) (context.Context, ISpan)

type IsOutputModuleFunc added in v0.1.0

type IsOutputModuleFunc func(name string) bool

type NoopSpan added in v1.3.6

type NoopSpan struct{}

NoopSpan is an implementation of span that preforms no operations.

func (*NoopSpan) AddEvent added in v1.3.6

func (n *NoopSpan) AddEvent(string, ...ttrace.EventOption)

AddEvent does nothing.

func (*NoopSpan) End added in v1.3.6

func (n *NoopSpan) End(...ttrace.SpanEndOption)

End does nothing.

func (*NoopSpan) EndWithErr added in v1.3.6

func (n *NoopSpan) EndWithErr(e *error)

func (*NoopSpan) IsRecording added in v1.3.6

func (n *NoopSpan) IsRecording() bool

IsRecording always returns false.

func (*NoopSpan) RecordError added in v1.3.6

func (n *NoopSpan) RecordError(error, ...ttrace.EventOption)

RecordError does nothing.

func (*NoopSpan) SetAttributes added in v1.3.6

func (n *NoopSpan) SetAttributes(...attribute.KeyValue)

SetAttributes does nothing.

func (*NoopSpan) SetError added in v1.3.6

func (n *NoopSpan) SetError(bool)

SetError does nothing.

func (*NoopSpan) SetName added in v1.3.6

func (n *NoopSpan) SetName(string)

SetName does nothing.

func (*NoopSpan) SetStatus added in v1.3.6

func (n *NoopSpan) SetStatus(codes.Code, string)

SetStatus does nothing.

func (*NoopSpan) SpanContext added in v1.3.6

func (n *NoopSpan) SpanContext() ttrace.SpanContext

SpanContext returns an empty span context.

func (*NoopSpan) TracerProvider added in v1.3.6

func (n *NoopSpan) TracerProvider() ttrace.TracerProvider

TracerProvider returns a no-op TracerProvider.

type RequestDetails added in v0.1.0

type RequestDetails struct {
	Modules *pbsubstreams.Modules

	DebugInitialStoreSnapshotForModules []string
	OutputModule                        string
	// What the user requested, derived from either the Request.StartBlockNum or Request.Cursor
	ResolvedStartBlockNum uint64
	ResolvedCursor        string

	LinearHandoffBlockNum uint64
	LinearGateBlockNum    uint64
	StopBlockNum          uint64
	MaxParallelJobs       uint64
	CacheTag              string
	UniqueID              uint64

	ProductionMode bool
	IsTier2Request bool
	Tier2Stage     int
}

func Details

func Details(ctx context.Context) *RequestDetails

func (*RequestDetails) IsOutputModule added in v0.1.0

func (d *RequestDetails) IsOutputModule(modName string) bool

func (*RequestDetails) ShouldReturnWrittenPartials added in v1.0.2

func (d *RequestDetails) ShouldReturnWrittenPartials(modName string) bool

func (*RequestDetails) ShouldStreamCachedOutputs added in v0.1.0

func (d *RequestDetails) ShouldStreamCachedOutputs() bool

func (*RequestDetails) UniqueIDString added in v1.1.4

func (d *RequestDetails) UniqueIDString() string

type Tier2RequestParameters added in v1.5.0

type Tier2RequestParameters struct {
	MeteringConfig       string
	FirstStreamableBlock uint64

	MergedBlockStoreURL  string
	StateStoreURL        string
	StateBundleSize      uint64
	StateStoreDefaultTag string

	BlockType string

	WASMModules map[string]string
}

func GetTier2RequestParameters added in v1.5.0

func GetTier2RequestParameters(ctx context.Context) (Tier2RequestParameters, bool)

type TracingConf added in v1.1.4

type TracingConf struct {
	ModuleExecution bool
}

func NewTracingConf added in v1.1.4

func NewTracingConf(
	moduleExecution bool,
) *TracingConf

Jump to

Keyboard shortcuts

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