loop_span

package
v0.0.0-...-4b62939 Latest Latest
Warning

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

Go to latest
Published: Mar 2, 2026 License: Apache-2.0 Imports: 27 Imported by: 0

Documentation

Index

Constants

View Source
const (
	AnnotationValueTypeCategory AnnotationValueType = "category" // 等于string
	AnnotationValueTypeString   AnnotationValueType = "string"
	AnnotationValueTypeLong     AnnotationValueType = "long"
	AnnotationValueTypeNumber   AnnotationValueType = "number" // 等于float
	AnnotationValueTypeDouble   AnnotationValueType = "double"
	AnnotationValueTypeBool     AnnotationValueType = "bool"

	AnnotationStatusNormal   AnnotationStatus = "normal"
	AnnotationStatusInactive AnnotationStatus = "inactive"
	AnnotationStatusDeleted  AnnotationStatus = "deleted"

	AnnotationCorrectionTypeLLM    AnnotationCorrectionType = "llm"
	AnnotationCorrectionTypeManual AnnotationCorrectionType = "manual"

	AnnotationTypeAutoEvaluate        AnnotationType = "auto_evaluate"
	AnnotationTypeManualEvaluationSet AnnotationType = "manual_evaluation_set"
	AnnotationTypeManualFeedback      AnnotationType = "manual_feedback"
	AnnotationTypeCozeFeedback        AnnotationType = "coze_feedback"
	AnnotationTypeManualDataset       AnnotationType = "manual_dataset"
	AnnotationTypeOpenAPIFeedback     AnnotationType = "openapi_feedback"

	AnnotationOpenAPIFeedbackFieldPrefix = "feedback_openapi_"
	AnnotationManualFeedbackFieldPrefix  = "manual_feedback_"
)
View Source
const (
	QueryTypeEnumMatch    QueryTypeEnum = "match"
	QueryTypeEnumNotMatch QueryTypeEnum = "not_match"
	QueryTypeEnumEq       QueryTypeEnum = "eq"
	QueryTypeEnumNotEq    QueryTypeEnum = "not_eq"
	QueryTypeEnumLte      QueryTypeEnum = "lte"
	QueryTypeEnumGte      QueryTypeEnum = "gte"
	QueryTypeEnumLt       QueryTypeEnum = "lt"
	QueryTypeEnumGt       QueryTypeEnum = "gt"
	QueryTypeEnumExist    QueryTypeEnum = "exist"
	QueryTypeEnumNotExist QueryTypeEnum = "not_exist"
	QueryTypeEnumIn       QueryTypeEnum = "in"
	QueryTypeEnumNotIn    QueryTypeEnum = "not_in"

	QueryTypeEnumAlwaysTrue QueryTypeEnum = "always_true" // 永远为真的条件, 为了保持语意一致还是需要放入SQL

	QueryAndOrEnumAnd QueryAndOrEnum = "and"
	QueryAndOrEnumOr  QueryAndOrEnum = "or"

	FieldTypeString FieldType = "string"
	FieldTypeLong   FieldType = "long"
	FieldTypeDouble FieldType = "double"
	FieldTypeBool   FieldType = "bool"

	PlatformDefault      PlatformType = "default"
	PlatformCozeLoop     PlatformType = "cozeloop"
	PlatformPrompt       PlatformType = "prompt"
	PlatformEvaluator    PlatformType = "evaluator"
	PlatformEvalTarget   PlatformType = "evaluation_target"
	PlatformOpenAPI      PlatformType = "open_api"
	PlatformCozeWorkflow PlatformType = "coze_workflow"
	PlatformCozeBot      PlatformType = "coze_bot"
	PlatformVeAgentKit   PlatformType = "ve_agentkit"
	PlatformVeADK        PlatformType = "veadk"
	PlatformCallbackAll  PlatformType = "callback_all"

	SpanListTypeRootSpan SpanListType = "root_span"
	SpanListTypeAllSpan  SpanListType = "all_span"
	SpanListTypeLLMSpan  SpanListType = "llm_span"
)
View Source
const (
	SpanFieldStartTime               = "start_time"
	SpanFieldSpanId                  = "span_id"
	SpanFieldSpanName                = "span_name"
	SpanFieldTraceId                 = "trace_id"
	SpanFieldSpaceId                 = "space_id"
	SpanFieldParentID                = "parent_id"
	SpanFieldSpanType                = "span_type"
	SpanFieldCallType                = "call_type"
	SpanFieldPSM                     = "psm"
	SpanFieldLogID                   = "logid"
	SpanFieldInput                   = "input"
	SpanFieldOutput                  = "output"
	SpanFieldMethod                  = "method"
	SpanFieldModelProvider           = "model_provider"
	SpanFieldInputTokens             = "input_tokens"
	SpanFieldOutputTokens            = "output_tokens"
	SpanFieldTokens                  = "tokens"
	SpanFieldStatus                  = "status"
	SpanFieldStatusCode              = "status_code"
	SpanFieldDuration                = "duration"
	SpanFieldObjectStorage           = "object_storage"
	SpanFieldStartTimeFirstResp      = "start_time_first_resp"
	SpanFieldLatencyFirstResp        = "latency_first_resp"
	SpanFieldStartTimeFirstTokenResp = "start_time_first_token_resp"
	SpanFieldLatencyFirstTokenResp   = "latency_first_token_resp"
	SpanFieldReasoningDuration       = "reasoning_duration"
	SpanFieldLogicDeleteDate         = "logic_delete_date"
	SpanFieldMessageID               = "message_id"
	SpanFieldUserID                  = "user_id"
	SpanFieldPromptKey               = "prompt_key"
	SpanFieldTenant                  = "tenant"
	SpanFieldKeyPreviousResponseID   = "previous_response_id"
	SpanFieldKeyResponseID           = "response_id"

	SpanTypePrompt          = "prompt"
	SpanTypeModel           = "model"
	SpanTypeParser          = "parser"
	SpanTypeEmbedding       = "embedding"
	SpanTypeMemory          = "memory"
	SpanTypePlugin          = "plugin"
	SpanTypeFunction        = "function"
	SpanTypeGraph           = "graph"
	SpanTypeRemote          = "remote"
	SpanTypeLoader          = "loader"
	SpanTypeTransformer     = "transformer"
	SpanTypeVectorStore     = "vector_store"
	SpanTypeVectorRetriever = "vector_retriever"
	SpanTypeAgent           = "agent"
	SpanTypeLLMCall         = "LLMCall"

	SpanStatusSuccess = "success"
	SpanStatusError   = "error"

	MaxTagLength       = 50
	MaxKeySize         = 100
	MaxTextSize        = 1024 * 1024
	MaxCommonValueSize = 1024

	CallTypeEvaluator = "Evaluator"
)
View Source
const TagNameJson = "json"

