larry-zy opened a new pull request, #1599:
URL: https://github.com/apache/dubbo-admin/pull/1599

   **Please provide a description of this PR:**
   
   MemoryComponent currently manages backend-specific connection setup 
directly, and model traces do not show the size of the conversation context 
selected for each call. This PR extracts conversation-store construction into a 
dedicated factory and adds numeric context-size observations to model-call 
spans.
   
   - Move backend selection, GORM connection-pool setup, migration, and 
connection ownership into `component/memory/store_factory`; the component holds 
the shared Store contract and a closer.
   - Report `agent.context.message_count`, `agent.context.json_bytes`, and 
`agent.context.estimated_tokens` from the existing per-interaction snapshot, 
including appended tool output.
   - Compute measurements lazily and share the result across observers of one 
event. Unsampled traces skip measurement, and `capture_content: none` continues 
to omit message payloads.
   - Document the estimate as JSON bytes divided by four, excluding prompt 
templates, tool definitions, and provider framing. Actual provider usage 
remains under `gen_ai.usage.*`; encoding failures omit byte/token observations 
instead of affecting the model call.
   
   The existing context-window selection, stable-snapshot behavior, turn 
limits, and retention behavior are preserved. The commits separate backend 
construction from observability so each part can be reviewed independently 
within this PR.
   
   Validation from `ai/`:
   
   - `go test ./...`
   - `go vet ./...`
   - `go test -race ./component/hooks ./component/agent/react/... 
./component/memory/...`
   - `git diff --check`
   
   Regression coverage verifies metadata-only tracing, skipped measurement on 
unsampled spans, actual usage remaining distinct from estimates, structured 
tool payloads and UTF-8 byte measurement, encoding-failure handling, and 
context growth without reloading the Store. Existing backend lifecycle and 
configured-turn-limit tests continue to pass.
   
   **To help us figure out who should review this PR, please put an X in all 
the areas that this PR affects.**
   
   - [x] Docs
   - [ ] Installation
   - [ ] User Experience
   - [ ] Dubboctl
   - [ ] Console
   - [x] Core Component
   
   **Please check any characteristics that apply to this pull request.**
   
   - [x] Includes tests
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to