Skip to content

dynamic modules: refactor existing go sdk to prep for expansion#44910

Open
AdamEAnderson wants to merge 7 commits into
envoyproxy:mainfrom
AdamEAnderson:go-sdk-refactoring
Open

dynamic modules: refactor existing go sdk to prep for expansion#44910
AdamEAnderson wants to merge 7 commits into
envoyproxy:mainfrom
AdamEAnderson:go-sdk-refactoring

Conversation

@AdamEAnderson
Copy link
Copy Markdown
Contributor

@AdamEAnderson AdamEAnderson commented May 6, 2026

Commit Message: dynamic modules: refactor existing go sdk to prep for expansion
Additional Description: getting ready to expand Go dynamic modules SDK to match the full ABI. This involves some refactoring to move code around to make more sense in a world with many ABI surfaces.

Reorganized some files:

  • http filter stuff is now named that way to prep for more non-http code
  • http code that will be used by other abi surfaces are split into their own files

Fixed some linker issues with abi test imports that will become a problem when we have multiple abi surfaces and tests only use one of them.

Added misc missing test coverage for HTTP and network filters (including Rust)

Fixed an incorrect public SDK function signature:

HttpFilterHandle.GetAttributeNumber(AttributeID) (float64, bool) → (uint64, bool)

The underlying ABI returns an integer, this was broken.

Rewrote a ton of docs to be more clear, to match the level of detail present in Rust SDK docs, and to match Godoc conventions.

Risk Level: low
Testing: included
Docs Changes: n/a
Release Notes: n/a
Platform Specific Features: n/a

Signed-off-by: Adam Anderson <6754028+AdamEAnderson@users.noreply.github.com>
@repokitteh-read-only
Copy link
Copy Markdown

As a reminder, PRs marked as draft will not be automatically assigned reviewers,
or be handled by maintainer-oncall triage.

Please mark your PR as ready when you want it to be reviewed!

🐱

Caused by: #44910 was opened by AdamEAnderson.

see: more, trace.

Signed-off-by: Adam Anderson <6754028+AdamEAnderson@users.noreply.github.com>
@AdamEAnderson AdamEAnderson marked this pull request as ready for review May 7, 2026 16:37
@AdamEAnderson
Copy link
Copy Markdown
Contributor Author

fyi @wbpcode

…k-refactoring

Signed-off-by: Adam Anderson <6754028+AdamEAnderson@users.noreply.github.com>
Copy link
Copy Markdown
Member

@agrawroh agrawroh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@wbpcode I am not that well versed in GoLang. Could you PTAL as well? It looks like there are some backward incompatible changes.

@wbpcode wbpcode self-assigned this May 8, 2026
@kyessenov
Copy link
Copy Markdown
Contributor

/wait
for @wbpcode input

Copy link
Copy Markdown
Member

@wbpcode wbpcode left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the contribution to make this SDK better. This PR contains lots of different content, files renaming, document improvement, refactoring to existing API, pure style changes.

For the pure style changes, could you revert it and keep previous style if no strong reason?
For the refactoring to existing API, could you split it to another independent PR?

Thanks again!!!

/wait

// unwrap returns the live wrapper for the given pointer key, or nil if the wrapper is no
// longer registered (e.g., remove already ran). Callers MUST handle a nil return — a stale
// pointer cast would otherwise alias freed memory and crash or corrupt unrelated state when
// Envoy delivers a late callback after destroy.
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If Envoy delivers a late callback after destroy. It's a serious bug and we should let it crash. (That should never happen.

Comment on lines -37 to -40
type httpFilterSharedDataWrapper struct {
data any
}

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is used for cross-filters data sharing in the golang world. Could you keep this?

Comment on lines +375 to +376
hostPluginPtr C.envoy_dynamic_module_type_http_filter_envoy_ptr
filter *dymHttpFilterHandle
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why you change the original members order?

Comment on lines +407 to +410
C.envoy_dynamic_module_callback_http_span_set_sampled(
s.spanPtr,
(C.bool)(sampled),
)
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

could we revert this type of unnecessary change?

…k-refactoring

Signed-off-by: Adam Anderson <6754028+AdamEAnderson@users.noreply.github.com>
Signed-off-by: Adam Anderson <6754028+AdamEAnderson@users.noreply.github.com>
Signed-off-by: Adam Anderson <6754028+AdamEAnderson@users.noreply.github.com>
Signed-off-by: Adam Anderson <6754028+AdamEAnderson@users.noreply.github.com>
@AdamEAnderson
Copy link
Copy Markdown
Contributor Author

@wbpcode I've cleaned up the diff as much as i can and moved the shared/ api changes etc to #45163

should be ready for another look

wbpcode pushed a commit that referenced this pull request May 21, 2026
…nsion (#45163)

Commit Message: dynamic modules: refactor existing go sdk to prep for
expansion
Additional Description: getting ready to expand Go dynamic modules SDK
to match the full ABI. This PR does some refactoring of the API code to
split it into files that are http-related or cross-surface and to
standardize on Godoc comments.

Previously the http api used javadoc (i.e. `@param`, `@returns`) which
isn't consistent with Golang expectations. The network filter api used
Godoc as expected. Updated the Javadoc comments to conform to
expectations.

Otherwise no changes to the api itself, just splitting up the files
differently and changing the comment formatting.

See #44910 for more details related to abi changes.

Risk Level: low
Testing: n/a
Docs Changes: n/a
Release Notes: n/a
Platform Specific Features: n/a

---------

Signed-off-by: Adam Anderson <6754028+AdamEAnderson@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants