Documentation
¶
Index ¶
- Constants
- Variables
- func DefaultFinishEventProcessor(ctx context.Context, info *consts.FinishEventInfo)
- type BatchQueueManager
- type BatchSpanProcessor
- type Exporter
- type Options
- type Provider
- func (t *Provider) CloseTrace(ctx context.Context)
- func (t *Provider) Flush(ctx context.Context)
- func (t *Provider) GetOpts() *Options
- func (t *Provider) GetSpanFromContext(ctx context.Context) *Span
- func (t *Provider) GetSpanFromHeader(ctx context.Context, header map[string]string) *SpanContext
- func (t *Provider) StartSpan(ctx context.Context, name, spanType string, opts StartSpanOptions) (context.Context, *Span, error)
- type QueueConf
- type QueueManager
- type Span
- func (s *Span) Finish(ctx context.Context)
- func (s *Span) GetBaggage() map[string]string
- func (s *Span) GetDuration() int64
- func (s *Span) GetFinishTime() time.Time
- func (s *Span) GetLogID() string
- func (s *Span) GetParentID() string
- func (s *Span) GetRectifiedMap(ctx context.Context, inputMap map[string]interface{}) (map[string]interface{}, []string, int64)
- func (s *Span) GetServiceName() string
- func (s *Span) GetSpaceID() string
- func (s *Span) GetSpanName() string
- func (s *Span) GetSpanType() string
- func (s *Span) GetStartTime() time.Time
- func (s *Span) GetStatusCode() int32
- func (s *Span) GetTagMap() map[string]interface{}
- func (s *Span) IsRootSpan() bool
- func (s *Span) SetBaggage(ctx context.Context, baggageItems map[string]string)
- func (s *Span) SetBaggageItem(restrictedKey, value string)
- func (s *Span) SetDeploymentEnv(ctx context.Context, deploymentEnv string)
- func (s *Span) SetError(ctx context.Context, err error)
- func (s *Span) SetFinishTime(finishTime time.Time)
- func (s *Span) SetInput(ctx context.Context, input interface{})
- func (s *Span) SetInputTokens(ctx context.Context, inputTokens int)
- func (s *Span) SetLogID(ctx context.Context, logID string)
- func (s *Span) SetMessageID(ctx context.Context, messageID string)
- func (s *Span) SetMessageIDBaggage(ctx context.Context, messageID string)
- func (s *Span) SetModelCallOptions(ctx context.Context, callOptions interface{})
- func (s *Span) SetModelName(ctx context.Context, modelName string)
- func (s *Span) SetModelProvider(ctx context.Context, modelProvider string)
- func (s *Span) SetMultiModalityMap(key string)
- func (s *Span) SetOutput(ctx context.Context, output interface{})
- func (s *Span) SetOutputTokens(ctx context.Context, outputTokens int)
- func (s *Span) SetPrompt(ctx context.Context, prompt entity.Prompt)
- func (s *Span) SetRuntime(ctx context.Context, runtime tracespec.Runtime)
- func (s *Span) SetServiceName(ctx context.Context, serviceName string)
- func (s *Span) SetStartTimeFirstResp(ctx context.Context, startTimeFirstResp int64)
- func (s *Span) SetStatusCode(ctx context.Context, code int)
- func (s *Span) SetSystemTags(ctx context.Context, systemTags map[string]interface{})
- func (s *Span) SetTags(ctx context.Context, tagKVs map[string]interface{})
- func (s *Span) SetThreadID(ctx context.Context, threadID string)
- func (s *Span) SetThreadIDBaggage(ctx context.Context, threadID string)
- func (s *Span) SetUserID(ctx context.Context, userID string)
- func (s *Span) SetUserIDBaggage(ctx context.Context, userID string)
- func (s *Span) ToHeader() (map[string]string, error)
- func (s *Span) UltraLargeReport() bool
- type SpanContext
- type SpanExporter
- type SpanProcessor
- type StartSpanOptions
- type TagTruncateConf
- type UploadPath
- type UploadSpanData
Constants ¶
View Source
const ( KeyTemplateLargeText = "%s_%s_%s_%s_large_text" KeyTemplateMultiModality = "%s_%s_%s_%s_%s" )
View Source
const ( DefaultMaxQueueLength = 1024 DefaultMaxRetryQueueLength = 512 DefaultMaxExportBatchLength = 100 DefaultMaxExportBatchByteSize = 4 * 1024 * 1024 // 4MB MaxRetryExportBatchLength = 50 DefaultScheduleDelay = 1000 // millisecond MaxFileQueueLength = 512 MaxFileExportBatchLength = 1 MaxFileExportBatchByteSize = 100 * 1024 * 1024 // 100MB FileScheduleDelay = 5000 // millisecond )
Defaults for batchQueueManagerOptions.
Variables ¶
View Source
var DefaultNoopSpan = &noopSpan{}
Functions ¶
func DefaultFinishEventProcessor ¶ added in v0.1.9
func DefaultFinishEventProcessor(ctx context.Context, info *consts.FinishEventInfo)
Types ¶
type BatchQueueManager ¶
type BatchQueueManager struct {
// contains filtered or unexported fields
}
BatchQueueManager four queue: span, span retry, file, file retry
func (*BatchQueueManager) Enqueue ¶
func (b *BatchQueueManager) Enqueue(ctx context.Context, sd interface{}, byteSize int64)
func (*BatchQueueManager) ForceFlush ¶
func (b *BatchQueueManager) ForceFlush(ctx context.Context) error
type BatchSpanProcessor ¶
type BatchSpanProcessor struct {
// contains filtered or unexported fields
}
BatchSpanProcessor implements SpanProcessor
func (*BatchSpanProcessor) ForceFlush ¶
func (b *BatchSpanProcessor) ForceFlush(ctx context.Context) error
type Exporter ¶
type Exporter interface {
ExportSpans(ctx context.Context, spans []*entity.UploadSpan) error
ExportFiles(ctx context.Context, files []*entity.UploadFile) error
}
type Provider ¶
type Provider struct {
// contains filtered or unexported fields
}
func NewTraceProvider ¶
func NewTraceProvider(httpClient *httpclient.Client, options Options) *Provider
func (*Provider) CloseTrace ¶
func (*Provider) GetSpanFromContext ¶
func (*Provider) GetSpanFromHeader ¶
type QueueManager ¶
type QueueManager interface {
Enqueue(ctx context.Context, s interface{}, byteSize int64)
Shutdown(ctx context.Context) error
ForceFlush(ctx context.Context) error
}
QueueManager is a queue that batches spans and exports them
type Span ¶
type Span struct {
// span context param
SpanContext
// basic param
SpanType string
Name string
// These params can be changed, but remember locking when changed
ServiceName string
LogID string
WorkspaceID string
ParentSpanID string
StartTime time.Time
FinishTime time.Time
Duration time.Duration
TagMap map[string]interface{} // custom tags
SystemTagMap map[string]interface{} // system tags
StatusCode int32
// contains filtered or unexported fields
}
func (*Span) GetBaggage ¶ added in v0.1.17
func (*Span) GetDuration ¶
func (*Span) GetFinishTime ¶ added in v0.1.9
func (*Span) GetParentID ¶
func (*Span) GetRectifiedMap ¶
func (s *Span) GetRectifiedMap(ctx context.Context, inputMap map[string]interface{}) (map[string]interface{}, []string, int64)
GetRectifiedMap get rectified tag map and cut off keys
func (*Span) GetServiceName ¶ added in v0.1.9
func (*Span) GetSpaceID ¶
func (*Span) GetSpanName ¶
func (*Span) GetSpanType ¶
func (*Span) GetStartTime ¶
func (*Span) GetStatusCode ¶
func (*Span) IsRootSpan ¶ added in v0.1.9
func (*Span) SetBaggage ¶
func (*Span) SetBaggageItem ¶
func (*Span) SetDeploymentEnv ¶ added in v0.1.9
func (*Span) SetFinishTime ¶ added in v0.1.9
SetFinishTime Default is time.Now() when span Finish(). DO NOT set unless you do not use default time.
func (*Span) SetMessageIDBaggage ¶
func (*Span) SetModelCallOptions ¶ added in v0.1.2
func (*Span) SetModelProvider ¶
func (*Span) SetMultiModalityMap ¶
func (*Span) SetOutputTokens ¶
func (*Span) SetRuntime ¶ added in v0.1.5
func (*Span) SetServiceName ¶ added in v0.1.9
func (*Span) SetStartTimeFirstResp ¶
func (*Span) SetSystemTags ¶ added in v0.1.9
func (*Span) SetThreadIDBaggage ¶
func (*Span) UltraLargeReport ¶
type SpanContext ¶
func FromHeader ¶
func FromHeader(ctx context.Context, h map[string]string) *SpanContext
func (*SpanContext) GetBaggage ¶
func (s *SpanContext) GetBaggage() map[string]string
func (*SpanContext) GetSpanID ¶
func (s *SpanContext) GetSpanID() string
func (*SpanContext) GetTraceID ¶
func (s *SpanContext) GetTraceID() string
type SpanExporter ¶
type SpanExporter struct {
// contains filtered or unexported fields
}
func (*SpanExporter) ExportFiles ¶
func (e *SpanExporter) ExportFiles(ctx context.Context, files []*entity.UploadFile) error
func (*SpanExporter) ExportSpans ¶
func (e *SpanExporter) ExportSpans(ctx context.Context, ss []*entity.UploadSpan) (err error)
type SpanProcessor ¶
type SpanProcessor interface {
OnSpanEnd(ctx context.Context, s *Span)
Shutdown(ctx context.Context) error
ForceFlush(ctx context.Context) error
}
func NewBatchSpanProcessor ¶
func NewBatchSpanProcessor( ex Exporter, client *httpclient.Client, uploadPath *UploadPath, finishEventProcessor func(ctx context.Context, info *consts.FinishEventInfo), queueConf *QueueConf, ) SpanProcessor
type StartSpanOptions ¶
type TagTruncateConf ¶ added in v0.1.9
type UploadPath ¶ added in v0.1.9
type UploadPath struct {
// contains filtered or unexported fields
}
type UploadSpanData ¶
type UploadSpanData struct {
Spans []*entity.UploadSpan `json:"spans"`
}
Source Files
¶
Click to show internal directories.
Click to hide internal directories.