Variables

View Source
var SystemTagKeys = map[string]bool{
	"dc":           true,
	"pod_name":     true,
	"cluster":      true,
	"deploy_stage": true,
	"env":          true,
	"language":     true,
	"runtime":      true,
	"cut_off":      true,
}

Functions

func Compare

func Compare[T cmp.Ordered](val T, values []T, qType QueryTypeEnum) bool

Compare

func CompareBool

func CompareBool(val bool, values []bool, qType QueryTypeEnum) bool

func SizeOfString

func SizeOfString(s string) int

func SizeofSpans

func SizeofSpans(spans SpanList) int

Types

type AgentStep

type AgentStep struct {
	// 基础属性
	ID *string `json:"id,omitempty"`
	// 父ID, trace导入时取parent_span_id
	ParentID *string `json:"parent_id,omitempty"`
	// name,trace导入时取span_name
	Name *string `json:"name,omitempty"`
	// 输入
	Input *string `json:"input,omitempty"`
	// 输出
	Output *string `json:"output,omitempty"`
	// 子节点,agent执行内部经历了哪些步骤
	Steps []*Step `json:"steps"`
	// 系统属性
	Metadata    map[string]string `json:"metadata,omitempty"`
	BasicInfo   *BasicInfo        `json:"basic_info,omitempty"`
	MetricsInfo *MetricsInfo      `json:"metrics_info,omitempty"`
}

