Remove usage of gogoproto and generate the structs with pdatagen#14069
Remove usage of gogoproto and generate the structs with pdatagen#14069bogdandrutu wants to merge 1 commit into
Conversation
5b3da2e to
29032fa
Compare
29032fa to
38bb757
Compare
0180604 to
217b0f4
Compare
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #14069 +/- ##
==========================================
- Coverage 92.50% 92.23% -0.28%
==========================================
Files 660 656 -4
Lines 36196 41110 +4914
==========================================
+ Hits 33483 37916 +4433
- Misses 1892 2183 +291
- Partials 821 1011 +190 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
d3b139a to
e30fc3c
Compare
| @@ -41,7 +41,7 @@ func new{{ .structName }}(orig *{{ .originFullName }}, state *internal.State) {{ | |||
| // This must be used only in testing code. Users should use "AppendEmpty" when part of a Slice, | |||
| // OR directly access the member if this is embedded in another struct. | |||
| func New{{ .structName }}() {{ .structName }} { | |||
| return new{{ .structName }}(internal.NewOrig{{ .originName }}(), internal.NewState()) | |||
| return new{{ .structName }}(internal.New{{ .originName }}(), internal.NewState()) | |||
| } | |||
|
|
|||
| // MoveTo moves all properties from the current struct overriding the destination and | |||
| @@ -53,7 +53,7 @@ func (ms {{ .structName }}) MoveTo(dest {{ .structName }}) { | |||
| if ms.{{ .origAccessor }} == dest.{{ .origAccessor }} { | |||
| return | |||
| } | |||
| internal.DeleteOrig{{ .originName }}(dest.{{ .origAccessor }}, false) | |||
| internal.Delete{{ .originName }}(dest.{{ .origAccessor }}, false) | |||
| *dest.{{ .origAccessor }}, *ms.{{ .origAccessor }} = *ms.{{ .origAccessor }}, *dest.{{ .origAccessor }} | |||
| } | |||
|
|
|||
| @@ -64,15 +64,15 @@ func (ms {{ .structName }}) MoveTo(dest {{ .structName }}) { | |||
| // CopyTo copies all properties from the current struct overriding the destination. | |||
| func (ms {{ .structName }}) CopyTo(dest {{ .structName }}) { | |||
| dest.{{ .stateAccessor }}.AssertMutable() | |||
| internal.CopyOrig{{ .originName }}(dest.{{ .origAccessor }}, ms.{{ .origAccessor }}) | |||
| internal.Copy{{ .originName }}(dest.{{ .origAccessor }}, ms.{{ .origAccessor }}) | |||
| } | |||
|
|
|||
| {{ if .hasWrapper -}} | |||
| func (ms {{ .structName }}) getOrig() *{{ .originFullName }} { | |||
| return internal.GetOrig{{ .structName }}(internal.{{ .structName }}(ms)) | |||
| func (ms {{ .structName }}) getOrig() *internal.{{ .originName }} { | |||
| return internal.Get{{ .structName }}Orig(internal.{{ .structName }}Wrapper(ms)) | |||
| } | |||
|
|
|||
| func (ms {{ .structName }}) getState() *internal.State { | |||
| return internal.Get{{ .structName }}State(internal.{{ .structName }}(ms)) | |||
There was a problem hiding this comment.
Idea how to reduce the size of this change, is that each change in this file looks unnecessary but nice-to-have for clarity.
- Insertion of "Wrapper"
- originFullName -> internal.originName
- NewOrig -> New
- DeleteOrig -> Delete
- CopyOrig -> Copy
- etc
If the modified code generator were to preserve everything the way it has been, the change would be smaller. We could apply the improvements in a subsequent PRs, they would be more mechanical and easy to review.
There was a problem hiding this comment.
Insertion of "Wrapper"
The new protos will conflict with the names of the proto.
eec0bbb to
02f819d
Compare
Signed-off-by: Bogdan Drutu <bogdandrutu@gmail.com>
02f819d to
4d508ba
Compare
|
Replaced by #14078 |
This is a huge PR that does not touch any of the critical logic "marshaling/unmarshaling" of the pdata. We have e2e tests with the go official generated protobufs to ensure nothing breaks.
The easy way to review this is to only look at what change publicly in "pdata/pcommon", "pdata/plog", "pdata/ptrace", "pdata/pmetric", "pdata/pprofile", "pdata/xpdata".
This PR also switches the xpada request to use the same generating mechanism as pdatagen.
Binary size before:
Binary size after: