diff --git a/CHANGLOG.md b/CHANGLOG.md index 2cbdf1b..1e43543 100644 --- a/CHANGLOG.md +++ b/CHANGLOG.md @@ -1,3 +1,7 @@ +## [0.1.16] - 2025-11-10 +### Fixed +- fix baggage escape problem + ## [0.1.15] - 2025-10-23 ### Added - support set spanID when StartSpan diff --git a/internal/trace/span.go b/internal/trace/span.go index fe467d9..e1e7099 100644 --- a/internal/trace/span.go +++ b/internal/trace/span.go @@ -742,10 +742,10 @@ func (s *Span) SetBaggage(ctx context.Context, baggageItems map[string]string) { return } - s.setBaggage(ctx, baggageItems, true) + s.setBaggage(ctx, baggageItems) } -func (s *Span) setBaggage(ctx context.Context, baggageItems map[string]string, escape bool) { +func (s *Span) setBaggage(ctx context.Context, baggageItems map[string]string) { if s == nil { return } @@ -760,10 +760,6 @@ func (s *Span) setBaggage(ctx context.Context, baggageItems map[string]string, e s.SetTags(ctx, map[string]interface{}{key: value}) newKey := key newValue := value - if escape { - newKey = url.QueryEscape(key) - newValue = url.QueryEscape(value) - } s.SetBaggageItem(newKey, newValue) } } @@ -928,7 +924,7 @@ func (s *Span) toHeaderBaggage() (string, error) { tempV := v // empty key or value is invalid if tempK != "" && tempV != "" { - m[tempK] = tempV + m[url.QueryEscape(tempK)] = url.QueryEscape(tempV) } } return util.MapToStringString(m), nil diff --git a/internal/trace/trace.go b/internal/trace/trace.go index c73f258..6e7f806 100644 --- a/internal/trace/trace.go +++ b/internal/trace/trace.go @@ -190,7 +190,7 @@ func (t *Provider) startSpan(ctx context.Context, spanName string, spanType stri } // 3. set Baggage from parent span - s.setBaggage(ctx, options.Baggage, false) + s.setBaggage(ctx, options.Baggage) return s } diff --git a/internal/version.go b/internal/version.go index 9cd80d7..8e0c3ac 100644 --- a/internal/version.go +++ b/internal/version.go @@ -5,5 +5,5 @@ package internal // Version returns the version of the loop package. func Version() string { - return "v0.1.15" + return "v0.1.16" } diff --git a/spec/tracespec/model.go b/spec/tracespec/model.go index f4a93bc..c5b5d4c 100644 --- a/spec/tracespec/model.go +++ b/spec/tracespec/model.go @@ -7,13 +7,15 @@ import "encoding/json" // ModelInput is the input for model span, for tag key: input type ModelInput struct { - Messages []*ModelMessage `json:"messages,omitempty"` - Tools []*ModelTool `json:"tools,omitempty"` - ModelToolChoice *ModelToolChoice `json:"tool_choice,omitempty"` + Messages []*ModelMessage `json:"messages,omitempty"` + Tools []*ModelTool `json:"tools,omitempty"` + ModelToolChoice *ModelToolChoice `json:"tool_choice,omitempty"` + PreviousResponseID string `json:"previous_response_id,omitempty"` } // ModelOutput is the output for model span, for tag key: output type ModelOutput struct { + ID string `json:"id,omitempty"` Choices []*ModelChoice `json:"choices"` }