type Annotation

type Annotation struct {
	ID              string
	SpanID          string
	TraceID         string
	StartTime       time.Time // start time of span
	WorkspaceID     string
	AnnotationType  AnnotationType
	AnnotationIndex []string
	Key             string
	Value           AnnotationValue
	Reasoning       string
	Corrections     []AnnotationCorrection
	Metadata        any
	Status          AnnotationStatus
	CreatedAt       time.Time
	CreatedBy       string
	UpdatedAt       time.Time
	UpdatedBy       string
	IsDeleted       bool
}

func (*Annotation) CorrectAutoEvaluateScore

func (a *Annotation) CorrectAutoEvaluateScore(score float64, reasoning string, updateBy string)

func (*Annotation) GenID

func (a *Annotation) GenID() error

func (*Annotation) GetAutoEvaluateMetadata

func (a *Annotation) GetAutoEvaluateMetadata() *AutoEvaluateMetadata

func (*Annotation) GetDatasetMetadata

func (a *Annotation) GetDatasetMetadata() *ManualDatasetMetadata

func (*Annotation) ToFornaxAnnotation

func (a *Annotation) ToFornaxAnnotation(ctx context.Context) (fa *annotation.Annotation)

type AnnotationCorrection

type AnnotationCorrection struct {
	Reasoning string                   `json:"reasoning,omitempty"`
	Value     AnnotationValue          `json:"value"`
	Type      AnnotationCorrectionType `json:"type"`
	UpdateAt  time.Time                `json:"update_at"`
	UpdatedBy string                   `json:"updated_by"`
}

type AnnotationCorrectionType

type AnnotationCorrectionType string

type AnnotationList

type AnnotationList []*Annotation

func (AnnotationList) FindByEvaluatorRecordID

func (a AnnotationList) FindByEvaluatorRecordID(evaluatorRecordID int64) (*Annotation, bool)

func (AnnotationList) GetAnnotationTagIDs

func (a AnnotationList) GetAnnotationTagIDs() []string

func (AnnotationList) GetEvaluatorVersionIDs

func (a AnnotationList) GetEvaluatorVersionIDs() []int64

func (AnnotationList) GetUserIDs

func (a AnnotationList) GetUserIDs() []string

func (AnnotationList) Uniq

func (a AnnotationList) Uniq() AnnotationList

type AnnotationManualFeedback

type AnnotationManualFeedback struct {
	TagKeyId   int64  // 标签Key的ID
	TagKeyName string // 标签Key的名称
	TagValueId *int64 // 标签值的名称,自由文本/数值没有ID
	TagValue   string // 显示的标签值
}

type AnnotationStatus

type AnnotationStatus string

type AnnotationType

type AnnotationType string

type AnnotationValue

type AnnotationValue struct {
	ValueType   AnnotationValueType `json:"value_type,omitempty"` // 类型
	LongValue   int64               `json:"long_value,omitempty"`
	StringValue string              `json:"string_value,omitempty"`
	FloatValue  float64             `json:"float_value,omitempty"`
	BoolValue   bool                `json:"bool_value,omitempty"`
}

func NewBoolValue

func NewBoolValue(v bool) AnnotationValue

func NewDoubleValue

func NewDoubleValue(v float64) AnnotationValue

func NewLongValue

func NewLongValue(v int64) AnnotationValue

func NewStringValue

func NewStringValue(v string) AnnotationValue

type AnnotationValueType

type AnnotationValueType string

type Attachment

type Attachment struct {
	Field  string `json:"field"`
	Name   string `json:"name"`
	Type   string `json:"type"`
	TosKey string `json:"tos_key"`
}

type AttrTos

type AttrTos struct {
	InputDataURL   string
	OutputDataURL  string
	MultimodalData map[string]string
}

type AutoEvaluateMetadata

type AutoEvaluateMetadata struct {
	TaskID             int64 `json:"task_id"`
	EvaluatorRecordID  int64 `json:"evaluator_record_id"`
	EvaluatorVersionID int64 `json:"evaluator_version_id"`
}

type BasicInfo

type BasicInfo struct {
	// 单位毫秒
	StartedAt string `json:"started_at"`
	// 单位毫秒
	Duration string `json:"duration"`
	Error    *Error `json:"error,omitempty"`
}

type Error

type Error struct {
	Code int32  `json:"code"`
	Msg  string `json:"msg"`
}

type Field

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

func (*Field) Kind

func (p *Field) Kind() reflect.Kind

func (*Field) Name

func (p *Field) Name() string

func (*Field) Set

func (p *Field) Set(val any) error

func (*Field) TagJson

func (p *Field) TagJson() (alias string, err error)

func (*Field) ValueType

func (p *Field) ValueType() (TagValueType, error)

type FieldOptions

type FieldOptions struct {
	I64List    []int64   `mapstructure:"i64_list" json:"i64_list"`
	F64List    []float64 `mapstructure:"f64_list" json:"f64_list"`
	StringList []string  `mapstructure:"string_list" json:"string_list"`
}

type FieldType

type FieldType string

type FilterField

type FilterField struct {
	FieldName  string            `mapstructure:"field_name" json:"field_name"`
	FieldType  FieldType         `mapstructure:"field_type" json:"field_type"`
	Values     []string          `mapstructure:"values" json:"values"`
	QueryType  *QueryTypeEnum    `mapstructure:"query_type" json:"query_type"`
	QueryAndOr *QueryAndOrEnum   `mapstructure:"query_and_or" json:"query_and_or"`
	SubFilter  *FilterFields     `mapstructure:"sub_filter" json:"sub_filter"`
	IsSystem   bool              `mapstructure:"is_system" json:"is_system"`
	IsCustom   bool              `mapstructure:"is_custom" json:"is_custom"`
	Hidden     bool              `mapstructure:"hidden" json:"hidden"`
	ExtraInfo  map[string]string `mapstructure:"extra_info" json:"extra_info"`
}

func (*FilterField) CheckValue

func (f *FilterField) CheckValue(val any) bool

当前支持特定类型, 满足可用性和可拓展性

func (*FilterField) Satisfied

func (f *FilterField) Satisfied(obj FilterObject) bool

func (*FilterField) SetHidden

func (f *FilterField) SetHidden(hidden bool)

func (*FilterField) Validate

func (f *FilterField) Validate() error

func (*FilterField) ValidateField

func (f *FilterField) ValidateField() error

type FilterFields

type FilterFields struct {
	QueryAndOr   *QueryAndOrEnum `mapstructure:"query_and_or" json:"query_and_or"`
	FilterFields []*FilterField  `mapstructure:"filter_fields" json:"filter_fields"`
}

func CombineFilters

func CombineFilters(filters ...*FilterFields) *FilterFields

func GetModelSpansFilter

func GetModelSpansFilter() *FilterFields

func (*FilterFields) Debug

func (f *FilterFields) Debug() string

func (*FilterFields) Satisfied

func (f *FilterFields) Satisfied(obj FilterObject) bool

func (*FilterFields) Traverse

func (f *FilterFields) Traverse(fn func(f *FilterField) error) error

func (*FilterFields) Validate

func (f *FilterFields) Validate() error

type FilterObject

type FilterObject interface {
	GetFieldValue(fieldName string, isSystem, isCustom bool) any
}

type InputFilter

type InputFilter struct {
	KeyWhiteList []string `mapstructure:"key_white_list" json:"key_white_list"`
	// contains filtered or unexported fields
}

type ManualDatasetMetadata

