Commit Graph

18 Commits

Author SHA1 Message Date
Damien Mathieu 8b3a08ca2a
Upgrade OTLP to 1.8.0 (#13758)
This PR upgrades OTLP to 1.8.0.
See
https://github.com/open-telemetry/opentelemetry-proto/releases/tag/v1.8.0

-contrib counterpart coming soon (I will move this out of draft once
both PRs are ready).
2025-09-11 09:05:42 +00:00
Jade Guiton 826dfcda3a
[internal/cmd/pdatagen] Parsing of non-packed primitive arrays (#13730)
#### Description

Protobuf has two possible encodings for a repeated field with wire type
VARINT/I32/I64:
- repeat the field tag for each value (like for repeated fields with
other wire types)
- use a "packed" representation: use a single field tag with wire type
LEN containing all the values

The packed representation is the default, but [the Protobuf
documentation](https://protobuf.dev/programming-guides/encoding/#repeated)
notes that:

> Protocol buffer parsers must be able to parse repeated fields that
were compiled as packed as if they were not packed, and vice versa. This
permits adding [packed=true] to existing fields in a forward- and
backward-compatible way.

The current Protobuf parser generated by pdatagen expects the packed
representation and returns an error if the "unpacked" representation is
provided instead, causing slightly off-spec clients to fail exporting
telemetry to the Collector. This PR fixes that by implementing parsing
of unpacked repeated fields.

#### Link to tracking issue
Fixes #13727

#### Testing

I added a test in `pdata/internal` which "manually" encodes a
`HistogramDataPoint` and an `ExponentialHistogramDataPoint_Buckets`
using unpacked fields, and checks that we successfully unmarshal them.

Profile payloads are also heavily affected, but I didn't add tests for
them to avoid the tests failing when there are breaking changes in the
profile proto.
2025-08-29 17:30:51 +00:00
Bogdan Drutu e5e965c59c
[chore] Use pooling when CopyTo and SetEmpty oneOf fields (#13696)
Updates
https://github.com/open-telemetry/opentelemetry-collector/issues/13631

Signed-off-by: Bogdan Drutu <bogdandrutu@gmail.com>
2025-08-24 16:36:21 +00:00
Bogdan Drutu 213afc4ee7
[chore] Remove TODO about generated code for oneofgroup marshal proto/json and proto size (#13694)
Updates
https://github.com/open-telemetry/opentelemetry-collector/issues/13631

Signed-off-by: Bogdan Drutu <bogdandrutu@gmail.com>
2025-08-23 19:01:47 +00:00
Bogdan Drutu 32f03e9fcd
[chore] Fix oneof delete issue, free up and delete the message (#13695)
Signed-off-by: Bogdan Drutu <bogdandrutu@gmail.com>
2025-08-23 13:42:29 +00:00
Bogdan Drutu cbe449b18a
[chore] Implement pooling support for oneOf messages (#13692)
Updates
https://github.com/open-telemetry/opentelemetry-collector/issues/13631

Signed-off-by: Bogdan Drutu <bogdandrutu@gmail.com>
2025-08-22 23:51:08 +00:00
Bogdan Drutu 313db34110
Optimize CopyTo messages to avoid any copy when same source and destination (#13680)
Signed-off-by: Bogdan Drutu <bogdandrutu@gmail.com>
2025-08-21 11:19:29 +00:00
Bogdan Drutu 6db7374e2f
Add support for local memory pooling for data objects (#13678)
This feature is protected by a featuregate that is not yet enabled and
only marked as alpha. Preliminary results show > 20% CPU performance
improvement and at least 40% allocations improvement. I still need to
generate UnmarshalProto for AnyValue which should improve even more
results.

Signed-off-by: Bogdan Drutu <bogdandrutu@gmail.com>
2025-08-21 03:19:49 +00:00
Bogdan Drutu caed03a4d1
[chore] Move UnmarshalJSON to use the ProtoField to generate (#13675)
Also, this PR improves JSON unmarshal logic by avoiding stack calls
caused by using the Read[Array|Object]CB and replace with simple
non-recursive iterations.

Signed-off-by: Bogdan Drutu <bogdandrutu@gmail.com>
2025-08-19 20:47:42 +00:00
Bogdan Drutu 5d5ada5d6a
[chore] Remove internal.NewOrig* that returns directly the value (#13676)
The only non-test change is in the Unmarshal proto but that generates
exactly the same code using the "defaultValue" for the message.

Signed-off-by: Bogdan Drutu <bogdandrutu@gmail.com>
2025-08-19 19:14:04 +00:00
Bogdan Drutu 6db802a019
[chore] Enhance TestEncodingValues to test for all cases (#13667)
Signed-off-by: Bogdan Drutu <bogdandrutu@gmail.com>
2025-08-19 16:47:43 +00:00
Bogdan Drutu 9b90d9f910
[chore] Generate custom proto unmarshal (#13626)
Benchmark results are in
https://github.com/open-telemetry/opentelemetry-collector/pull/13602

Signed-off-by: Bogdan Drutu <bogdandrutu@gmail.com>
2025-08-14 03:50:41 +00:00
Bogdan Drutu 787ae29ad2
[chore] pdatagen: Change JSON marshal to directly use the ProtoFields (#13616)
Signed-off-by: Bogdan Drutu <bogdandrutu@gmail.com>
2025-08-11 20:40:52 +00:00
Bogdan Drutu c74560c80b
[chore] Generate proto marshal (#13596)
No changelog because this code is not yet publicly exposed in any way.

Signed-off-by: Bogdan Drutu <bogdandrutu@gmail.com>
2025-08-10 07:17:43 +00:00
Bogdan Drutu 64e5220195
[chore] Add support to calculate proto size in pdata (#13592)
Add support to generate the proto Size by pdatagen. Not yet used, will
update after more tests are added.

Signed-off-by: Bogdan Drutu <bogdandrutu@gmail.com>
2025-08-08 17:45:07 +00:00
Bogdan Drutu 56d8c8f8ff
[chore] Move marshal/unmarshal JSON to work with origin (#13581)
Remove the complication about internal/public for all funcs that only
need origin. Also improves significant testing.

This simplified a lot the fields (no more isCommon/isBaseCommon/etc.)

Signed-off-by: Bogdan Drutu <bogdandrutu@gmail.com>
2025-08-06 23:24:03 +00:00
Bogdan Drutu cb546d8654
[chore] Move FillOrigTest to use orig and always in internal (#13578)
This PR allows to add tests for CopyOrig directly in the internal
package, also enables us to move more things to internal (including
tests) for Marshal/Unmarshal.

After this PR is merged we can generate the ProtoSize and other proto
helpers in internal.

Signed-off-by: Bogdan Drutu <bogdandrutu@gmail.com>
2025-08-06 18:30:28 +00:00
Bogdan Drutu 53528d4bfc
[chore] Move CopyOrig funcs all to internal (#13570)
Main idea is to have all funcs that work on "origin" in internal, so
that we simplify access to them (see field access to this). Also will
remove duplicate generated code like copying the slice of KeyValue
(followup PR).

Signed-off-by: Bogdan Drutu <bogdandrutu@gmail.com>
2025-08-05 18:58:04 +00:00