Commit Graph

12 Commits

Author SHA1 Message Date
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 65c94c6e50
[chore] Merge 2 slice auto-generated tests and extend to cover all cases (#13529)
Signed-off-by: Bogdan Drutu <bogdandrutu@gmail.com>
2025-07-30 14:27:45 +00:00
Bogdan Drutu 9b8207fb4d
Improve RemoveIf for slices to not reference anymore the removed memory (#13522)
Signed-off-by: Bogdan Drutu <bogdandrutu@gmail.com>
2025-07-29 21:03:24 +00:00
Bogdan Drutu 79e6823db2
Fix null pointer access when copying into a slice with larger cap but smaller len (#13523)
Signed-off-by: Bogdan Drutu <bogdandrutu@gmail.com>
2025-07-29 19:01:54 +00:00
Bogdan Drutu 3c0fd3946f
[chore] Change to auto-generate UnmarshalJSON logic with pdatagen for slices (#13503)
Signed-off-by: Bogdan Drutu <bogdandrutu@gmail.com>
2025-07-28 20:24:31 +00:00
Bogdan Drutu 9b036ad72f
Extract pdatagen as standalone tool/package (#13398)
Updates
https://github.com/open-telemetry/opentelemetry-collector/issues/12747

Removes one source of DCE disable which is the usage of text/template.

Signed-off-by: Bogdan Drutu <bogdandrutu@gmail.com>
2025-07-15 19:25:33 +00:00
Bogdan Drutu bc57119b6b
Fix MoveTo when moving to the same destination (#12898)
<!--Ex. Fixing a bug - Describe the bug and how this fixes the issue.
Ex. Adding a feature - Explain what this achieves.-->
#### Description

Moving the data between same source and destination causes the
destination to be cleared.

<!-- Issue number if applicable -->
#### Link to tracking issue
Fixes #12887

Signed-off-by: Bogdan Drutu <bogdandrutu@gmail.com>
2025-04-22 14:23:27 +00:00
Mauri de Souza Meneguzzo e4c4d2fb46
pdata: add iterator All method to slice and map types (#12380)
#### Description

This PR adds support for iterators to Slice and Map types and their
autogenerated counterparts. Iterators were stabilized in Go 1.23.

The All method is analogous to [maps.All](https://pkg.go.dev/maps#All)
and [slices.All ](https://pkg.go.dev/slices#All) and is a more idiomatic
alternative to the more verbose `for i := 0; i < es.Len(); i++ { z :=
es.At(i) }` way of looping.

Code that is written like this today:

```go
for i := 0; i < ld.ResourceLogs().Len(); i++ {
        rl := ld.ResourceLogs().At(i)
        for j := 0; j < rl.ScopeLogs().Len(); j++ {
                sl := rl.ScopeLogs().At(j)
                for k := 0; k < sl.LogRecords().Len(); k++ {
                        lr := sl.LogRecords().At(k)
                        // use lr
                }
        }
}
```

Can now be written like this:

```go
for _, rl := range ld.ResourceLogs().All() {
        for _, sl := range rl.ScopeLogs().All() {
                for _, lr := range sl.LogRecords().All() {
                        // use lr
                }
        }
}
```

#### Link to tracking issue

Fixes
https://github.com/open-telemetry/opentelemetry-collector/issues/11982
2025-03-14 08:55:02 +00:00
Damien Mathieu 33264a5408
Upgrade pdata to proto 1.4.0 (#11722)
This upgrades pdata to the
[1.4.0](https://github.com/open-telemetry/opentelemetry-proto/releases/tag/v1.4.0)
version of protobufs.

Sorry for the very large PR. This can't really be split into smaller PRs
though, as changes are not backwards compatible.

This PR includes
https://github.com/open-telemetry/opentelemetry-collector/pull/11706, as
the two are very close and separating them would cause weird conflicts.
The two changes can be merged either as separate PRs (with 11706 first),
or as one.

Closes
https://github.com/open-telemetry/opentelemetry-collector/issues/11720

cc @mx-psi

---------

Co-authored-by: Pablo Baeyens <pbaeyens31+github@gmail.com>
2024-11-28 09:40:17 +01:00
Matthieu MOREL 8f3ca8aaf5
[chore] mdatagen comply with testifylint (#11136)
#### Description

As Testifylint is not applied on generated files, this update mdatagen
to comply with actually applied testifylint recommandations.

Signed-off-by: Matthieu MOREL <matthieu.morel35@gmail.com>
2024-09-11 09:07:52 -07:00
Damien Mathieu 5ba6000d4a
Generate profiling pdata (#10195)
<!--Ex. Fixing a bug - Describe the bug and how this fixes the issue.
Ex. Adding a feature - Explain what this achieves.-->
#### Description

This generates the pdata for profiles.

<!-- Issue number if applicable -->
#### Link to tracking issue
Last step of #10109.

<!--Describe what testing was performed and which tests were added.-->
#### Testing

The generated code is unit-tested by generated tests.

cc @mx-psi

---------

Co-authored-by: Pablo Baeyens <pbaeyens31+github@gmail.com>
Co-authored-by: Pablo Baeyens <pablo.baeyens@datadoghq.com>
2024-05-24 16:11:11 +02:00