Documentation
¶
Index ¶
- Constants
- func InitTracer(t Tracer)
- type MultiSpaceSpanExporter
- type Span
- type SpanImpl
- func (s SpanImpl) Finish(ctx context.Context)
- func (s SpanImpl) GetBaggage() map[string]string
- func (s SpanImpl) GetSpanID() string
- func (s SpanImpl) GetStartTime() time.Time
- func (s SpanImpl) GetTraceID() string
- func (s SpanImpl) SetBaggage(ctx context.Context, baggageItems map[string]string)
- func (s SpanImpl) SetCallType(callType string)
- func (s SpanImpl) SetDeploymentEnv(ctx context.Context, deploymentEnv string)
- func (s SpanImpl) SetError(ctx context.Context, err error)
- func (s SpanImpl) SetFinishTime(finishTime time.Time)
- func (s SpanImpl) SetInput(ctx context.Context, input interface{})
- func (s SpanImpl) SetInputTokens(ctx context.Context, inputTokens int)
- func (s SpanImpl) SetLogID(ctx context.Context, logID string)
- func (s SpanImpl) SetMessageID(ctx context.Context, messageID string)
- func (s SpanImpl) SetMessageIDBaggage(ctx context.Context, messageID string)
- func (s SpanImpl) SetModelCallOptions(ctx context.Context, callOptions interface{})
- func (s SpanImpl) SetModelName(ctx context.Context, modelName string)
- func (s SpanImpl) SetModelProvider(ctx context.Context, modelProvider string)
- func (s SpanImpl) SetOutput(ctx context.Context, output interface{})
- func (s SpanImpl) SetOutputTokens(ctx context.Context, outputTokens int)
- func (s SpanImpl) SetPrompt(ctx context.Context, prompt entity.Prompt)
- func (s SpanImpl) SetRuntime(ctx context.Context, runtime tracespec.Runtime)
- func (s SpanImpl) SetServiceName(ctx context.Context, serviceName string)
- func (s SpanImpl) SetStartTimeFirstResp(ctx context.Context, startTimeFirstResp int64)
- func (s SpanImpl) SetStatusCode(ctx context.Context, code int)
- func (s SpanImpl) SetSystemTags(ctx context.Context, systemTags map[string]interface{})
- func (s SpanImpl) SetTags(ctx context.Context, tagKVs map[string]interface{})
- func (s SpanImpl) SetThreadID(ctx context.Context, threadID string)
- func (s SpanImpl) SetThreadIDBaggage(ctx context.Context, threadID string)
- func (s SpanImpl) SetUserID(ctx context.Context, userID string)
- func (s SpanImpl) SetUserIDBaggage(ctx context.Context, userID string)
- func (s SpanImpl) ToHeader() (map[string]string, error)
- type StartSpanOption
- type StartSpanOptions
- type Tracer
- type TracerImpl
- func (t *TracerImpl) Flush(ctx context.Context)
- func (t *TracerImpl) GetSpanFromContext(ctx context.Context) Span
- func (t *TracerImpl) Inject(ctx context.Context) context.Context
- func (t *TracerImpl) InjectW3CTraceContext(ctx context.Context) map[string]string
- func (t *TracerImpl) StartSpan(ctx context.Context, name, spanType string, opts ...StartSpanOption) (context.Context, Span)
Constants ¶
View Source
const ( CtxKeyEnv = "K_ENV" XttEnv = "x_tt_env" )
View Source
const ( TraceContextHeaderParent = "X-Cozeloop-Traceparent" TraceContextHeaderBaggage = "X-Cozeloop-Tracestate" TraceContextHeaderParentW3C = "traceparent" TraceContextHeaderBaggageW3C = "tracestate" )
trace context header
Variables ¶
This section is empty.
Functions ¶
Types ¶
type MultiSpaceSpanExporter ¶
type MultiSpaceSpanExporter struct{}
func (*MultiSpaceSpanExporter) ExportFiles ¶
func (e *MultiSpaceSpanExporter) ExportFiles(ctx context.Context, files []*entity.UploadFile) error
func (*MultiSpaceSpanExporter) ExportSpans ¶
func (e *MultiSpaceSpanExporter) ExportSpans(ctx context.Context, spans []*entity.UploadSpan) error
type SpanImpl ¶
type SpanImpl struct {
LoopSpan cozeloop.Span
}
func (SpanImpl) GetBaggage ¶
func (SpanImpl) GetStartTime ¶
func (SpanImpl) GetTraceID ¶
func (SpanImpl) SetBaggage ¶
func (SpanImpl) SetCallType ¶
func (SpanImpl) SetDeploymentEnv ¶
func (SpanImpl) SetFinishTime ¶
func (SpanImpl) SetInputTokens ¶
func (SpanImpl) SetMessageID ¶
func (SpanImpl) SetMessageIDBaggage ¶
func (SpanImpl) SetModelCallOptions ¶
func (SpanImpl) SetModelName ¶
func (SpanImpl) SetModelProvider ¶
func (SpanImpl) SetOutputTokens ¶
func (SpanImpl) SetRuntime ¶
func (SpanImpl) SetServiceName ¶
func (SpanImpl) SetStartTimeFirstResp ¶
func (SpanImpl) SetSystemTags ¶
func (SpanImpl) SetThreadIDBaggage ¶
func (SpanImpl) SetUserIDBaggage ¶
type StartSpanOption ¶
type StartSpanOption = func(o *StartSpanOptions)
func WithChildOf ¶
func WithChildOf(childOf cozeloop.SpanContext) StartSpanOption
WithChildOf Set the parent span of the span.
func WithSpanWorkspaceID ¶
func WithSpanWorkspaceID(workspaceID string) StartSpanOption
WithSpanWorkspaceID Set the workspaceID of the span. This field is inner field. You should not set it.
func WithStartNewTrace ¶
func WithStartNewTrace() StartSpanOption
WithStartNewTrace Set the parent span of the span. This field is optional. If specified, start a span of a new trace.
func WithStartTime ¶
func WithStartTime(t time.Time) StartSpanOption
WithStartTime Set the start time of the span. This field is optional. If not specified, the time when StartSpan is called will be used as the default.
type StartSpanOptions ¶
type Tracer ¶
type Tracer interface { // StartSpan Generate a span that automatically links to the previous span in the context. // The start time of the span starts counting from the call of StartSpan. // The generated span will be automatically written into the context. // Subsequent spans that need to be chained should call StartSpan based on the new context. StartSpan(ctx context.Context, name, spanType string, opts ...StartSpanOption) (context.Context, Span) // GetSpanFromContext Get the span from the context. GetSpanFromContext(ctx context.Context) Span // Flush Force the reporting of spans in the queue. Flush(ctx context.Context) // Inject Inject the tracer into the context. Inject(ctx context.Context) context.Context // InjectW3CTraceContext Inject the trace context into W3C trace context specification InjectW3CTraceContext(ctx context.Context) map[string]string }
type TracerImpl ¶
type TracerImpl struct {
cozeloop.Client
}
func (*TracerImpl) Flush ¶
func (t *TracerImpl) Flush(ctx context.Context)
func (*TracerImpl) GetSpanFromContext ¶
func (t *TracerImpl) GetSpanFromContext(ctx context.Context) Span
func (*TracerImpl) InjectW3CTraceContext ¶
func (t *TracerImpl) InjectW3CTraceContext(ctx context.Context) map[string]string
func (*TracerImpl) StartSpan ¶
func (t *TracerImpl) StartSpan(ctx context.Context, name, spanType string, opts ...StartSpanOption) (context.Context, Span)
Click to show internal directories.
Click to hide internal directories.