type ManualDatasetMetadata struct{}

type MetricsInfo

type MetricsInfo struct {
	// 单位毫秒
	LlmDuration *string `json:"llm_duration,omitempty"`
	// 单位毫秒
	ToolDuration *string `json:"tool_duration,omitempty"`
	// Tool错误分布,格式为:错误码-->list<ToolStepID>
	ToolErrors map[int32][]string `json:"tool_errors,omitempty"`
	// Tool错误率
	ToolErrorRate *float64 `json:"tool_error_rate,omitempty"`
	// Model错误分布,格式为:错误码-->list<ModelStepID>
	ModelErrors map[int32][]string `json:"model_errors,omitempty"`
	// Model错误率
	ModelErrorRate *float64 `json:"model_error_rate,omitempty"`
	// Tool Step占比(分母是总子Step)
	ToolStepProportion *float64 `json:"tool_step_proportion,omitempty"`
	// 输入token数
	InputTokens *int32 `json:"input_tokens,omitempty"`
	// 输出token数
	OutputTokens *int32 `json:"output_tokens,omitempty"`
}

type ModelInfo

type ModelInfo struct {
	InputTokens               int64  `json:"input_tokens"`
	OutputTokens              int64  `json:"output_tokens"`
	LatencyFirstResp          string `json:"latency_first_resp"` // 单位毫秒
	ReasoningTokens           int64  `json:"reasoning_tokens"`
	InputReadCachedTokens     int64  `json:"input_read_cached_tokens"`
	InputCreationCachedTokens int64  `json:"input_creation_cached_tokens"`
}

type ObjectStorage

type ObjectStorage struct {
	InputTosKey  string        `json:"input_tos_key"`
	OutputTosKey string        `json:"output_tos_key"`
	Attachments  []*Attachment `json:"Attachments"`
}

type OutputFilter

type OutputFilter struct {
	KeyWhiteList []string `mapstructure:"key_white_list" json:"key_white_list"`
	// contains filtered or unexported fields
}

type PlatformType

type PlatformType string

type QueryAndOrEnum

type QueryAndOrEnum string

type QueryTypeEnum

type QueryTypeEnum string

type RootStep

type RootStep struct {
	// 唯一ID,trace导入时取span_id
	ID *string `json:"id,omitempty"`
	// name,trace导入时取span_name
	Name *string `json:"name,omitempty"`
	// 输入
	Input *string `json:"input,omitempty"`
	// 输出
	Output *string `json:"output,omitempty"`
	// 系统属性
	Metadata    map[string]string `json:"metadata,omitempty"`
	BasicInfo   *BasicInfo        `json:"basic_info,omitempty"`
	MetricsInfo *MetricsInfo      `json:"metrics_info,omitempty"`
}

type Span

type Span struct {
	StartTime      int64  `json:"start_time"` // us
	SpanID         string `json:"span_id"`
	ParentID       string `json:"parent_id"`
	TraceID        string `json:"trace_id"`
	DurationMicros int64  `json:"duration_micros"` // us
	CallType       string `json:"call_type"`
	PSM            string `json:"psm"`
	LogID          string `json:"log_id"`
	WorkspaceID    string `json:"space_id"`
	SpanName       string `json:"span_name"`
	SpanType       string `json:"span_type"`
	Method         string `json:"method"`
	StatusCode     int32  `json:"status_code"`
	Input          string `json:"input"`
	Output         string `json:"output"`
	ObjectStorage  string `json:"object_storage"`

	SystemTagsString map[string]string  `json:"system_tags_string"`
	SystemTagsLong   map[string]int64   `json:"system_tags_long"`
	SystemTagsDouble map[string]float64 `json:"system_tags_double"`

	TagsString map[string]string  `json:"tags_string"`
	TagsLong   map[string]int64   `json:"tags_long"`
	TagsDouble map[string]float64 `json:"tags_double"`

	TagsBool map[string]bool   `json:"tags_bool"`
	TagsByte map[string]string `json:"tags_byte"`

	AttrTos         *AttrTos       `json:"-"`
	LogicDeleteTime int64          `json:"-"` // us
	Annotations     AnnotationList `json:"-"`
}

