Skip to content

Commit

Permalink
feat(component): rust component model support (#128)
Browse files Browse the repository at this point in the history
* feat(component): wip component model support

- upgrade to wasmtime>=13, wasmtime_wasi>=13
- the component model necessitated splitting the adapter setup into two parts:
  first creating the adapter so it can be associated with the state, then telling
  the linker how to get from the incoming state to the adapter. WASI also has this
  split.
- change the c bindings in observe-api:
  1. "_" is an illegal character! switch to "-".
  2. change the module name from "dylibso_observe" to "dylibso:observe/api"

* feat(component): rename core module imports

Align core module instrumentation naming with component model naming.

This relies on corresponding (undeployed, private) changes to the observe http api [1].

[1]: dylibso/wasm-instr#69

* feat(component): move from AsMut to ObserveSdkView

This also removes the WIT `dylibso:observe` world since we don't *really* need
it.

* fix(corpus): rename 00-component-instr-{reactor → command}

* feat(component): add an example of depending on an instr'd component

* doc: add component model integration guide

* fix(component): fix broken CI

Update vendored instrumented wasm modules to match new naming.

Additionally: switch github workflow from `npm i` to the (much faster) `npm ci`.

* fix: bump WASM_INSTR_VERSION_MINOR

* fix: error out when module and observe-sdk versions are not compatible

* chore: improve messsaging with incompat wasm-instr versions

* feat: detect and error out on all modules (incl observe api) that use dylibso_observe namespace

* fix: observe sdk compat with observe api

* chore: update go-sdk message for incompatible wasm-instr

* fix: go-sdk import function names, don't hang on unknown name

* chore: remove go/test/count_vowels.instr.wasm it was outdated

Please use test files in the `test` directory in the root of the project instead

* feat: js-sdk support old api too

* chore: js-sdk warn on discovery of deprecated namespace dylibso_observe

* feat: remove checks on version globals in rust-sdk

* feat: support modules instrumented with deprecrated namespace dylibso_observe, with warning. Error on modules instrumented with observe_api

* feat: error out when observe api is used on go and js sdks

* docs: add SDK-API-VERSIONING.md to document how to do api changes

* fix: error out on when even new observe api is used on go and js sdks

* chore: readd go changes

* fix: new versions of WIT require semicolons

* fix,docs: component building and running, add instructions to README

* ci: add testing components

* ci: install just, use action to install rust cli

* chore: bin versions

* chore: update to wasmtime 17, move off cargo-component-bindings: bytecodealliance/cargo-component@5cf73a6

---------

Co-authored-by: Gavin Hayes <[email protected]>
  • Loading branch information
chrisdickinson and G4Vi authored Jan 31, 2024
1 parent 7c028e0 commit 231702d
Show file tree
Hide file tree
Showing 55 changed files with 2,056 additions and 626 deletions.
21 changes: 20 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:
- name: Install JS build deps
run: |
cd js
npm i
npm ci
- name: Run Deno test
run: |
Expand Down Expand Up @@ -84,6 +84,7 @@ jobs:
uses: actions-rs/cargo@v1
with:
command: test
args: --all-features

- name: Run basic example
uses: actions-rs/cargo@v1
Expand All @@ -104,3 +105,21 @@ jobs:
| head -n 1 \
| jq '.resourceSpans[].scopeSpans[].spans[0].attributes[0]' \
| jq '.key == "function_name", .value.stringValue == "_start"'
- name: Install Component CLI Deps
uses: actions-rs/cargo@v1
with:
command: install
args: wasm-tools cargo-component

- name: Install Just
uses: extractions/setup-just@v1

- name: Build wit
run: just build_wit

- name: Component Demo
run: just component_demo

- name: Component Demo 2
run: just component_demo_2
Loading

0 comments on commit 231702d

Please sign in to comment.