forked from open-telemetry/opentelemetry-collector-contrib
-
Notifications
You must be signed in to change notification settings - Fork 1
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
Transform wasm #633
Closed
Closed
Transform wasm #633
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This PR was marked stale due to lack of activity. It will be closed in 14 days. |
Closed as inactive. Feel free to reopen if this PR is still being worked on. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Plugin implementation https://github.com/anuraaga/opentelemetry-collector-contrib/pull/633/files#diff-3bae4a8ec0d5af632e586e8e1c3f87c81704bbd96a9760fa0ee7b7e71e5844f4
Identical code to built-in keep_keys function except for working around tinygo not supporting
reflect
yet for functions, which should be implementablePlugin framework https://github.com/anuraaga/opentelemetry-collector-contrib/pull/633/files#diff-b3e4bc5021aed817d7157a1fc6a7f83f6b72e735e517e9cc47343b9775746fb0
Implements OTel data model (
pdata
) and transformation API by delegating to host functions and appropriate marshaling.Host functions https://github.com/anuraaga/opentelemetry-collector-contrib/pull/633/files
Function resolution and dispatch
https://github.com/anuraaga/opentelemetry-collector-contrib/pull/633/files#diff-a48d4b6a3df6770ea57f07c4c977333e72f136b73dfc85884d00c9bae98fc795R58
General flow
.start
calls host function to tell host what function factory signatures it is adding to the collector. host registers signatureTo allow wasm to allocate objects on the host where needed, we take advantage of the lifecycle being well defined - the function invocation has the same lifetime as the piece of telemetry. So we can just store references into context scoped to the telemetry to prevent GC. A poorly behaved wasm function could of course store references globally, but there is no use case for this.
Other binders will serialize objects between host and wasm, sometimes even as JSON (?!). Here the only serialization we do is of referenced strings, everything else is an opaque pointer that is passed between host and wasm as needed.