util

package
v0.0.0-...-36545ca Latest Latest
Warning

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

Go to latest
Published: Jul 16, 2024 License: Apache-2.0 Imports: 24 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ContextKeyHighlightTracingDisabled contextKey = "HighlightTracingDisabled"
)
View Source
const KafkaBatchWorkerOp = "KafkaBatchWorker"

Variables

This section is empty.

Functions

func ClearTablesInDB

func ClearTablesInDB(db *gorm.DB) error

func CreateAndMigrateTestDB

func CreateAndMigrateTestDB(dbName string) (*gorm.DB, error)

func GenerateRandomString

func GenerateRandomString(length int) string

func GetRuntime

func GetRuntime() (Runtime, Handler)

func JsonStringToStringArray

func JsonStringToStringArray(s string) []*string

func Recover

func Recover()

func RecoverAndCrash

func RecoverAndCrash()

func RestRequest

func RestRequest(url string, method string, request interface{}, response interface{}) error

Slim wrapper around sending a request with arbitrary request/response interfaces.

func RunTestWithDBWipe

func RunTestWithDBWipe(t *testing.T, db *gorm.DB, f func(t *testing.T))

func RunTestWithDBWipeWithName

func RunTestWithDBWipeWithName(t *testing.T, db *gorm.DB, name string, f func(t *testing.T))

func StringContainsAnyOf

func StringContainsAnyOf(str string, substrings []string) bool

Types

type Handler

type Handler string
const (
	ReportStripeUsage        Handler = "report-stripe-usage"
	MigrateDB                Handler = "migrate-db"
	MetricMonitors           Handler = "metric-monitors"
	LogAlerts                Handler = "log-alerts"
	BackfillStackFrames      Handler = "backfill-stack-frames"
	RefreshMaterializedViews Handler = "refresh-materialized-views"
	PublicWorkerMain         Handler = "public-worker-main"
	PublicWorkerBatched      Handler = "public-worker-batched"
	PublicWorkerDataSync     Handler = "public-worker-datasync"
	PublicWorkerTraces       Handler = "public-worker-traces"
	AutoResolveStaleErrors   Handler = "auto-resolve-stale-errors"
)

func (Handler) IsValid

func (lt Handler) IsValid() bool

type MultiSpan

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

func StartSpan

func StartSpan(operationName string, options ...SpanOption) MultiSpan

func StartSpanFromContext

func StartSpanFromContext(ctx context.Context, operationName string, options ...SpanOption) (MultiSpan, context.Context)

func (*MultiSpan) Finish

func (s *MultiSpan) Finish(err ...error)

func (*MultiSpan) SetAttribute

func (s *MultiSpan) SetAttribute(key string, value interface{})

func (*MultiSpan) SetOperationName

func (s *MultiSpan) SetOperationName(name string)

type Runtime

type Runtime string
const (
	All          Runtime = "all"
	AllGraph     Runtime = "graph"
	Worker       Runtime = "worker"
	PublicGraph  Runtime = "public-graph"
	PrivateGraph Runtime = "private-graph"
)

func (Runtime) IsPrivateGraph

func (lt Runtime) IsPrivateGraph() bool

func (Runtime) IsPublicGraph

func (lt Runtime) IsPublicGraph() bool

func (Runtime) IsValid

func (lt Runtime) IsValid() bool

func (Runtime) IsWorker

func (lt Runtime) IsWorker() bool

type SpanConfig

type SpanConfig struct {
	Tags                     []attribute.KeyValue
	HighlightTracingDisabled bool
	SpanKind                 trace.SpanKind
}

type SpanOption

type SpanOption func(cfg *SpanConfig)

func ResourceName

func ResourceName(name string) SpanOption

func Tag

func Tag(key string, name interface{}) SpanOption

func WithHighlightTracingDisabled

func WithHighlightTracingDisabled(disabled bool) SpanOption

func WithSpanKind

func WithSpanKind(kind trace.SpanKind) SpanOption

type Tracer

type Tracer struct {
	graphql.HandlerExtension
	graphql.ResponseInterceptor
	graphql.FieldInterceptor
	// contains filtered or unexported fields
}

func NewTracer

func NewTracer(backend Runtime) Tracer

func (Tracer) ExtensionName

func (t Tracer) ExtensionName() string

func (Tracer) InterceptField

func (t Tracer) InterceptField(ctx context.Context, next graphql.Resolver) (interface{}, error)

func (Tracer) InterceptResponse

func (t Tracer) InterceptResponse(ctx context.Context, next graphql.ResponseHandler) *graphql.Response

func (Tracer) Validate

func (t Tracer) Validate(graphql.ExecutableSchema) error

Jump to

Keyboard shortcuts

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