-
Notifications
You must be signed in to change notification settings - Fork 1.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
pdata: add iterator All method to slice and map types #12380
base: main
Are you sure you want to change the base?
Conversation
TODO: add All to mdatagen
@djaglowski Do you think this would improve #8927 ? Is there a way we can make it solve #8927? |
Codecov ReportAttention: Patch coverage is
❌ Your patch check has failed because the patch coverage (51.52%) is below the target coverage (95.00%). You can increase the patch coverage or adjust the target coverage. Additional details and impacted files@@ Coverage Diff @@
## main #12380 +/- ##
==========================================
- Coverage 92.18% 91.82% -0.37%
==========================================
Files 465 465
Lines 25275 25495 +220
==========================================
+ Hits 23301 23410 +109
- Misses 1575 1649 +74
- Partials 399 436 +37 ☔ View full report in Codecov by Sentry. |
I've closed #8927 in favor of #11982. I think this solves the same problem. |
Any ideas on what could be causing the failures https://github.com/open-telemetry/opentelemetry-collector/actions/runs/13333923272/job/37244695282?pr=12380#step:4:3611? It looks like a check for the new All method is being automatically added in some contrib tests. Since Range isn't included there, there must be a way to bypass this—I just don't know what it is. |
682b694
to
d87514c
Compare
The failures in I assume that once that PR is merged this test will pass. |
…re functions (#38008) #### Description With the collector now on Go 1.23 I'm working on adding iterator support for pdata at open-telemetry/opentelemetry-collector#12380 but the EqualT_test fails when comparing the iterators returned by All. Since the reflect value of an iter.Seq/iter.Seq2 is reflect.Func, they are not comparable in the usual sense. The go-cmp/cmp is still on Go 1.21 so it does not know about iterators. There is `x/exp/xiter.Equal` but it is still an open proposal. See https://go.googlesource.com/go/+/81c66e71d480ae2372b7eea4bcdf600b50fdd5e1/src/reflect/deepequal.go#158. Examples of the test failures: ```txt expo_test.go:203: Attributes().All(): 0xd1b400 != 0xd1b400 expo_test.go:203: Exemplars().All(): 0xe2be20 != 0xe2be20 ``` This PR adjusts the equal logic to skip the equality check for functions. #### Link to tracking issue For open-telemetry/opentelemetry-collector#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 and 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:
Can now be written like this:
Link to tracking issue
Fixes #11982