Documentation
¶
Index ¶
- Constants
- func AddEvent(span trace.Span, name string, attrs ...attribute.KeyValue)
- func AudioAttrs(sampleRate, channels, dataSize int, mediaType, codec string) []attribute.KeyValue
- func ConnectionAttrs(connID, connType, state string) []attribute.KeyValue
- func ContextWithSpan(ctx context.Context, span trace.Span) context.Context
- func ErrorAttrs(errType, errMsg string) []attribute.KeyValue
- func GetTracer() trace.Tracer
- func Initialize(ctx context.Context, cfg *Config) error
- func InstrumentAudioProcessing(ctx context.Context, operation string, inputSize, outputSize int) (context.Context, trace.Span)
- func InstrumentConnectionClosed(ctx context.Context, connID, connType string) (context.Context, trace.Span)
- func InstrumentConnectionCreated(ctx context.Context, connID, connType string) (context.Context, trace.Span)
- func InstrumentConnectionError(ctx context.Context, connID, connType string, err error) (context.Context, trace.Span)
- func InstrumentConnectionMessage(ctx context.Context, connID, connType, direction string, dataSize int) (context.Context, trace.Span)
- func InstrumentConnectionStateChange(ctx context.Context, connID, connType, oldState, newState string) (context.Context, trace.Span)
- func InstrumentElementProcess(ctx context.Context, elementName string, msg *pipeline.PipelineMessage) (context.Context, trace.Span)
- func InstrumentElementStart(ctx context.Context, elementName string) (context.Context, trace.Span)
- func InstrumentElementStop(ctx context.Context, elementName string) (context.Context, trace.Span)
- func InstrumentLLMRequest(ctx context.Context, provider, model string) (context.Context, trace.Span)
- func InstrumentLLMResponse(ctx context.Context, provider, model, responseType string, dataSize int) (context.Context, trace.Span)
- func InstrumentPipelinePull(ctx context.Context, pipelineName string) (context.Context, trace.Span)
- func InstrumentPipelinePush(ctx context.Context, pipelineName string, msg *pipeline.PipelineMessage) (context.Context, trace.Span)
- func InstrumentPipelineStart(ctx context.Context, pipelineName string) (context.Context, trace.Span)
- func InstrumentPipelineStop(ctx context.Context, pipelineName string) (context.Context, trace.Span)
- func InstrumentSTTRequest(ctx context.Context, provider string, audioSize int) (context.Context, trace.Span)
- func InstrumentSTTResponse(ctx context.Context, provider, text string) (context.Context, trace.Span)
- func InstrumentTTSRequest(ctx context.Context, provider, voice, text string) (context.Context, trace.Span)
- func InstrumentTTSResponse(ctx context.Context, provider string, audioSize int) (context.Context, trace.Span)
- func InstrumentVideoProcessing(ctx context.Context, operation string, inputSize, outputSize int) (context.Context, trace.Span)
- func LLMAttrs(provider, model string) []attribute.KeyValue
- func LogWithTrace(ctx context.Context, message string) string
- func PipelineAttrs(pipelineName, elementName string) []attribute.KeyValue
- func RecordError(span trace.Span, err error)
- func SessionAttrs(sessionID string) []attribute.KeyValue
- func SetAttributes(span trace.Span, attrs ...attribute.KeyValue)
- func Shutdown(ctx context.Context) error
- func SpanFromContext(ctx context.Context) trace.Span
- func SpanID(ctx context.Context) string
- func StartSpan(ctx context.Context, spanName string, opts ...trace.SpanStartOption) (context.Context, trace.Span)
- func TraceID(ctx context.Context) string
- func VideoAttrs(width, height, dataSize int, mediaType, codec string) []attribute.KeyValue
- func WithSpan(ctx context.Context, spanName string, fn func(context.Context) error, ...) error
- type Config
Constants ¶
const ( // Pipeline attributes AttrPipelineName = "pipeline.name" AttrPipelineElement = "pipeline.element" AttrSessionID = "session.id" AttrMessageType = "message.type" // Audio attributes AttrAudioSampleRate = "audio.sample_rate" AttrAudioChannels = "audio.channels" AttrAudioMediaType = "audio.media_type" AttrAudioCodec = "audio.codec" AttrAudioDataSize = "audio.data_size" // Video attributes AttrVideoWidth = "video.width" AttrVideoHeight = "video.height" AttrVideoMediaType = "video.media_type" AttrVideoCodec = "video.codec" AttrVideoDataSize = "video.data_size" // Connection attributes AttrConnectionID = "connection.id" AttrConnectionType = "connection.type" AttrConnectionState = "connection.state" // AI/LLM attributes AttrLLMProvider = "llm.provider" AttrLLMModel = "llm.model" AttrLLMResponseType = "llm.response_type" // STT/TTS attributes AttrSTTProvider = "stt.provider" AttrTTSProvider = "tts.provider" AttrTTSVoice = "tts.voice" // Error attributes AttrErrorType = "error.type" AttrErrorMessage = "error.message" )
Common attribute keys used throughout the application
const (
// TracerName is the name of the tracer used throughout the application
TracerName = "github.com/realtime-ai/realtime-ai"
)
Variables ¶
This section is empty.
Functions ¶
func AudioAttrs ¶
AudioAttrs creates attributes for audio data
func ConnectionAttrs ¶
ConnectionAttrs creates attributes for connection information
func ContextWithSpan ¶
ContextWithSpan returns a new context with the given span
func ErrorAttrs ¶
ErrorAttrs creates attributes for errors
func Initialize ¶
Initialize sets up the global tracer provider
func InstrumentAudioProcessing ¶
func InstrumentAudioProcessing(ctx context.Context, operation string, inputSize, outputSize int) (context.Context, trace.Span)
InstrumentAudioProcessing creates a span for audio processing operations
func InstrumentConnectionClosed ¶
func InstrumentConnectionClosed(ctx context.Context, connID, connType string) (context.Context, trace.Span)
InstrumentConnectionClosed creates a span for connection closure
func InstrumentConnectionCreated ¶
func InstrumentConnectionCreated(ctx context.Context, connID, connType string) (context.Context, trace.Span)
InstrumentConnectionCreated creates a span for connection creation
func InstrumentConnectionError ¶
func InstrumentConnectionError(ctx context.Context, connID, connType string, err error) (context.Context, trace.Span)
InstrumentConnectionError creates a span for connection errors
func InstrumentConnectionMessage ¶
func InstrumentConnectionMessage(ctx context.Context, connID, connType, direction string, dataSize int) (context.Context, trace.Span)
InstrumentConnectionMessage creates a span for sending/receiving messages over a connection
func InstrumentConnectionStateChange ¶
func InstrumentConnectionStateChange(ctx context.Context, connID, connType, oldState, newState string) (context.Context, trace.Span)
InstrumentConnectionStateChange creates a span for connection state changes
func InstrumentElementProcess ¶
func InstrumentElementProcess(ctx context.Context, elementName string, msg *pipeline.PipelineMessage) (context.Context, trace.Span)
InstrumentElementProcess creates a span for element message processing
func InstrumentElementStart ¶
InstrumentElementStart creates a span for element start
func InstrumentElementStop ¶
InstrumentElementStop creates a span for element stop
func InstrumentLLMRequest ¶
func InstrumentLLMRequest(ctx context.Context, provider, model string) (context.Context, trace.Span)
InstrumentLLMRequest creates a span for LLM requests
func InstrumentLLMResponse ¶
func InstrumentLLMResponse(ctx context.Context, provider, model, responseType string, dataSize int) (context.Context, trace.Span)
InstrumentLLMResponse creates a span for LLM responses
func InstrumentPipelinePull ¶
InstrumentPipelinePull creates a span for pulling a message from the pipeline
func InstrumentPipelinePush ¶
func InstrumentPipelinePush(ctx context.Context, pipelineName string, msg *pipeline.PipelineMessage) (context.Context, trace.Span)
InstrumentPipelinePush creates a span for pushing a message to the pipeline
func InstrumentPipelineStart ¶
func InstrumentPipelineStart(ctx context.Context, pipelineName string) (context.Context, trace.Span)
InstrumentPipelineStart creates a span for pipeline start
func InstrumentPipelineStop ¶
InstrumentPipelineStop creates a span for pipeline stop
func InstrumentSTTRequest ¶
func InstrumentSTTRequest(ctx context.Context, provider string, audioSize int) (context.Context, trace.Span)
InstrumentSTTRequest creates a span for STT (Speech-to-Text) requests
func InstrumentSTTResponse ¶
func InstrumentSTTResponse(ctx context.Context, provider, text string) (context.Context, trace.Span)
InstrumentSTTResponse creates a span for STT responses
func InstrumentTTSRequest ¶
func InstrumentTTSRequest(ctx context.Context, provider, voice, text string) (context.Context, trace.Span)
InstrumentTTSRequest creates a span for TTS (Text-to-Speech) requests
func InstrumentTTSResponse ¶
func InstrumentTTSResponse(ctx context.Context, provider string, audioSize int) (context.Context, trace.Span)
InstrumentTTSResponse creates a span for TTS responses
func InstrumentVideoProcessing ¶
func InstrumentVideoProcessing(ctx context.Context, operation string, inputSize, outputSize int) (context.Context, trace.Span)
InstrumentVideoProcessing creates a span for video processing operations
func LogWithTrace ¶
LogWithTrace returns a formatted string with trace information
func PipelineAttrs ¶
PipelineAttrs creates attributes for pipeline operations
func RecordError ¶
RecordError records an error on a span
func SessionAttrs ¶
SessionAttrs creates attributes for session information
func SetAttributes ¶
SetAttributes sets multiple attributes on a span
func SpanFromContext ¶
SpanFromContext returns the current span from context
func StartSpan ¶
func StartSpan(ctx context.Context, spanName string, opts ...trace.SpanStartOption) (context.Context, trace.Span)
StartSpan is a convenience function to start a new span
func VideoAttrs ¶
VideoAttrs creates attributes for video data
Types ¶
type Config ¶
type Config struct {
// ServiceName is the name of the service
ServiceName string
// ServiceVersion is the version of the service
ServiceVersion string
// Environment is the deployment environment (dev, staging, prod)
Environment string
// ExporterType defines which exporter to use: "stdout", "otlp", or "none"
ExporterType string
// OTLPEndpoint is the endpoint for OTLP exporter (e.g., "localhost:4317")
OTLPEndpoint string
// SamplingRate is the rate at which traces are sampled (0.0 to 1.0)
SamplingRate float64
}
Config holds the configuration for tracing