resource

package
v0.0.131 Latest Latest
Warning

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

Go to latest
Published: Jan 3, 2024 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	CallerMethodKey = attribute.Key("caller_method") // caller method
	CalleeMethodKey = attribute.Key("callee_method") // callee method
	PodIpKey        = attribute.Key("pod_ip")        // pod ip
	ServerNameKey   = attribute.Key("server_name")   // server name
	ErrorCodeKey    = attribute.Key("error_code")    // error code
)

dims

View Source
var (
	DefaultMetricMonitor = NewMetricMonitor()
)
View Source
var OpentelemetryDimsKey = "opentelemetry_dims_key"
View Source
var OpentelemetryMetricsKey = "opentelemetry_metrics_key"

Functions

func AddAttrKeysContext added in v0.0.124

func AddAttrKeysContext(ctx context.Context) context.Context

func AddKeysContext added in v0.0.124

func AddKeysContext(ctx context.Context, ops ...AddKeyContexFunc) context.Context

func AddMetricKeysContext added in v0.0.124

func AddMetricKeysContext(ctx context.Context) context.Context

func AppendAttrsContext added in v0.0.124

func AppendAttrsContext(ctx context.Context, values ...string) context.Context

func AppendMetricCountContext added in v0.0.124

func AppendMetricCountContext(ctx context.Context, values ...string) context.Context

func Attrs

func Attrs(dim Dimension) []attribute.KeyValue

func ExtractAttrsWithContext added in v0.0.124

func ExtractAttrsWithContext(ctx context.Context) []attribute.KeyValue

func GlobalMeter added in v0.0.124

func GlobalMeter() metric.Meter

func ReportBusinessMetric added in v0.0.124

func ReportBusinessMetric(ctx context.Context, attrs []attribute.KeyValue)

func ReportMetric added in v0.0.102

func ReportMetric(ctx context.Context, dim Dimension, costTime time.Duration)

func UpdateAttrsContext added in v0.0.124

func UpdateAttrsContext(ctx context.Context, values map[string]interface{}) error

func UpdateMetricContext added in v0.0.124

func UpdateMetricContext(ctx context.Context, values map[string]interface{}) error

Types

type AddKeyContexFunc added in v0.0.124

type AddKeyContexFunc func(ctx context.Context) context.Context

type Dimension

type Dimension struct {
	CalleeMethod string
	Error        error
}

type HandlerWithContext added in v0.0.105

type HandlerWithContext[REQ any, RESP any] func(context.Context, REQ) (RESP, error)

type MetricMonitor

type MetricMonitor struct {
	TotalReqCounter   syncint64.Counter
	FailCntCounter    syncint64.Counter
	CostTimeHistogram syncfloat64.Histogram

	BusinessCounters map[string]syncint64.Counter

	BusinessHistogram map[string]syncfloat64.Histogram
	// contains filtered or unexported fields
}

func NewMetricMonitor

func NewMetricMonitor() *MetricMonitor

func (*MetricMonitor) GetOrNewBusinessCounter added in v0.0.124

func (m *MetricMonitor) GetOrNewBusinessCounter(key string) (syncint64.Counter, error)

func (*MetricMonitor) GetOrNewBusinessHistogram added in v0.0.124

func (m *MetricMonitor) GetOrNewBusinessHistogram(key string) (syncfloat64.Histogram, error)

Jump to

Keyboard shortcuts

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