Documentation
¶
Overview ¶
* Copyright 2025 CloudWeGo Authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License.
Index ¶
- Constants
- func NewTLSCallbackHandler(config ...*TLSConfig) (handler callbacks.Handler, shutdown func(ctx context.Context) error, err error)
- func NewTLSCallbackHandlerFromEnv(cfg *TLSConfig) (handler callbacks.Handler, shutdown func(ctx context.Context) error, err error)
- func NewTLSCallbackHandlerWithOptions(cfg *TLSConfig, opts ...Option) (handler callbacks.Handler, shutdown func(ctx context.Context) error, err error)
- func SetSession(ctx context.Context, opts ...SessionOption) context.Context
- func ValidateTLSConfig(cfg *TLSConfig) error
- type CallbackDataParser
- type Option
- type RequestInfo
- type SessionOption
- type TLSCallbackHandler
- func (h *TLSCallbackHandler) OnEnd(ctx context.Context, info *callbacks.RunInfo, output callbacks.CallbackOutput) context.Context
- func (h *TLSCallbackHandler) OnEndWithStreamOutput(ctx context.Context, info *callbacks.RunInfo, ...) context.Context
- func (h *TLSCallbackHandler) OnError(ctx context.Context, info *callbacks.RunInfo, err error) context.Context
- func (h *TLSCallbackHandler) OnStart(ctx context.Context, info *callbacks.RunInfo, input callbacks.CallbackInput) context.Context
- func (h *TLSCallbackHandler) OnStartWithStreamInput(ctx context.Context, info *callbacks.RunInfo, ...) context.Context
- type TLSConfig
- type TLSHandler
- func NewTLSHandler(config ...*TLSConfig) (*TLSHandler, func(ctx context.Context) error, error)
- func NewTLSHandlerFromEnv(cfg *TLSConfig) (*TLSHandler, func(ctx context.Context) error, error)
- func NewTLSHandlerWithOptions(cfg *TLSConfig, opts ...Option) (*TLSHandler, func(ctx context.Context) error, error)
- func (h *TLSHandler) FinishSpan(ctx context.Context, tracingTags map[string]any) context.Context
- func (h *TLSHandler) FinishSpanWithError(ctx context.Context, tracingTags map[string]any, err error) context.Context
- func (h *TLSHandler) SetSession(ctx context.Context, sessionID, userID string) context.Context
- func (h *TLSHandler) StartSpan(ctx context.Context, spanName string, tracingTags map[string]any) context.Context
- func (h *TLSHandler) StartSpanWithKind(ctx context.Context, spanName string, spanKind trace.SpanKind, ...) context.Context
- type TLSState
- type TLSStateKey
- type TLSStreamInputAsyncKey
- type TLSStreamInputAsyncVal
Constants ¶
const ( DefaultVersion = "1.0.1" DefaultSpanName = "unset" )
Variables ¶
This section is empty.
Functions ¶
func NewTLSCallbackHandler ¶
func NewTLSCallbackHandlerFromEnv ¶
func NewTLSCallbackHandlerFromEnv(cfg *TLSConfig) (handler callbacks.Handler, shutdown func(ctx context.Context) error, err error)
NewTLSCallbackHandlerFromEnv keeps the original API shape for callers already passing a prepared config.
func SetSession ¶
func SetSession(ctx context.Context, opts ...SessionOption) context.Context
func ValidateTLSConfig ¶
Types ¶
type CallbackDataParser ¶
type CallbackDataParser interface {
ParseInput(ctx context.Context, info *callbacks.RunInfo, input callbacks.CallbackInput) (map[string]any, error)
ParseOutput(ctx context.Context, info *callbacks.RunInfo, output callbacks.CallbackOutput) (map[string]any, error)
ParseStreamInput(ctx context.Context, info *callbacks.RunInfo, input *schema.StreamReader[callbacks.CallbackInput]) (map[string]any, error)
ParseStreamOutput(ctx context.Context, info *callbacks.RunInfo, output *schema.StreamReader[callbacks.CallbackOutput]) (map[string]any, error)
}
CallbackDataParser tag parser for trace Implement CallbackDataParser and replace defaultDataParser by WithCallbackDataParser if needed
func NewDefaultDataParser ¶
func NewDefaultDataParser(enableAggrMessageOutput bool) CallbackDataParser
type Option ¶
type Option func(*options)
func WithAggrMessageOutput ¶
WithAggrMessageOutput controls whether streamed chat model output is merged into one completion message. When disabled, each received chunk is exported as an independent completion message.
func WithCallbackDataParser ¶
func WithCallbackDataParser(parser CallbackDataParser) Option
func WithConcatFunction ¶
type RequestInfo ¶
type RequestInfo struct {
Model string
// contains filtered or unexported fields
}
type SessionOption ¶
type SessionOption func(*sessionOptions)
func WithSessionID ¶
func WithSessionID(sessionID string) SessionOption
func WithUserID ¶
func WithUserID(userID string) SessionOption
type TLSCallbackHandler ¶
type TLSCallbackHandler struct {
OtelProvider *opentelemetry.OtelProvider
AppName string
Release string
Tracer trace.Tracer
TLSExporterEnabled bool
// contains filtered or unexported fields
}
TLSCallbackHandler implements callbacks.Handler.
func (*TLSCallbackHandler) OnEnd ¶
func (h *TLSCallbackHandler) OnEnd(ctx context.Context, info *callbacks.RunInfo, output callbacks.CallbackOutput) context.Context
func (*TLSCallbackHandler) OnEndWithStreamOutput ¶
func (h *TLSCallbackHandler) OnEndWithStreamOutput(ctx context.Context, info *callbacks.RunInfo, output *schema.StreamReader[callbacks.CallbackOutput]) context.Context
func (*TLSCallbackHandler) OnStart ¶
func (h *TLSCallbackHandler) OnStart(ctx context.Context, info *callbacks.RunInfo, input callbacks.CallbackInput) context.Context
func (*TLSCallbackHandler) OnStartWithStreamInput ¶
func (h *TLSCallbackHandler) OnStartWithStreamInput(ctx context.Context, info *callbacks.RunInfo, input *schema.StreamReader[callbacks.CallbackInput]) context.Context
type TLSConfig ¶
type TLSConfig struct {
// TLSEndpoint is the TLS OTLP endpoint.
// Example: "tls-cn-beijing.volces.com:4317"
TLSEndpoint string
// AppName is the application name shown in TLS.
AppName string
// TLSOTLPHeader contains OTLP export headers.
TLSOTLPHeader map[string]string
// TLSOTLPHeadersStr is the comma-separated OTLP headers string.
TLSOTLPHeadersStr string
// Release is the version or release identifier.
Release string
// TLSExporterEnabled emits the span names and attributes expected by the
// TLS LogApp dashboard schema. It is opt-in to preserve the
// existing generic TLS callback behavior for current users.
TLSExporterEnabled bool
// TLSLog* configures the TLS Producer SendLogs transport used by the TLS
// integration. When TLSLogTopicID is empty, the existing OTLP transport is
// used even if TLSExporterEnabled is enabled.
TLSLogEndpoint string
TLSLogRegion string
TLSLogTopicID string
TLSLogAPIKey string
TLSLogAccessKeyID string
TLSLogAccessKeySecret string
}
func LoadTLSConfigFromEnv ¶
type TLSHandler ¶
type TLSHandler struct {
*TLSCallbackHandler
}
TLSHandler extends TLSCallbackHandler with manual span controls.
func NewTLSHandler ¶
func NewTLSHandlerFromEnv ¶
NewTLSHandlerFromEnv keeps the original API shape for callers already passing a prepared config.
func (*TLSHandler) FinishSpan ¶
func (*TLSHandler) FinishSpanWithError ¶
func (h *TLSHandler) FinishSpanWithError(ctx context.Context, tracingTags map[string]any, err error) context.Context
FinishSpanWithError finishes a manual span and records err when it is non-nil.
func (*TLSHandler) SetSession ¶
SetSession stores session attributes in ctx.
type TLSStateKey ¶
type TLSStateKey struct{}
type TLSStreamInputAsyncKey ¶
type TLSStreamInputAsyncKey struct{}
type TLSStreamInputAsyncVal ¶
type TLSStreamInputAsyncVal chan struct{}
Source Files
¶
Directories
¶
| Path | Synopsis |
|---|---|
|
Command tls-eino-demo runs a real Eino graph and exports its traces to Volcengine TLS through the eino-ext TLS callback handler.
|
Command tls-eino-demo runs a real Eino graph and exports its traces to Volcengine TLS through the eino-ext TLS callback handler. |