https://github.com/openclarity/wasm-filters
Envoy Wasm filter for traffic tracing used in APIClarity.
https://github.com/openclarity/wasm-filters
envoy go golang istio proxy wasm webassembly
Last synced: about 1 year ago
JSON representation
Envoy Wasm filter for traffic tracing used in APIClarity.
- Host: GitHub
- URL: https://github.com/openclarity/wasm-filters
- Owner: openclarity
- License: apache-2.0
- Created: 2021-09-02T12:41:21.000Z (almost 5 years ago)
- Default Branch: master
- Last Pushed: 2024-06-19T14:48:58.000Z (about 2 years ago)
- Last Synced: 2025-04-14T00:16:37.060Z (about 1 year ago)
- Topics: envoy, go, golang, istio, proxy, wasm, webassembly
- Language: Go
- Homepage:
- Size: 961 KB
- Stars: 12
- Watchers: 6
- Forks: 5
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Trace Exporter
## _APIClarity Envoy wasm filter_
Envoy wasm filter that can export http traffic from envoy proxy to any desired backend for analysis.
The exports are a POST request to /publish path, in the format:
```sh
type (
SCNTelemetry struct {
RequestID string `json:"request_id"`
Scheme string `json:"scheme"`
DestinationAddress string `json:"destination_address"`
SourceAddress string 'json:"source_address"'
SCNTRequest SCNTRequest `json:"scnt_request"`
SCNTResponse SCNTResponse `json:"scnt_response"`
}
SCNTRequest struct {
Method string `json:"method"`
Path string `json:"path"`
Host string `json:"host"`
SCNTCommon
}
SCNTResponse struct {
StatusCode string `json:"status_code"`
SCNTCommon
}
SCNTCommon struct {
Version string `json:"version"`
Headers [][2]string `json:"headers"`
Body []byte `json:"body"`
TruncatedBody bool `json:"truncated_body"`
}
)
```
## Configure
In order to set the backend address (where the traces will be sent to) you need to define the following environment variables:
```sh
WASM_FILTER_TRACE_BACKEND_ADDRESS
WASM_FILTER_TRACE_BACKEND_PORT
```
### Deploy the filter
```sh
./deploy.sh
```
This will deploy the filter to all the deployments in the provided namespaces.
This will also create a configmap containing the wasm filter in each namespace, called wasm-filter.
If you would like to change the name of the configmap, you can set the environment variable WASM_FILTER_CONFIG_MAP_NAME
You might need to restart your pods in order for the filter to be deployed.
After that you are good to go!
## Build and deploy your own filter
You can build the filter using docker
```sh
make docker_build
```
If you want to build the filter without using docker you need to have tinygo installed
On Mac:
```sh
brew tap tinygo-org/tools
brew install tinygo
```
Then you can run
```sh
make build
```
The wasm filter binary will be in `bin/http-trace-filter.wasm`
Set the binary path via environment variable
```sh
export WASM_FILTER_BINARY_PATH=bin/http-trace-filter.wasm
```
Then you can run the deploy script.
##
Current proxy-wasm-go-sdk version used is v0.13.0 Which supports istio 1.9.x, 1.10.x
proxy-wasm-go-sdk depends on TinyGo's WASI (WebAssembly System Interface) target which is introduced in v0.16.0.
See https://github.com/tetratelabs/proxy-wasm-go-sdk for more details