observability

package
v1.2.12 Latest Latest
Warning

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

Go to latest
Published: Sep 11, 2026 License: MIT Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var AsyncTaskDurationSeconds = promauto.NewHistogramVec(
	prometheus.HistogramOpts{
		Name:    "asynctask_task_duration_seconds",
		Help:    "Time spent processing an asynctask message",
		Buckets: taskDurationBuckets,
	},
	[]string{"task_name", "queue", "status"},
)

AsyncTaskDurationSeconds 与 Python coast 库的 ASYNC_TASK_DURATION_SECONDS 同名同 label,可以在同一个 Prometheus/Grafana 查询里合并两边的数据; 两边 buckets 不同,跨语言做 histogram_quantile 时需要留意分位数偏差。 包级 var,Go 保证进程内只初始化一次——即便同一个 extension 类型有多个实例 (如 one_asynctask_/two_asynctask_)反复 Init 也不会重复 promauto 注册导致 panic。

View Source
var BusTaskDurationSeconds = promauto.NewHistogramVec(
	prometheus.HistogramOpts{
		Name:    "bus_task_duration_seconds",
		Help:    "Time spent processing a bus message",
		Buckets: taskDurationBuckets,
	},
	[]string{"task_name", "queue", "status"},
)

BusTaskDurationSeconds 与 Python coast 库的 BUS_TASK_DURATION_SECONDS 同名同 label。

Functions

func ApmTracer added in v1.2.5

func ApmTracer() *apm.Tracer

func ChildOnlyTracerProvider added in v1.2.12

func ChildOnlyTracerProvider() trace.TracerProvider

ChildOnlyTracerProvider 返回一个只在 ctx 里已有「有效且已采样」的父级时才真正开 span 的 TracerProvider;ctx 里没有父级(k8s 探针、后台 goroutine、没装 traceparent 提取拦截器的 gRPC handler)时返回 non-recording span:不记录、不发送。

语义与 entext 的 otelsql SpanFilter、observability/redisotelv6 一致。给 go-redis v9 官方 redisotel 这类没有 SpanFilter 的插桩用:它把根 span 交给全局 provider,而全局 provider 的 默认采样器 ParentBased(AlwaysSample) 会把根 span 100% 记录并发送——完全绕过 istio 的头采样, 每条 Redis 命令都变成一条独立的孤儿 trace。

底层 tracer 在每次 Start 时从全局 provider 取,所以扩展 Init 早于 otel.SetTracerProvider 也不会拿到过期的 provider。

func GetApmEnable added in v1.2.5

func GetApmEnable() bool

func GetOtelEnable added in v1.2.5

func GetOtelEnable() bool

func Initialize added in v1.2.5

func Initialize() func(ctx context.Context) error

Types

This section is empty.

Directories

Path Synopsis
Package redisotelv6 为 go-redis v6 客户端提供 OpenTelemetry 链路追踪。
Package redisotelv6 为 go-redis v6 客户端提供 OpenTelemetry 链路追踪。

Jump to

Keyboard shortcuts

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