[Embedding V0] EmbeddingGenerationDatum + child trace node
needs-investigation
# `EmbeddingGenerationDatum` + child trace node
Part of: #5830 (V0 embedding generation).
## Scope
Inside `ResolveEmbeddingsAsync`:
```csharp
using ITrace child = trace.StartChild(
"Embedding Generation",
TraceComponent.Query,
TraceLevel.Info);
child.AddDatum("Embedding Generation Stats", new EmbeddingGenerationDatum(...));
```
## Datum shape
| Field | Notes |
|---|---|
| `int EmbeddingCount` | how many texts were sent. |
| `TimeSpan Latency` | wall-clock around the single `GenerateEmbeddingsAsync` call. |
| `string GeneratorTypeName` | `generator.GetType().FullName`, useful in repro tickets. |
| `IReadOnlyList<string> ParameterKeys` | the `@documentdb-hybridsearchquery-embedding-N` keys, **redacted of any text**. |
## What we explicitly do NOT log
- Raw input text (customer data).
- Returned vectors (customer data + size).
## Trace component decision
V0: reuse `TraceComponent.Query` to keep the `TraceComponent` enum surface stable. Revisit if we need separate filtering. (Note in code comment.)
## Acceptance criteria
- New datum class exists with the fields above.
- Wired through `ResolveEmbeddingsAsync` — unit test asserts the child trace node shows up with the expected count + non-zero latency.
- Privacy review sign-off recorded on the PR before merge.
- `EndToEndTraceWriterBaselineTests` baselines regenerated for hybrid-search test cases that newly contain the embedding step (see #5837).
## Files likely touched
- `Microsoft.Azure.Cosmos/src/Diagnostics/EmbeddingGenerationDatum.cs` (new)
- `Microsoft.Azure.Cosmos/src/Tracing/TraceDatum.cs` and visitors (if a new visitor method is required for serialization to JSON / text traces)
- `Microsoft.Azure.Cosmos/src/Query/Core/EmbeddingGenerationHelper.cs` (call site)
## Dependencies
- `resolve-embeddings` (#5833) — datum is emitted from inside the helper.
关闭于 2026-05-06 1 条评论