Help us shape the future of Go! Take the 2026 Go Developer Survey

observe

package
v0.1.7 Latest Latest
Warning

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

Go to latest
Published: Oct 30, 2026 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Overview

Package observe 收集转换耗时与通知投递结果,并渲染成 Prometheus 文本。

这里没有引入 client_golang:服务只需要两组有界基数的指标,而 client_golang 会带来 protobuf 与整套 collector 依赖。标签值全部来自有限集合(通道、格式、 终态、目标名),不会随任务数增长。

Index

Constants

View Source
const (
	ResultSuccess = "success"
	ResultFailure = "failure"
)

通知投递结果标签。

Variables

This section is empty.

Functions

This section is empty.

Types

type Conversion

type Conversion struct {
	Lane  string
	From  string
	To    string
	State string
}

Conversion 是一次转换的标签集合。

type Notification

type Notification struct {
	Target string
	Event  string
	Result string
}

Notification 是一次通知投递尝试的标签集合。

type Registry

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

Registry 并发安全地保存两类指标。

func NewRegistry

func NewRegistry() *Registry

NewRegistry 构造空指标注册表。

func (*Registry) ObserveConversion

func (r *Registry) ObserveConversion(labels Conversion, d time.Duration)

ObserveConversion 记录一次已到达终态的转换耗时。

func (*Registry) ObserveNotification

func (r *Registry) ObserveNotification(labels Notification)

ObserveNotification 记录一次通知投递尝试的结果。

func (*Registry) WritePrometheus

func (r *Registry) WritePrometheus(b *strings.Builder)

WritePrometheus 把指标写入 b。

Jump to

Keyboard shortcuts

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