MCPcopy
hub / github.com/docker/docker-agent / startMemorySpan

Function startMemorySpan

pkg/memory/database/sqlite/sqlite.go:30–42  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

28// `memory.{op}`. Conversation id flows in via baggage so the span lands
29// on the right session timeline.
30func 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
44type MemoryDatabase struct {
45 path string

Callers 4

AddMemoryMethod · 0.85
GetMemoriesMethod · 0.85
DeleteMemoryMethod · 0.85
UpdateMemoryMethod · 0.85

Calls 3

StartMethod · 0.65
StringMethod · 0.45

Tested by

no test coverage detected