internal

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Jan 9, 2025 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrIncorrectRecord = errors.New("接收到错误的记录")

ErrIncorrectRecord 接收到错误记录时返回的错误 返回值:

  • error 错误信息

Functions

func KeyAsAttribute

func KeyAsAttribute(name string, key string) attribute.KeyValue

KeyAsAttribute 将DHT键格式化为合适的跟踪属性 DHT键可以是有效的utf-8或二进制格式,例如当它们来自multihash时 跟踪(特别是OpenTelemetry+grpc导出器)要求字符串属性必须是有效的utf-8 参数:

  • name: string 属性名称
  • key: string DHT键值

返回值:

  • attribute.KeyValue 格式化后的跟踪属性

func StartSpan

func StartSpan(ctx context.Context, name string, opts ...trace.SpanStartOption) (context.Context, trace.Span)

StartSpan 启动一个新的跟踪span 参数:

  • ctx: context.Context 上下文
  • name: string span名称
  • opts: ...trace.SpanStartOption span启动选项

返回值:

  • context.Context 新的上下文
  • trace.Span 新创建的span

Types

type CtxMutex

type CtxMutex chan struct{}

CtxMutex 带上下文的互斥锁

func NewCtxMutex

func NewCtxMutex() CtxMutex

NewCtxMutex 创建一个新的带上下文的互斥锁 返回值:

  • CtxMutex 互斥锁实例

func (CtxMutex) Lock

func (m CtxMutex) Lock(ctx context.Context) error

Lock 获取互斥锁 参数:

  • ctx: context.Context 上下文

返回值:

  • error 错误信息

func (CtxMutex) Unlock

func (m CtxMutex) Unlock()

Unlock 释放互斥锁

type LoggableProviderRecordBytes

type LoggableProviderRecordBytes []byte

LoggableProviderRecordBytes 可记录的提供者记录字节数组

func (LoggableProviderRecordBytes) String

func (lk LoggableProviderRecordBytes) String() string

String 实现Stringer接口,返回格式化的提供者记录字符串 返回值:

  • string 格式化后的提供者记录字符串

type LoggableRecordKeyBytes

type LoggableRecordKeyBytes []byte

LoggableRecordKeyBytes 可记录的字节数组类型记录键

func (LoggableRecordKeyBytes) String

func (lk LoggableRecordKeyBytes) String() string

String 实现Stringer接口,返回格式化的记录键字符串 返回值:

  • string 格式化后的记录键字符串

type LoggableRecordKeyString

type LoggableRecordKeyString string

LoggableRecordKeyString 可记录的字符串类型记录键

func (LoggableRecordKeyString) String

func (lk LoggableRecordKeyString) String() string

String 实现Stringer接口,返回格式化的记录键字符串 返回值:

  • string 格式化后的记录键字符串

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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