11package logging
22
3+ // TraceConfig represents the configuration for a trace
34type TraceConfig struct {
45 Id string `json:"id"`
56 SpanId * string `json:"spanId,omitempty"`
@@ -8,11 +9,13 @@ type TraceConfig struct {
89 SessionId * string
910}
1011
12+ // Trace represents a trace in the logging system
1113type Trace struct {
1214 * eventEmitter
1315 SessionId * string
1416}
1517
18+ // newTrace creates a new trace
1619func newTrace (c * TraceConfig , w * writer ) * Trace {
1720 t := & Trace {
1821 eventEmitter : & eventEmitter {
@@ -31,6 +34,7 @@ func newTrace(c *TraceConfig, w *writer) *Trace {
3134 return t
3235}
3336
37+ // AddGeneration adds a generation to the trace
3438func (t * Trace ) AddGeneration (c * GenerationConfig ) * Generation {
3539 g := newGeneration (c , t .writer )
3640 gData := g .data ()
@@ -39,10 +43,12 @@ func (t *Trace) AddGeneration(c *GenerationConfig) *Generation {
3943 return g
4044}
4145
46+ // SetFeedback adds a feedback to the trace
4247func (t * Trace ) SetFeedback (f * Feedback ) {
4348 t .commit ("add-feedback" , f )
4449}
4550
51+ // AddSpan adds a span to the trace
4652func (t * Trace ) AddSpan (c * SpanConfig ) * Span {
4753 s := newSpan (c , t .writer )
4854 sData := s .data ()
@@ -51,6 +57,7 @@ func (t *Trace) AddSpan(c *SpanConfig) *Span {
5157 return s
5258}
5359
60+ // AddRetrieval adds a retrieval to the trace
5461func (t * Trace ) AddRetrieval (c * RetrievalConfig ) * Retrieval {
5562 r := newRetrieval (c , t .writer )
5663 rData := r .data ()
0 commit comments