Files
greptimedb/src/servers
dennis zhuang bbc4c4bf1d perf(otlp): share trace resource and scope attributes (#9253)
* perf(otlp): share trace resource and scope attributes

Parsing an OTLP trace request copied the resource attributes and the
scope attributes once per span. A request with wide resource attributes
kept one full copy per span alive until the rows were built.

Spans and their group now share one `Arc` per resource and per scope.
Empty attributes stay `None`, so a resource or scope without attributes
costs no allocation and no refcounting. v0 takes ownership back when it
encodes, v1 clones attributes item by item instead of rebuilding a Vec,
and v2 borrows the span instead of cloning it for every row.

Column values, attribute order, the `service.name` lookup and the
auxiliary table writes are unchanged.

Signed-off-by: Dennis Zhuang <killme2008@gmail.com>

* perf(otlp): stop copying v1 attribute keys

The v1 row writer rebuilds every column name as `{prefix}.{key}`, so the
key string it cloned from the shared resource and scope attributes was
dropped unused. `resource_attributes.service.name` was also cloned in
full before being skipped for the top level service name column.

Shared attributes are now read in place and only values that reach a row
are copied. Span attributes keep moving their values as before.

Signed-off-by: Dennis Zhuang <killme2008@gmail.com>

---------

Signed-off-by: Dennis Zhuang <killme2008@gmail.com>
2026-09-20 06:18:24 +00:00
..