Getting started extending the WASM API

34 views
Skip to first unread message

Jon Riehl

unread,
May 1, 2020, 1:29:35 PM5/1/20
to envoy-dev
Hi all,

I'd like to work on adding tracing support to the WASM API, but I'm having trouble connecting the dots between the C++ API defined in "proxy_wasm_api.h" and Envoy at large.  How do the intrinsics hook into Envoy?

Thanks,
-Jon

John Plevyak

unread,
May 1, 2020, 2:07:20 PM5/1/20
to Jon Riehl, envoy-dev

If you are on envoy-wasm master, then proxy_wasm_api.h is the high level C++ SDK.   This is mapped by that header, to the low level C ABI which is described in https://github.com/proxy-wasm/spec and in code in https://github.com/proxy-wasm/proxy-wasm-cpp-sdk/blob/master/proxy_wasm_externs.h 

These calls are then translated by the host code in https://github.com/proxy-wasm/proxy-wasm-cpp-host into calls on the Envoy::Extensions::Common::Wasm::Context object which is in the envoy (envoy-wasm repo) source at source/extensions/common/context.{h,cc}.

The easiest way would be to trace the  Envoy::Extensions::Common::Wasm::Context calls, but they are not 1:1 with the ABI.  You could also add wrappers to the ABI calls in proxy_wasm_api.hi and just call log() in the VM.  There are other alternatives, but they would require changes across multiple repos.

If you would like to discuss this further, please contact me at jple...@gmail.com.

--
You received this message because you are subscribed to the Google Groups "envoy-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to envoy-dev+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/envoy-dev/65486c9e-441b-4472-abcc-ee031f0998ca%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages