Documentation
¶
Index ¶
- Constants
- Variables
- 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 QueueManager
- type Span
- func (s *Span) Finish(ctx context.Context)
- func (s *Span) GetDuration() int64
- func (s *Span) GetParentID() string
- func (s *Span) GetRectifiedMap(ctx context.Context, inputMap map[string]interface{}) (map[string]interface{}, []string, int64)
- 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) SetBaggage(ctx context.Context, baggageItems map[string]string)
- func (s *Span) SetBaggageItem(restrictedKey, value string)
- func (s *Span) SetError(ctx context.Context, err error)
- func (s *Span) SetInput(ctx context.Context, input interface{})
- func (s *Span) SetInputTokens(ctx context.Context, inputTokens int)
- 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) SetStartTimeFirstResp(ctx context.Context, startTimeFirstResp int64)
- func (s *Span) SetStatusCode(ctx context.Context, code int)
- 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 UploadFile
- type UploadSpan
- type UploadSpanData
Constants ¶
View Source
const ( KeyTemplateLargeText = "%s_%s_%s_%s_large_text" KeyTemplateMultiModality = "%s_%s_%s_%s_%s" )
View Source
const ( DefaultMaxQueueLength = 2048 DefaultMaxExportBatchLength = 512 DefaultMaxExportBatchByteSize = 4 * 1024 * 1024 // 4MB MaxRetryExportBatchLength = 50 DefaultScheduleDelay = 1000 // millisecond MaxFileQueueLength = 512 MaxFileExportBatchLength = 5 MaxFileExportBatchByteSize = 100 * 1024 * 1024 // 100MB FileScheduleDelay = 5000 // millisecond )
Defaults for batchQueueManagerOptions.
Variables ¶
View Source
var DefaultNoopSpan = &noopSpan{}
Functions ¶
This section is empty.
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 []*UploadSpan) error
ExportFiles(ctx context.Context, files []*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
WorkspaceID string
ParentSpanID string
StartTime 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) GetDuration ¶
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) GetSpaceID ¶
func (*Span) GetSpanName ¶
func (*Span) GetSpanType ¶
func (*Span) GetStartTime ¶
func (*Span) GetStatusCode ¶
func (*Span) SetBaggage ¶
func (*Span) SetBaggageItem ¶
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) SetStartTimeFirstResp ¶
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 []*UploadFile) error
func (*SpanExporter) ExportSpans ¶
func (e *SpanExporter) ExportSpans(ctx context.Context, ss []*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(client *httpclient.Client) SpanProcessor
type StartSpanOptions ¶
type UploadFile ¶
type UploadSpan ¶
type UploadSpan struct {
StartedATMicros int64 `json:"started_at_micros"`
SpanID string `json:"span_id"`
ParentID string `json:"parent_id"`
TraceID string `json:"trace_id"`
Duration int64 `json:"duration"`
WorkspaceID string `json:"workspace_id"`
SpanName string `json:"span_name"`
SpanType string `json:"span_type"`
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"`
}
type UploadSpanData ¶
type UploadSpanData struct {
Spans []*UploadSpan `json:"spans"`
}
Source Files
¶
Click to show internal directories.
Click to hide internal directories.