func (*Span) AddAnnotation

func (s *Span) AddAnnotation(annotation *Annotation)

func (*Span) AddAutoEvalAnnotation

func (s *Span) AddAutoEvalAnnotation(taskID, evaluatorRecordID, evaluatorVersionID int64, score float64, reasoning, userID string) (*Annotation, error)

func (*Span) AddManualDatasetAnnotation

func (s *Span) AddManualDatasetAnnotation(datasetID int64, userID string, annotationType AnnotationType) (*Annotation, error)

func (*Span) BuildFeedback

func (s *Span) BuildFeedback(t AnnotationType, key string, value AnnotationValue, reasoning, userID string, deleted bool) (*Annotation, error)

func (*Span) ClipSpan

func (s *Span) ClipSpan()

func (*Span) ExtractByJsonpath

func (s *Span) ExtractByJsonpath(ctx context.Context, key string, jsonpath string) (string, error)

ExtractByJsonpath 从Span的Input/Output/Tags中提取数据,根据jsonpath返回结果。时间戳按毫秒返回。

func (*Span) GetCustomTags

func (s *Span) GetCustomTags() map[string]string

func (*Span) GetFieldValue

func (s *Span) GetFieldValue(fieldName string, isSystem, isCustom bool) any

filter使用, 当前只支持特定参数,后续有需要可拓展到其他参数

func (*Span) GetSystemTags

func (s *Span) GetSystemTags() map[string]string

func (*Span) GetTTL

func (s *Span) GetTTL(ctx context.Context) TTL

func (*Span) GetTenant

func (s *Span) GetTenant() string

func (*Span) IsModelSpan

func (s *Span) IsModelSpan() bool

func (*Span) IsResponseAPISpan

func (s *Span) IsResponseAPISpan() bool

func (*Span) IsValidSpan

func (s *Span) IsValidSpan() error

func (*Span) MergeHistoryContext

func (s *Span) MergeHistoryContext(ctx context.Context, historySpans []*Span)

type SpanList

type SpanList []*Span

func (SpanList) FilterSpans

func (s SpanList) FilterSpans(f *FilterFields) SpanList

func (SpanList) GetAnnotationTagIDs

func (s SpanList) GetAnnotationTagIDs() []string

func (SpanList) GetEvaluatorVersionIDs

func (s SpanList) GetEvaluatorVersionIDs() []int64

func (SpanList) GetUserIDs

func (s SpanList) GetUserIDs() []string

func (SpanList) SetAnnotations

func (s SpanList) SetAnnotations(annotations AnnotationList)

func (SpanList) SortByStartTime

func (s SpanList) SortByStartTime(desc bool)

func (SpanList) Stat

func (s SpanList) Stat(ctx context.Context) (inputTokens, outputTokens int64, err error)

func (SpanList) Uniq

func (s SpanList) Uniq() SpanList

type SpanListType

type SpanListType string

type SpanTransCfgList

type SpanTransCfgList []*SpanTransConfig

span trans handler config

{
	"platform_cfg": {
		"cozeloop": [
				{
					"span_filter": {
						"query_and_or": 1,
						"filter_fields": []
					},
					"is_filter_tag": true,
					"tag_key_black_list": ["a"]
				}
		],
		"prompt": {}
	}
}

func (SpanTransCfgList) Transform

func (p SpanTransCfgList) Transform(ctx context.Context, spans SpanList) (SpanList, error)

type SpanTransConfig

type SpanTransConfig struct {
	SpanFilter   *FilterFields `mapstructure:"span_filter" json:"span_filter"`
	TagFilter    *TagFilter    `mapstructure:"tag_filter" json:"tag_filter"`
	InputFilter  *InputFilter  `mapstructure:"input_filter" json:"input_filter"`
	OutputFilter *OutputFilter `mapstructure:"output_filter" json:"output_filter"`
	// contains filtered or unexported fields
}

