startMemorySpan opens a small INTERNAL span for a memory CRUD operation. op is recorded as `cagent.memory.op` and the span name is `memory.{op}`. Conversation id flows in via baggage so the span lands on the right session timeline.
(ctx context.Context, op string)
| 28 | // `memory.{op}`. Conversation id flows in via baggage so the span lands |
| 29 | // on the right session timeline. |
| 30 | func startMemorySpan(ctx context.Context, op string) (context.Context, trace.Span) { |
| 31 | tracer := otel.Tracer("github.com/docker/docker-agent/pkg/memory/database/sqlite") |
| 32 | attrs := []attribute.KeyValue{ |
| 33 | attribute.String("cagent.memory.op", op), |
| 34 | } |
| 35 | if convID := genai.ConversationIDFromContext(ctx); convID != "" { |
| 36 | attrs = append(attrs, attribute.String(genai.AttrConversationID, convID)) |
| 37 | } |
| 38 | return tracer.Start(ctx, "memory."+op, |
| 39 | trace.WithSpanKind(trace.SpanKindInternal), |
| 40 | trace.WithAttributes(attrs...), |
| 41 | ) |
| 42 | } |
| 43 | |
| 44 | type MemoryDatabase struct { |
| 45 | path string |
no test coverage detected