tracing

package
v1.0.3 Latest Latest
Warning

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

Go to latest
Published: Aug 2, 2022 License: Apache-2.0 Imports: 35 Imported by: 0

Documentation

Overview

Package tracing provides helpers for dealing with Open Tracing and Distributed Tracing.

Index

Constants

View Source
const (
	// BCryptHashOpName is the operation name for bcrypt hashing operations.
	BCryptHashOpName = "bcrypt.hash"

	// BCryptCompareOpName is the operation name for bcrypt comparation operations.
	BCryptCompareOpName = "bcrypt.compare"

	// BCryptWorkFactorTagName is the operation name for bcrypt workfactor settings.
	BCryptWorkFactorTagName = "bcrypt.workfactor"
)
View Source
const (
	// PKDBF2HashOpName is the operation name for pkdbf2 hashing operations.
	PKDBF2HashOpName = "pkdbf2.hash"

	// PKDBF2CompareOpName is the operation name for pkdbf2 comparation operations.
	PKDBF2CompareOpName = "pkdbf2.compare"

	// PKDBFIterationsTagName is the operation name for pkdbf2 iterations settings.
	PKDBFIterationsTagName = "pkdbf2.iterations"

	// PKDBFKeyLengthTagName is the operation name for pkdbf2 keylength settings.
	PKDBFKeyLengthTagName = "pkdbf2.keylength"
)
View Source
const ConfigSchemaID = "ory://tracing-config"

Variables

View Source
var ConfigSchema string

Functions

func AddConfigSchema

func AddConfigSchema(c interface {
	AddResource(url string, r io.Reader) error
}) error

AddConfigSchema adds the tracing schema to the compiler. The interface is specified instead of `jsonschema.Compiler` to allow the use of any jsonschema library fork or version.

func RoundTripper

func RoundTripper(tracer opentracing.Tracer, delegate http.RoundTripper) http.RoundTripper

Types

type Config

type Config struct {
	ServiceName string           `json:"service_name"`
	Provider    string           `json:"provider"`
	Providers   *ProvidersConfig `json:"providers"`
}

type JaegerConfig

type JaegerConfig struct {
	LocalAgentAddress string          `json:"local_agent_address"`
	Sampling          *JaegerSampling `json:"sampling"`
	Propagation       string          `json:"propagation"`
	MaxTagValueLength int             `json:"max_tag_value_length"`
}

JaegerConfig encapsulates jaeger's configuration.

type JaegerSampling

type JaegerSampling struct {
	Type      string  `json:"type"`
	Value     float64 `json:"value"`
	ServerURL string  `json:"server_url"`
}

type ProvidersConfig

type ProvidersConfig struct {
	Jaeger *JaegerConfig `json:"jaeger"`
	Zipkin *ZipkinConfig `json:"zipkin"`
}

type RoundTripperFunc

type RoundTripperFunc func(req *http.Request) (*http.Response, error)

The RoundTripperFunc type is an adapter to allow the use of ordinary functions as RoundTrippers. If f is a function with the appropriate signature, RountTripperFunc(f) is a RoundTripper that calls f.

func (RoundTripperFunc) RoundTrip

func (rt RoundTripperFunc) RoundTrip(r *http.Request) (*http.Response, error)

RoundTrip implements the RoundTripper interface.

type TracedBCrypt

type TracedBCrypt struct {
	GetWorkFactor func(context.Context) int
}

TracedBCrypt implements the Hasher interface.

func (*TracedBCrypt) Compare

func (b *TracedBCrypt) Compare(ctx context.Context, hash, data []byte) error

Compare returns nil if hash and data match.

func (*TracedBCrypt) Hash

func (b *TracedBCrypt) Hash(ctx context.Context, data []byte) ([]byte, error)

Hash returns the hashed string or an error.

type TracedPKDBF2

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

TracedPKDBF2 implements the Hasher interface.

func NewTracedPKDBF2

func NewTracedPKDBF2(
	Salt []byte,
	GetIterations func(context.Context) int,
	GetKeyLength func(context.Context) int) *TracedPKDBF2

NewTracedPKDBF2 returns a new TracedPKDBF2 instance.

func (*TracedPKDBF2) Compare

func (b *TracedPKDBF2) Compare(ctx context.Context, hash, data []byte) error

Compare returns nil if hash and data match.

func (*TracedPKDBF2) Hash

func (b *TracedPKDBF2) Hash(ctx context.Context, data []byte) ([]byte, error)

Hash returns the hashed string or an error.

type Tracer

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

Tracer encapsulates tracing abilities.

func New

func New(l *logrusx.Logger, c *Config) (*Tracer, error)

func (*Tracer) Close

func (t *Tracer) Close()

Close closes the tracer.

func (*Tracer) IsLoaded

func (t *Tracer) IsLoaded() bool

IsLoaded returns true if the tracer has been loaded.

func (*Tracer) ServeHTTP

func (t *Tracer) ServeHTTP(rw http.ResponseWriter, r *http.Request, next http.HandlerFunc)

func (*Tracer) Tracer

func (t *Tracer) Tracer() opentracing.Tracer

Tracer returns the wrapped tracer

type ZipkinConfig

type ZipkinConfig struct {
	ServerURL string `json:"server_url"`
}

ZipkinConfig encapsulates zipkin's configuration.

Jump to

Keyboard shortcuts

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