type Step

type Step struct {
	// 基础属性
	ID *string `json:"id,omitempty"`
	// 父ID, trace导入时取parent_span_id
	ParentID *string `json:"parent_id,omitempty"`
	// 类型
	Type *StepType `json:"type,omitempty"`
	// name,trace导入时取span_name
	Name *string `json:"name,omitempty"`
	// 输入
	Input *string `json:"input,omitempty"`
	// 输出
	Output *string `json:"output,omitempty"`
	// 各种类型补充信息
	ModelInfo *ModelInfo `json:"model_info,omitempty"`
	// 系统属性
	Metadata  map[string]string `json:"metadata,omitempty"`
	BasicInfo *BasicInfo        `json:"basic_info,omitempty"`
}

type StepType

type StepType = string
const (
	StepTypeAgent StepType = "agent"
	StepTypeModel StepType = "model"
	StepTypeTool  StepType = "tool"
)

type StringWrapper

type StringWrapper struct {
	Role    string `json:"role"`
	Content string `json:"content"`
	Type    string `json:"type"`
}

type Struct

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

func NewStruct

func NewStruct(s any) *Struct

func (*Struct) Fields

func (s *Struct) Fields() []*Field

type TTL

type TTL string
const (
	TTL3d   TTL = "3d"
	TTL7d   TTL = "7d"
	TTL30d  TTL = "30d"
	TTL90d  TTL = "90d"
	TTL180d TTL = "180d"
	TTL365d TTL = "365d"
)

func TTLFromInteger

func TTLFromInteger(i int64) TTL

type Tag

type Tag struct {
	ValueType TagValueType
	Key       string
	Value     *TagValue
}

func NewBoolTag

func NewBoolTag(key string, val bool) *Tag

func NewDoubleTag

func NewDoubleTag(key string, val float64) *Tag

func NewLongTag

func NewLongTag(key string, val int64) *Tag

func NewStringTag

func NewStringTag(key, val string) *Tag

func SetTag

func SetTag(tagKey string, tagType TagValueType, tagValue any) (tag *Tag)

func (Tag) GetKey

func (t Tag) GetKey() string

func (Tag) GetStringValue

func (t Tag) GetStringValue() (string, error)

func (Tag) GetTagType

func (t Tag) GetTagType() TagValueType

func (Tag) IsSetValue

func (t Tag) IsSetValue() bool

type TagFilter

type TagFilter struct {
	KeyBlackList []string `mapstructure:"key_black_list" json:"key_black_list"`
	// contains filtered or unexported fields
}

type TagValue

type TagValue struct {
	VBool   *bool
	VLong   *int64
	VDouble *float64
	VStr    *string
}

type TagValueType

type TagValueType int
const (
	TagValueTypeUnknown TagValueType = 1
	TagValueTypeBool    TagValueType = 2
	TagValueTypeInt64   TagValueType = 3
	TagValueTypeFloat64 TagValueType = 4
	TagValueTypeString  TagValueType = 5
)

func (TagValueType) String

func (p TagValueType) String() string

type TraceAdvanceInfo

type TraceAdvanceInfo struct {
	TraceId    string
	InputCost  int64
	OutputCost int64
}

type Trajectory

type Trajectory struct {
	// trace_id
	ID *string `json:"id,omitempty"`
	// 根节点,记录整个轨迹的信息
	RootStep *RootStep `json:"root_step,omitempty"`
	// agent step列表,记录轨迹中agent执行信息
	AgentSteps []*AgentStep `json:"agent_steps"`
}

func BuildTrajectoryFromSpans

func BuildTrajectoryFromSpans(spanList SpanList) *Trajectory

func (*Trajectory) MarshalString

func (t *Trajectory) MarshalString() (string, error)

type TrajectoryList

type TrajectoryList []*Trajectory

Jump to

Keyboard shortcuts

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