From a490eb0ea826659beb4384579c02424f0732bc2a Mon Sep 17 00:00:00 2001 From: Andrew Steurer <94206073+asteurer@users.noreply.github.com> Date: Tue, 7 Apr 2026 22:42:36 -0500 Subject: [PATCH] feat: update go SDK to use new componentize-go version Signed-off-by: Andrew Steurer <94206073+asteurer@users.noreply.github.com> --- .github/workflows/ci.yaml | 10 - Justfile | 6 +- go/README.md | 4 +- go/componentize-go.toml | 4 + go/examples/spin-basic/go.mod | 12 +- go/examples/spin-basic/go.sum | 18 +- go/examples/spin-basic/main.go | 12 +- go/examples/spin-basic/spin.toml | 2 +- .../wit/deps/spin-key-value-2.0.0/package.wit | 49 -- .../wit/deps/wasi-cli-0.2.0/package.wit | 20 - .../wit/deps/wasi-clocks-0.2.0/package.wit | 29 - .../wit/deps/wasi-http-0.2.0/package.wit | 571 ------------------ .../wit/deps/wasi-io-0.2.0/package.wit | 48 -- .../wit/deps/wasi-otel-0.2.0-rc.2/logs.wit | 36 -- .../wit/deps/wasi-otel-0.2.0-rc.2/metrics.wit | 256 -------- .../wit/deps/wasi-otel-0.2.0-rc.2/tracing.wit | 122 ---- .../wit/deps/wasi-otel-0.2.0-rc.2/types.wit | 46 -- .../wit/deps/wasi-otel-0.2.0-rc.2/world.wit | 8 - .../wit/deps/wasi-random-0.2.0/package.wit | 8 - go/examples/spin-basic/wit/world.wit | 8 - go/go.mod | 9 +- go/go.sum | 12 +- .../wasi_clocks_monotonic_clock/empty.s | 3 + .../wit_bindings.go | 2 +- go/internal/wasi_clocks_wall_clock/empty.s | 3 + .../wasi_clocks_wall_clock/wit_bindings.go | 8 +- go/internal/wasi_io_poll/empty.s | 3 + go/internal/wasi_io_poll/wit_bindings.go | 15 +- go/internal/wasi_otel_logs/empty.s | 3 + go/internal/wasi_otel_logs/wit_bindings.go | 98 +-- go/internal/wasi_otel_metrics/empty.s | 3 + go/internal/wasi_otel_metrics/wit_bindings.go | 202 +++---- go/internal/wasi_otel_tracing/empty.s | 3 + go/internal/wasi_otel_tracing/wit_bindings.go | 44 +- go/internal/wasi_otel_types/empty.s | 3 + go/internal/wasi_otel_types/wit_bindings.go | 10 +- go/internal/wit_exports/wit_exports.go | 6 +- go/logs/conversions.go | 50 +- go/metrics/conversions.go | 20 +- go/tracing/conversions.go | 6 +- go/types/conversions.go | 8 +- 41 files changed, 308 insertions(+), 1472 deletions(-) create mode 100644 go/componentize-go.toml delete mode 100644 go/examples/spin-basic/wit/deps/spin-key-value-2.0.0/package.wit delete mode 100644 go/examples/spin-basic/wit/deps/wasi-cli-0.2.0/package.wit delete mode 100644 go/examples/spin-basic/wit/deps/wasi-clocks-0.2.0/package.wit delete mode 100644 go/examples/spin-basic/wit/deps/wasi-http-0.2.0/package.wit delete mode 100644 go/examples/spin-basic/wit/deps/wasi-io-0.2.0/package.wit delete mode 100644 go/examples/spin-basic/wit/deps/wasi-otel-0.2.0-rc.2/logs.wit delete mode 100644 go/examples/spin-basic/wit/deps/wasi-otel-0.2.0-rc.2/metrics.wit delete mode 100644 go/examples/spin-basic/wit/deps/wasi-otel-0.2.0-rc.2/tracing.wit delete mode 100644 go/examples/spin-basic/wit/deps/wasi-otel-0.2.0-rc.2/types.wit delete mode 100644 go/examples/spin-basic/wit/deps/wasi-otel-0.2.0-rc.2/world.wit delete mode 100644 go/examples/spin-basic/wit/deps/wasi-random-0.2.0/package.wit delete mode 100644 go/examples/spin-basic/wit/world.wit create mode 100644 go/internal/wasi_clocks_monotonic_clock/empty.s create mode 100644 go/internal/wasi_clocks_wall_clock/empty.s create mode 100644 go/internal/wasi_io_poll/empty.s create mode 100644 go/internal/wasi_otel_logs/empty.s create mode 100644 go/internal/wasi_otel_metrics/empty.s create mode 100644 go/internal/wasi_otel_tracing/empty.s create mode 100644 go/internal/wasi_otel_types/empty.s diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 46e323b..4445fd3 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -121,16 +121,6 @@ jobs: with: go-version: 'stable' - - name: Setup Wasmtime (for Go unit tests) - uses: bytecodealliance/actions/wasmtime/setup@v1 - with: - version: "40.0.1" - - - name: Setup componentize-go - uses: bytecodealliance/componentize-go/.github/actions/setup-componentize-go@main - with: - version: 'v0.2.0' - - name: Setup Spin uses: fermyon/actions/spin/setup@v1 with: diff --git a/Justfile b/Justfile index 45b1e89..511ae58 100644 --- a/Justfile +++ b/Justfile @@ -5,7 +5,7 @@ vet: cargo vet --manifest-path rust/Cargo.toml # Vet: Go SDK - cd go && GOOS=wasip1 GOARCH=wasm go vet ./logs/... ./metrics/... ./tracing/... ./types/... + cd go && go vet -unsafeptr=false -composites=false ./... # Vet: TypeScript SDK # This is handled in the lint step @@ -54,9 +54,7 @@ test: @npm --prefix ts test # Test: Go SDK - @cd go \ - && GOOS=wasip1 GOARCH=wasm go test -ldflags=-checklinkname=0 -c -o logs_test.wasm ./logs \ - && wasmtime run logs_test.wasm + @cd go && go test ./... # Test: Integration tests # TODO: Until this issue is taken care of, these will continue to fail: https://github.com/calebschoepp/opentelemetry-wasi/issues/45 diff --git a/go/README.md b/go/README.md index 1f41509..fe3dd70 100644 --- a/go/README.md +++ b/go/README.md @@ -33,10 +33,10 @@ Whenever WIT files are changed/added to the `../wit` directory, the bindings in ### Prerequisites -- [**componentize-go**](https://github.com/bytecodealliance/componentize-go) - v0.2.0 +- [**go**](https://go.dev/dl/) - v1.25+ ### Run ```sh -componentize-go -w imports -d ../wit bindings -o internal --pkg-name github.com/calebschoepp/opentelemetry-wasi/internal --format +go tool componentize-go -w imports -d ../wit bindings -o internal --pkg-name github.com/calebschoepp/opentelemetry-wasi/internal --format ``` diff --git a/go/componentize-go.toml b/go/componentize-go.toml new file mode 100644 index 0000000..91f8800 --- /dev/null +++ b/go/componentize-go.toml @@ -0,0 +1,4 @@ +# Use this world by default if none is specified: +worlds = [ "wasi:otel/imports@0.2.0-rc.2" ] +# Here's where to find the WIT files used by this SDK: +wit_paths = [ "../wit" ] diff --git a/go/examples/spin-basic/go.mod b/go/examples/spin-basic/go.mod index 5ec07a3..801fc07 100644 --- a/go/examples/spin-basic/go.mod +++ b/go/examples/spin-basic/go.mod @@ -4,7 +4,7 @@ go 1.25.5 require ( github.com/calebschoepp/opentelemetry-wasi v0.0.0-00010101000000-000000000000 - github.com/spinframework/spin-go-sdk/v3 v3.0.0-00010101000000-000000000000 + github.com/spinframework/spin-go-sdk/v3 v3.0.0-20260407161511-f2bf8873711b go.opentelemetry.io/otel v1.39.0 go.opentelemetry.io/otel/log v0.14.0 go.opentelemetry.io/otel/metric v1.39.0 @@ -14,19 +14,19 @@ require ( ) require ( - github.com/bytecodealliance/wit-bindgen v0.0.0-00010101000000-000000000000 // indirect + github.com/apparentlymart/go-userdirs v0.0.0-20200915174352-b0c018a67c13 // indirect + github.com/bytecodealliance/componentize-go v0.3.1 // indirect github.com/cespare/xxhash/v2 v2.3.0 // indirect github.com/go-logr/logr v1.4.3 // indirect github.com/go-logr/stdr v1.2.2 // indirect + github.com/gofrs/flock v0.13.0 // indirect github.com/google/uuid v1.6.0 // indirect - github.com/julienschmidt/httprouter v1.3.0 // indirect + go.bytecodealliance.org/pkg v0.2.1 // indirect go.opentelemetry.io/auto/sdk v1.2.1 // indirect go.opentelemetry.io/otel/trace v1.39.0 // indirect golang.org/x/sys v0.39.0 // indirect ) -replace github.com/spinframework/spin-go-sdk/v3 => github.com/asteurer/spin-go-sdk/v3 v3.0.0-20260114220401-5aec7236bb2c - replace github.com/calebschoepp/opentelemetry-wasi => ../../ -replace github.com/bytecodealliance/wit-bindgen => github.com/bytecodealliance/wit-bindgen/crates/go/src/package v0.51.0 +tool github.com/bytecodealliance/componentize-go diff --git a/go/examples/spin-basic/go.sum b/go/examples/spin-basic/go.sum index c1f47de..f760043 100644 --- a/go/examples/spin-basic/go.sum +++ b/go/examples/spin-basic/go.sum @@ -1,7 +1,7 @@ -github.com/asteurer/spin-go-sdk/v3 v3.0.0-20260114220401-5aec7236bb2c h1:wxLJbYhfEGH82IdZddbdN3ZU2CpleNQk+k8FsAMxnHE= -github.com/asteurer/spin-go-sdk/v3 v3.0.0-20260114220401-5aec7236bb2c/go.mod h1:omWk7AOSaQgL07B2iu5kxYe21a7xOuGX/jPQKl+C6OI= -github.com/bytecodealliance/wit-bindgen/crates/go/src/package v0.51.0 h1:fbwpkAmU6eZnDQpBHrdQwPXi5atE0KSfjU8zwFkClnw= -github.com/bytecodealliance/wit-bindgen/crates/go/src/package v0.51.0/go.mod h1:MUXxhOBN0hAtqHjc9/9XAEiXcGhcwYL6PeDXkKwVZN0= +github.com/apparentlymart/go-userdirs v0.0.0-20200915174352-b0c018a67c13 h1:JtuelWqyixKApmXm3qghhZ7O96P6NKpyrlSIe8Rwnhw= +github.com/apparentlymart/go-userdirs v0.0.0-20200915174352-b0c018a67c13/go.mod h1:7kfpUbyCdGJ9fDRCp3fopPQi5+cKNHgTE4ZuNrO71Cw= +github.com/bytecodealliance/componentize-go v0.3.1 h1:uXfSgjvIhYun74gcxnOxAO3pUKQ4SWmStxlROZLUoRA= +github.com/bytecodealliance/componentize-go v0.3.1/go.mod h1:w1QFtPLGI9o38epvMOPyCKbMc7q7GJ7yZhIvhGTpzA0= github.com/cespare/xxhash/v2 v2.3.0 h1:UL815xU9SqsFlibzuggzjXhog7bL6oX9BbNZnL2UFvs= github.com/cespare/xxhash/v2 v2.3.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= @@ -11,16 +11,21 @@ github.com/go-logr/logr v1.4.3 h1:CjnDlHq8ikf6E492q6eKboGOC0T8CDaOvkHCIg8idEI= github.com/go-logr/logr v1.4.3/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY= github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= +github.com/gofrs/flock v0.13.0 h1:95JolYOvGMqeH31+FC7D2+uULf6mG61mEZ/A8dRYMzw= +github.com/gofrs/flock v0.13.0/go.mod h1:jxeyy9R1auM5S6JYDBhDt+E2TCo7DkratH4Pgi8P+Z0= +github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= github.com/google/go-cmp v0.7.0 h1:wk8382ETsv4JYUZwIsn6YpYiWiBsYLSJiTsyBybVuN8= github.com/google/go-cmp v0.7.0/go.mod h1:pXiqmnSA92OHEEa9HXL2W4E7lf9JzCmGVUdgjX3N/iU= github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0= github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= -github.com/julienschmidt/httprouter v1.3.0 h1:U0609e9tgbseu3rBINet9P48AI/D3oJs4dN7jwJOQ1U= -github.com/julienschmidt/httprouter v1.3.0/go.mod h1:JR6WtHb+2LUe8TCKY3cZOxFyyO8IZAc4RVcycCCAKdM= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= +github.com/spinframework/spin-go-sdk/v3 v3.0.0-20260407161511-f2bf8873711b h1:ssbg3S4ereZoFknFC086rEJ+Q9fED5NLcWfku4elbM0= +github.com/spinframework/spin-go-sdk/v3 v3.0.0-20260407161511-f2bf8873711b/go.mod h1:8YZLMpWrO1iBXhfnHKA/GgDTcjcE0WdN5CUqvV2LatA= github.com/stretchr/testify v1.11.1 h1:7s2iGBzp5EwR7/aIZr8ao5+dra3wiQyKjjFuvgVKu7U= github.com/stretchr/testify v1.11.1/go.mod h1:wZwfW3scLgRK+23gO65QZefKpKQRnfz6sD981Nm4B6U= +go.bytecodealliance.org/pkg v0.2.1 h1:TdRagooIcCW3UmlKqVO4cDR3GNDyfDnbiBzGI6TOvyg= +go.bytecodealliance.org/pkg v0.2.1/go.mod h1:OjA+V8g3uUFixeCKFfamm6sYhTJdg8fvwEdJ2GO0GSk= go.opentelemetry.io/auto/sdk v1.2.1 h1:jXsnJ4Lmnqd11kwkBV2LgLoFMZKizbCi5fNZ/ipaZ64= go.opentelemetry.io/auto/sdk v1.2.1/go.mod h1:KRTj+aOaElaLi+wW1kO/DZRXwkF4C5xPbEe3ZiIhN7Y= go.opentelemetry.io/otel v1.39.0 h1:8yPrr/S0ND9QEfTfdP9V+SiwT4E0G7Y5MO7p85nis48= @@ -39,6 +44,7 @@ go.opentelemetry.io/otel/trace v1.39.0 h1:2d2vfpEDmCJ5zVYz7ijaJdOF59xLomrvj7bjt6 go.opentelemetry.io/otel/trace v1.39.0/go.mod h1:88w4/PnZSazkGzz/w84VHpQafiU4EtqqlVdxWy+rNOA= go.uber.org/goleak v1.3.0 h1:2K3zAYmnTNqV73imy9J1T3WC+gmCePx2hEGkimedGto= go.uber.org/goleak v1.3.0/go.mod h1:CoHD4mav9JJNrW/WLlf7HGZPjdw8EucARQHekz1X6bE= +golang.org/x/sys v0.0.0-20190509141414-a5b02f93d862/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.39.0 h1:CvCKL8MeisomCi6qNZ+wbb0DN9E5AATixKsvNtMoMFk= golang.org/x/sys v0.39.0/go.mod h1:OgkHotnGiDImocRcuBABYBEXf8A9a87e/uXjp9XT3ks= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= diff --git a/go/examples/spin-basic/main.go b/go/examples/spin-basic/main.go index 3cb04de..99d3b3d 100644 --- a/go/examples/spin-basic/main.go +++ b/go/examples/spin-basic/main.go @@ -17,20 +17,26 @@ import ( metricApi "go.opentelemetry.io/otel/metric" "go.opentelemetry.io/otel/sdk/log" "go.opentelemetry.io/otel/sdk/metric" + "go.opentelemetry.io/otel/sdk/resource" "go.opentelemetry.io/otel/sdk/trace" + semconv "go.opentelemetry.io/otel/semconv/v1.37.0" ) func init() { spinhttp.Handle(func(w http.ResponseWriter, r *http.Request) { ctx := context.Background() + res, _ := resource.New(ctx, + resource.WithAttributes(semconv.ServiceName("spin")), + ) + /* ### METRICS ### */ exporter := wasiMetrics.NewWasiMetricExporter() defer exporter.Export(ctx) // Export metrics to the host - meterProvider := metric.NewMeterProvider(metric.WithReader(exporter)) + meterProvider := metric.NewMeterProvider(metric.WithReader(exporter), metric.WithResource(res)) meter := meterProvider.Meter("spin-metrics") attrs := metricApi.WithAttributes( @@ -70,7 +76,7 @@ func init() { /* ### TRACING ### */ - tracerProvider := trace.NewTracerProvider(trace.WithSpanProcessor(wasiTracing.NewWasiSpanProcessor())) + tracerProvider := trace.NewTracerProvider(trace.WithSpanProcessor(wasiTracing.NewWasiSpanProcessor()), trace.WithResource(res)) propagator := wasiTracing.NewTraceContextPropagator() hostCtx := propagator.Extract(ctx) otel.SetTracerProvider(tracerProvider) @@ -105,7 +111,7 @@ func init() { /* ### LOGS ### */ - loggerProvider := log.NewLoggerProvider(log.WithProcessor(wasiLogs.NewWasiLogProcessor())) + loggerProvider := log.NewLoggerProvider(log.WithProcessor(wasiLogs.NewWasiLogProcessor()), log.WithResource(res)) logger := loggerProvider.Logger("spin-logs") logRecord := logApi.Record{} logRecord.SetBody(logApi.StringValue("Hello from Go!")) diff --git a/go/examples/spin-basic/spin.toml b/go/examples/spin-basic/spin.toml index 06acc32..4172f6f 100644 --- a/go/examples/spin-basic/spin.toml +++ b/go/examples/spin-basic/spin.toml @@ -16,5 +16,5 @@ component = "go-spin-basic" source = "main.wasm" key_value_stores = ["default"] [component.go-spin-basic.build] -command = "componentize-go -w http-trigger componentize" +command = "go tool componentize-go build" watch = ["**/*.go", "go.mod"] diff --git a/go/examples/spin-basic/wit/deps/spin-key-value-2.0.0/package.wit b/go/examples/spin-basic/wit/deps/spin-key-value-2.0.0/package.wit deleted file mode 100644 index 21365f2..0000000 --- a/go/examples/spin-basic/wit/deps/spin-key-value-2.0.0/package.wit +++ /dev/null @@ -1,49 +0,0 @@ -package fermyon:spin@2.0.0; - -interface key-value { - /// An open key-value store - resource store { - /// Open the store with the specified label. - /// - /// `label` must refer to a store allowed in the spin.toml manifest. - /// - /// `error::no-such-store` will be raised if the `label` is not recognized. - open: static func(label: string) -> result; - - /// Get the value associated with the specified `key` - /// - /// Returns `ok(none)` if the key does not exist. - get: func(key: string) -> result>, error>; - - /// Set the `value` associated with the specified `key` overwriting any existing value. - set: func(key: string, value: list) -> result<_, error>; - - /// Delete the tuple with the specified `key` - /// - /// No error is raised if a tuple did not previously exist for `key`. - delete: func(key: string) -> result<_, error>; - - /// Return whether a tuple exists for the specified `key` - exists: func(key: string) -> result; - - /// Return a list of all the keys - get-keys: func() -> result, error>; - } - - /// The set of errors which may be raised by functions in this interface - variant error { - /// Too many stores have been opened simultaneously. Closing one or more - /// stores prior to retrying may address this. - store-table-full, - - /// The host does not recognize the store label requested. - no-such-store, - - /// The requesting component does not have access to the specified store - /// (which may or may not exist). - access-denied, - - /// Some implementation-specific error has occurred (e.g. I/O) - other(string) - } -} diff --git a/go/examples/spin-basic/wit/deps/wasi-cli-0.2.0/package.wit b/go/examples/spin-basic/wit/deps/wasi-cli-0.2.0/package.wit deleted file mode 100644 index 8deef32..0000000 --- a/go/examples/spin-basic/wit/deps/wasi-cli-0.2.0/package.wit +++ /dev/null @@ -1,20 +0,0 @@ -package wasi:cli@0.2.0; - -interface stdout { - use wasi:io/streams@0.2.0.{output-stream}; - - get-stdout: func() -> output-stream; -} - -interface stderr { - use wasi:io/streams@0.2.0.{output-stream}; - - get-stderr: func() -> output-stream; -} - -interface stdin { - use wasi:io/streams@0.2.0.{input-stream}; - - get-stdin: func() -> input-stream; -} - diff --git a/go/examples/spin-basic/wit/deps/wasi-clocks-0.2.0/package.wit b/go/examples/spin-basic/wit/deps/wasi-clocks-0.2.0/package.wit deleted file mode 100644 index 9e0ba3d..0000000 --- a/go/examples/spin-basic/wit/deps/wasi-clocks-0.2.0/package.wit +++ /dev/null @@ -1,29 +0,0 @@ -package wasi:clocks@0.2.0; - -interface monotonic-clock { - use wasi:io/poll@0.2.0.{pollable}; - - type instant = u64; - - type duration = u64; - - now: func() -> instant; - - resolution: func() -> duration; - - subscribe-instant: func(when: instant) -> pollable; - - subscribe-duration: func(when: duration) -> pollable; -} - -interface wall-clock { - record datetime { - seconds: u64, - nanoseconds: u32, - } - - now: func() -> datetime; - - resolution: func() -> datetime; -} - diff --git a/go/examples/spin-basic/wit/deps/wasi-http-0.2.0/package.wit b/go/examples/spin-basic/wit/deps/wasi-http-0.2.0/package.wit deleted file mode 100644 index 11f7ff4..0000000 --- a/go/examples/spin-basic/wit/deps/wasi-http-0.2.0/package.wit +++ /dev/null @@ -1,571 +0,0 @@ -package wasi:http@0.2.0; - -/// This interface defines all of the types and methods for implementing -/// HTTP Requests and Responses, both incoming and outgoing, as well as -/// their headers, trailers, and bodies. -interface types { - use wasi:clocks/monotonic-clock@0.2.0.{duration}; - use wasi:io/streams@0.2.0.{input-stream, output-stream}; - use wasi:io/error@0.2.0.{error as io-error}; - use wasi:io/poll@0.2.0.{pollable}; - - /// This type corresponds to HTTP standard Methods. - variant method { - get, - head, - post, - put, - delete, - connect, - options, - trace, - patch, - other(string), - } - - /// This type corresponds to HTTP standard Related Schemes. - variant scheme { - HTTP, - HTTPS, - other(string), - } - - /// Defines the case payload type for `DNS-error` above: - record DNS-error-payload { - rcode: option, - info-code: option, - } - - /// Defines the case payload type for `TLS-alert-received` above: - record TLS-alert-received-payload { - alert-id: option, - alert-message: option, - } - - /// Defines the case payload type for `HTTP-response-{header,trailer}-size` above: - record field-size-payload { - field-name: option, - field-size: option, - } - - /// These cases are inspired by the IANA HTTP Proxy Error Types: - /// https://www.iana.org/assignments/http-proxy-status/http-proxy-status.xhtml#table-http-proxy-error-types - variant error-code { - DNS-timeout, - DNS-error(DNS-error-payload), - destination-not-found, - destination-unavailable, - destination-IP-prohibited, - destination-IP-unroutable, - connection-refused, - connection-terminated, - connection-timeout, - connection-read-timeout, - connection-write-timeout, - connection-limit-reached, - TLS-protocol-error, - TLS-certificate-error, - TLS-alert-received(TLS-alert-received-payload), - HTTP-request-denied, - HTTP-request-length-required, - HTTP-request-body-size(option), - HTTP-request-method-invalid, - HTTP-request-URI-invalid, - HTTP-request-URI-too-long, - HTTP-request-header-section-size(option), - HTTP-request-header-size(option), - HTTP-request-trailer-section-size(option), - HTTP-request-trailer-size(field-size-payload), - HTTP-response-incomplete, - HTTP-response-header-section-size(option), - HTTP-response-header-size(field-size-payload), - HTTP-response-body-size(option), - HTTP-response-trailer-section-size(option), - HTTP-response-trailer-size(field-size-payload), - HTTP-response-transfer-coding(option), - HTTP-response-content-coding(option), - HTTP-response-timeout, - HTTP-upgrade-failed, - HTTP-protocol-error, - loop-detected, - configuration-error, - /// This is a catch-all error for anything that doesn't fit cleanly into a - /// more specific case. It also includes an optional string for an - /// unstructured description of the error. Users should not depend on the - /// string for diagnosing errors, as it's not required to be consistent - /// between implementations. - internal-error(option), - } - - /// This type enumerates the different kinds of errors that may occur when - /// setting or appending to a `fields` resource. - variant header-error { - /// This error indicates that a `field-key` or `field-value` was - /// syntactically invalid when used with an operation that sets headers in a - /// `fields`. - invalid-syntax, - /// This error indicates that a forbidden `field-key` was used when trying - /// to set a header in a `fields`. - forbidden, - /// This error indicates that the operation on the `fields` was not - /// permitted because the fields are immutable. - immutable, - } - - /// Field keys are always strings. - type field-key = string; - - /// Field values should always be ASCII strings. However, in - /// reality, HTTP implementations often have to interpret malformed values, - /// so they are provided as a list of bytes. - type field-value = list; - - /// This following block defines the `fields` resource which corresponds to - /// HTTP standard Fields. Fields are a common representation used for both - /// Headers and Trailers. - /// - /// A `fields` may be mutable or immutable. A `fields` created using the - /// constructor, `from-list`, or `clone` will be mutable, but a `fields` - /// resource given by other means (including, but not limited to, - /// `incoming-request.headers`, `outgoing-request.headers`) might be be - /// immutable. In an immutable fields, the `set`, `append`, and `delete` - /// operations will fail with `header-error.immutable`. - resource fields { - /// Construct an empty HTTP Fields. - /// - /// The resulting `fields` is mutable. - constructor(); - /// Construct an HTTP Fields. - /// - /// The resulting `fields` is mutable. - /// - /// The list represents each key-value pair in the Fields. Keys - /// which have multiple values are represented by multiple entries in this - /// list with the same key. - /// - /// The tuple is a pair of the field key, represented as a string, and - /// Value, represented as a list of bytes. In a valid Fields, all keys - /// and values are valid UTF-8 strings. However, values are not always - /// well-formed, so they are represented as a raw list of bytes. - /// - /// An error result will be returned if any header or value was - /// syntactically invalid, or if a header was forbidden. - from-list: static func(entries: list>) -> result; - /// Get all of the values corresponding to a key. If the key is not present - /// in this `fields`, an empty list is returned. However, if the key is - /// present but empty, this is represented by a list with one or more - /// empty field-values present. - get: func(name: field-key) -> list; - /// Returns `true` when the key is present in this `fields`. If the key is - /// syntactically invalid, `false` is returned. - has: func(name: field-key) -> bool; - /// Set all of the values for a key. Clears any existing values for that - /// key, if they have been set. - /// - /// Fails with `header-error.immutable` if the `fields` are immutable. - set: func(name: field-key, value: list) -> result<_, header-error>; - /// Delete all values for a key. Does nothing if no values for the key - /// exist. - /// - /// Fails with `header-error.immutable` if the `fields` are immutable. - delete: func(name: field-key) -> result<_, header-error>; - /// Append a value for a key. Does not change or delete any existing - /// values for that key. - /// - /// Fails with `header-error.immutable` if the `fields` are immutable. - append: func(name: field-key, value: field-value) -> result<_, header-error>; - /// Retrieve the full set of keys and values in the Fields. Like the - /// constructor, the list represents each key-value pair. - /// - /// The outer list represents each key-value pair in the Fields. Keys - /// which have multiple values are represented by multiple entries in this - /// list with the same key. - entries: func() -> list>; - /// Make a deep copy of the Fields. Equivelant in behavior to calling the - /// `fields` constructor on the return value of `entries`. The resulting - /// `fields` is mutable. - clone: func() -> fields; - } - - /// Headers is an alias for Fields. - type headers = fields; - - /// Trailers is an alias for Fields. - type trailers = fields; - - /// Represents an incoming HTTP Request. - resource incoming-request { - /// Returns the method of the incoming request. - method: func() -> method; - /// Returns the path with query parameters from the request, as a string. - path-with-query: func() -> option; - /// Returns the protocol scheme from the request. - scheme: func() -> option; - /// Returns the authority from the request, if it was present. - authority: func() -> option; - /// Get the `headers` associated with the request. - /// - /// The returned `headers` resource is immutable: `set`, `append`, and - /// `delete` operations will fail with `header-error.immutable`. - /// - /// The `headers` returned are a child resource: it must be dropped before - /// the parent `incoming-request` is dropped. Dropping this - /// `incoming-request` before all children are dropped will trap. - headers: func() -> headers; - /// Gives the `incoming-body` associated with this request. Will only - /// return success at most once, and subsequent calls will return error. - consume: func() -> result; - } - - /// Represents an outgoing HTTP Request. - resource outgoing-request { - /// Construct a new `outgoing-request` with a default `method` of `GET`, and - /// `none` values for `path-with-query`, `scheme`, and `authority`. - /// - /// * `headers` is the HTTP Headers for the Request. - /// - /// It is possible to construct, or manipulate with the accessor functions - /// below, an `outgoing-request` with an invalid combination of `scheme` - /// and `authority`, or `headers` which are not permitted to be sent. - /// It is the obligation of the `outgoing-handler.handle` implementation - /// to reject invalid constructions of `outgoing-request`. - constructor(headers: headers); - /// Returns the resource corresponding to the outgoing Body for this - /// Request. - /// - /// Returns success on the first call: the `outgoing-body` resource for - /// this `outgoing-request` can be retrieved at most once. Subsequent - /// calls will return error. - body: func() -> result; - /// Get the Method for the Request. - method: func() -> method; - /// Set the Method for the Request. Fails if the string present in a - /// `method.other` argument is not a syntactically valid method. - set-method: func(method: method) -> result; - /// Get the combination of the HTTP Path and Query for the Request. - /// When `none`, this represents an empty Path and empty Query. - path-with-query: func() -> option; - /// Set the combination of the HTTP Path and Query for the Request. - /// When `none`, this represents an empty Path and empty Query. Fails is the - /// string given is not a syntactically valid path and query uri component. - set-path-with-query: func(path-with-query: option) -> result; - /// Get the HTTP Related Scheme for the Request. When `none`, the - /// implementation may choose an appropriate default scheme. - scheme: func() -> option; - /// Set the HTTP Related Scheme for the Request. When `none`, the - /// implementation may choose an appropriate default scheme. Fails if the - /// string given is not a syntactically valid uri scheme. - set-scheme: func(scheme: option) -> result; - /// Get the HTTP Authority for the Request. A value of `none` may be used - /// with Related Schemes which do not require an Authority. The HTTP and - /// HTTPS schemes always require an authority. - authority: func() -> option; - /// Set the HTTP Authority for the Request. A value of `none` may be used - /// with Related Schemes which do not require an Authority. The HTTP and - /// HTTPS schemes always require an authority. Fails if the string given is - /// not a syntactically valid uri authority. - set-authority: func(authority: option) -> result; - /// Get the headers associated with the Request. - /// - /// The returned `headers` resource is immutable: `set`, `append`, and - /// `delete` operations will fail with `header-error.immutable`. - /// - /// This headers resource is a child: it must be dropped before the parent - /// `outgoing-request` is dropped, or its ownership is transfered to - /// another component by e.g. `outgoing-handler.handle`. - headers: func() -> headers; - } - - /// Parameters for making an HTTP Request. Each of these parameters is - /// currently an optional timeout applicable to the transport layer of the - /// HTTP protocol. - /// - /// These timeouts are separate from any the user may use to bound a - /// blocking call to `wasi:io/poll.poll`. - resource request-options { - /// Construct a default `request-options` value. - constructor(); - /// The timeout for the initial connect to the HTTP Server. - connect-timeout: func() -> option; - /// Set the timeout for the initial connect to the HTTP Server. An error - /// return value indicates that this timeout is not supported. - set-connect-timeout: func(duration: option) -> result; - /// The timeout for receiving the first byte of the Response body. - first-byte-timeout: func() -> option; - /// Set the timeout for receiving the first byte of the Response body. An - /// error return value indicates that this timeout is not supported. - set-first-byte-timeout: func(duration: option) -> result; - /// The timeout for receiving subsequent chunks of bytes in the Response - /// body stream. - between-bytes-timeout: func() -> option; - /// Set the timeout for receiving subsequent chunks of bytes in the Response - /// body stream. An error return value indicates that this timeout is not - /// supported. - set-between-bytes-timeout: func(duration: option) -> result; - } - - /// Represents the ability to send an HTTP Response. - /// - /// This resource is used by the `wasi:http/incoming-handler` interface to - /// allow a Response to be sent corresponding to the Request provided as the - /// other argument to `incoming-handler.handle`. - resource response-outparam { - /// Set the value of the `response-outparam` to either send a response, - /// or indicate an error. - /// - /// This method consumes the `response-outparam` to ensure that it is - /// called at most once. If it is never called, the implementation - /// will respond with an error. - /// - /// The user may provide an `error` to `response` to allow the - /// implementation determine how to respond with an HTTP error response. - set: static func(param: response-outparam, response: result); - } - - /// This type corresponds to the HTTP standard Status Code. - type status-code = u16; - - /// Represents an incoming HTTP Response. - resource incoming-response { - /// Returns the status code from the incoming response. - status: func() -> status-code; - /// Returns the headers from the incoming response. - /// - /// The returned `headers` resource is immutable: `set`, `append`, and - /// `delete` operations will fail with `header-error.immutable`. - /// - /// This headers resource is a child: it must be dropped before the parent - /// `incoming-response` is dropped. - headers: func() -> headers; - /// Returns the incoming body. May be called at most once. Returns error - /// if called additional times. - consume: func() -> result; - } - - /// Represents an incoming HTTP Request or Response's Body. - /// - /// A body has both its contents - a stream of bytes - and a (possibly - /// empty) set of trailers, indicating that the full contents of the - /// body have been received. This resource represents the contents as - /// an `input-stream` and the delivery of trailers as a `future-trailers`, - /// and ensures that the user of this interface may only be consuming either - /// the body contents or waiting on trailers at any given time. - resource incoming-body { - /// Returns the contents of the body, as a stream of bytes. - /// - /// Returns success on first call: the stream representing the contents - /// can be retrieved at most once. Subsequent calls will return error. - /// - /// The returned `input-stream` resource is a child: it must be dropped - /// before the parent `incoming-body` is dropped, or consumed by - /// `incoming-body.finish`. - /// - /// This invariant ensures that the implementation can determine whether - /// the user is consuming the contents of the body, waiting on the - /// `future-trailers` to be ready, or neither. This allows for network - /// backpressure is to be applied when the user is consuming the body, - /// and for that backpressure to not inhibit delivery of the trailers if - /// the user does not read the entire body. - %stream: func() -> result; - /// Takes ownership of `incoming-body`, and returns a `future-trailers`. - /// This function will trap if the `input-stream` child is still alive. - finish: static func(this: incoming-body) -> future-trailers; - } - - /// Represents a future which may eventaully return trailers, or an error. - /// - /// In the case that the incoming HTTP Request or Response did not have any - /// trailers, this future will resolve to the empty set of trailers once the - /// complete Request or Response body has been received. - resource future-trailers { - /// Returns a pollable which becomes ready when either the trailers have - /// been received, or an error has occured. When this pollable is ready, - /// the `get` method will return `some`. - subscribe: func() -> pollable; - /// Returns the contents of the trailers, or an error which occured, - /// once the future is ready. - /// - /// The outer `option` represents future readiness. Users can wait on this - /// `option` to become `some` using the `subscribe` method. - /// - /// The outer `result` is used to retrieve the trailers or error at most - /// once. It will be success on the first call in which the outer option - /// is `some`, and error on subsequent calls. - /// - /// The inner `result` represents that either the HTTP Request or Response - /// body, as well as any trailers, were received successfully, or that an - /// error occured receiving them. The optional `trailers` indicates whether - /// or not trailers were present in the body. - /// - /// When some `trailers` are returned by this method, the `trailers` - /// resource is immutable, and a child. Use of the `set`, `append`, or - /// `delete` methods will return an error, and the resource must be - /// dropped before the parent `future-trailers` is dropped. - get: func() -> option, error-code>>>; - } - - /// Represents an outgoing HTTP Response. - resource outgoing-response { - /// Construct an `outgoing-response`, with a default `status-code` of `200`. - /// If a different `status-code` is needed, it must be set via the - /// `set-status-code` method. - /// - /// * `headers` is the HTTP Headers for the Response. - constructor(headers: headers); - /// Get the HTTP Status Code for the Response. - status-code: func() -> status-code; - /// Set the HTTP Status Code for the Response. Fails if the status-code - /// given is not a valid http status code. - set-status-code: func(status-code: status-code) -> result; - /// Get the headers associated with the Request. - /// - /// The returned `headers` resource is immutable: `set`, `append`, and - /// `delete` operations will fail with `header-error.immutable`. - /// - /// This headers resource is a child: it must be dropped before the parent - /// `outgoing-request` is dropped, or its ownership is transfered to - /// another component by e.g. `outgoing-handler.handle`. - headers: func() -> headers; - /// Returns the resource corresponding to the outgoing Body for this Response. - /// - /// Returns success on the first call: the `outgoing-body` resource for - /// this `outgoing-response` can be retrieved at most once. Subsequent - /// calls will return error. - body: func() -> result; - } - - /// Represents an outgoing HTTP Request or Response's Body. - /// - /// A body has both its contents - a stream of bytes - and a (possibly - /// empty) set of trailers, inducating the full contents of the body - /// have been sent. This resource represents the contents as an - /// `output-stream` child resource, and the completion of the body (with - /// optional trailers) with a static function that consumes the - /// `outgoing-body` resource, and ensures that the user of this interface - /// may not write to the body contents after the body has been finished. - /// - /// If the user code drops this resource, as opposed to calling the static - /// method `finish`, the implementation should treat the body as incomplete, - /// and that an error has occured. The implementation should propogate this - /// error to the HTTP protocol by whatever means it has available, - /// including: corrupting the body on the wire, aborting the associated - /// Request, or sending a late status code for the Response. - resource outgoing-body { - /// Returns a stream for writing the body contents. - /// - /// The returned `output-stream` is a child resource: it must be dropped - /// before the parent `outgoing-body` resource is dropped (or finished), - /// otherwise the `outgoing-body` drop or `finish` will trap. - /// - /// Returns success on the first call: the `output-stream` resource for - /// this `outgoing-body` may be retrieved at most once. Subsequent calls - /// will return error. - write: func() -> result; - /// Finalize an outgoing body, optionally providing trailers. This must be - /// called to signal that the response is complete. If the `outgoing-body` - /// is dropped without calling `outgoing-body.finalize`, the implementation - /// should treat the body as corrupted. - /// - /// Fails if the body's `outgoing-request` or `outgoing-response` was - /// constructed with a Content-Length header, and the contents written - /// to the body (via `write`) does not match the value given in the - /// Content-Length. - finish: static func(this: outgoing-body, trailers: option) -> result<_, error-code>; - } - - /// Represents a future which may eventaully return an incoming HTTP - /// Response, or an error. - /// - /// This resource is returned by the `wasi:http/outgoing-handler` interface to - /// provide the HTTP Response corresponding to the sent Request. - resource future-incoming-response { - /// Returns a pollable which becomes ready when either the Response has - /// been received, or an error has occured. When this pollable is ready, - /// the `get` method will return `some`. - subscribe: func() -> pollable; - /// Returns the incoming HTTP Response, or an error, once one is ready. - /// - /// The outer `option` represents future readiness. Users can wait on this - /// `option` to become `some` using the `subscribe` method. - /// - /// The outer `result` is used to retrieve the response or error at most - /// once. It will be success on the first call in which the outer option - /// is `some`, and error on subsequent calls. - /// - /// The inner `result` represents that either the incoming HTTP Response - /// status and headers have recieved successfully, or that an error - /// occured. Errors may also occur while consuming the response body, - /// but those will be reported by the `incoming-body` and its - /// `output-stream` child. - get: func() -> option>>; - } - - /// Attempts to extract a http-related `error` from the wasi:io `error` - /// provided. - /// - /// Stream operations which return - /// `wasi:io/stream/stream-error::last-operation-failed` have a payload of - /// type `wasi:io/error/error` with more information about the operation - /// that failed. This payload can be passed through to this function to see - /// if there's http-related information about the error to return. - /// - /// Note that this function is fallible because not all io-errors are - /// http-related errors. - http-error-code: func(err: borrow) -> option; -} - -/// This interface defines a handler of incoming HTTP Requests. It should -/// be exported by components which can respond to HTTP Requests. -interface incoming-handler { - use types.{incoming-request, response-outparam}; - - /// This function is invoked with an incoming HTTP Request, and a resource - /// `response-outparam` which provides the capability to reply with an HTTP - /// Response. The response is sent by calling the `response-outparam.set` - /// method, which allows execution to continue after the response has been - /// sent. This enables both streaming to the response body, and performing other - /// work. - /// - /// The implementor of this function must write a response to the - /// `response-outparam` before returning, or else the caller will respond - /// with an error on its behalf. - handle: func(request: incoming-request, response-out: response-outparam); -} - -/// This interface defines a handler of outgoing HTTP Requests. It should be -/// imported by components which wish to make HTTP Requests. -interface outgoing-handler { - use types.{outgoing-request, request-options, future-incoming-response, error-code}; - - /// This function is invoked with an outgoing HTTP Request, and it returns - /// a resource `future-incoming-response` which represents an HTTP Response - /// which may arrive in the future. - /// - /// The `options` argument accepts optional parameters for the HTTP - /// protocol's transport layer. - /// - /// This function may return an error if the `outgoing-request` is invalid - /// or not allowed to be made. Otherwise, protocol errors are reported - /// through the `future-incoming-response`. - handle: func(request: outgoing-request, options: option) -> result; -} - -/// The `wasi:http/proxy` world captures a widely-implementable intersection of -/// hosts that includes HTTP forward and reverse proxies. Components targeting -/// this world may concurrently stream in and out any number of incoming and -/// outgoing HTTP requests. -world proxy { - import wasi:random/random@0.2.0; - import wasi:io/error@0.2.0; - import wasi:io/poll@0.2.0; - import wasi:io/streams@0.2.0; - import wasi:cli/stdout@0.2.0; - import wasi:cli/stderr@0.2.0; - import wasi:cli/stdin@0.2.0; - import wasi:clocks/monotonic-clock@0.2.0; - import types; - import outgoing-handler; - import wasi:clocks/wall-clock@0.2.0; - - export incoming-handler; -} diff --git a/go/examples/spin-basic/wit/deps/wasi-io-0.2.0/package.wit b/go/examples/spin-basic/wit/deps/wasi-io-0.2.0/package.wit deleted file mode 100644 index 962734d..0000000 --- a/go/examples/spin-basic/wit/deps/wasi-io-0.2.0/package.wit +++ /dev/null @@ -1,48 +0,0 @@ -package wasi:io@0.2.0; - -interface poll { - resource pollable { - ready: func() -> bool; - block: func(); - } - - poll: func(in: list>) -> list; -} - -interface error { - resource error { - to-debug-string: func() -> string; - } -} - -interface streams { - use error.{error}; - use poll.{pollable}; - - variant stream-error { - last-operation-failed(error), - closed, - } - - resource input-stream { - read: func(len: u64) -> result, stream-error>; - blocking-read: func(len: u64) -> result, stream-error>; - skip: func(len: u64) -> result; - blocking-skip: func(len: u64) -> result; - subscribe: func() -> pollable; - } - - resource output-stream { - check-write: func() -> result; - write: func(contents: list) -> result<_, stream-error>; - blocking-write-and-flush: func(contents: list) -> result<_, stream-error>; - flush: func() -> result<_, stream-error>; - blocking-flush: func() -> result<_, stream-error>; - subscribe: func() -> pollable; - write-zeroes: func(len: u64) -> result<_, stream-error>; - blocking-write-zeroes-and-flush: func(len: u64) -> result<_, stream-error>; - splice: func(src: borrow, len: u64) -> result; - blocking-splice: func(src: borrow, len: u64) -> result; - } -} - diff --git a/go/examples/spin-basic/wit/deps/wasi-otel-0.2.0-rc.2/logs.wit b/go/examples/spin-basic/wit/deps/wasi-otel-0.2.0-rc.2/logs.wit deleted file mode 100644 index 91aa219..0000000 --- a/go/examples/spin-basic/wit/deps/wasi-otel-0.2.0-rc.2/logs.wit +++ /dev/null @@ -1,36 +0,0 @@ -interface logs { - use types.{instrumentation-scope, %resource, value, key-value}; - use tracing.{span-id, trace-id, trace-flags}; - use wasi:clocks/wall-clock@0.2.0.{datetime}; - - /// Called when a log is emitted. - on-emit: func(data: log-record); - - /// Represents the recording of an event. - record log-record { - /// Time when the event occurred. - timestamp: option, - /// Time when the event was observed. - observed-timestamp: option, - /// The severity text(also known as log level). - severity-text: option, - /// The numerical value of the severity ranging from 1-24. - severity-number: option, - /// The body of the log record. - body: option, - /// Additional information about the specific event occurrence. - attributes: option>, - /// Name that identifies the class / type of event. - event-name: option, - /// Describes the source of the log. - %resource: option<%resource>, - /// Describes the scope that emitted the log. - instrumentation-scope: option, - /// Request trace id. - trace-id: option, - /// Request span id. - span-id: option, - /// W3C trace flag. - trace-flags: option, - } -} diff --git a/go/examples/spin-basic/wit/deps/wasi-otel-0.2.0-rc.2/metrics.wit b/go/examples/spin-basic/wit/deps/wasi-otel-0.2.0-rc.2/metrics.wit deleted file mode 100644 index cd84cec..0000000 --- a/go/examples/spin-basic/wit/deps/wasi-otel-0.2.0-rc.2/metrics.wit +++ /dev/null @@ -1,256 +0,0 @@ -interface metrics { - use wasi:clocks/wall-clock@0.2.0.{datetime}; - use wasi:clocks/monotonic-clock@0.2.0.{duration}; - use types.{key-value, instrumentation-scope, %resource}; - use tracing.{span-id, trace-id}; - - /// Exports a resource's metric data. - %export: func(metrics: resource-metrics) -> result<_, error>; - - /// An error resulting from `export` being called. - type error = string; - - /// A collection of `scope-metrics` and the associated `resource` that created them. - record resource-metrics { - /// The entity that collected the metrics. - %resource: %resource, - /// The collection of metrics with unique `instrumentation-scope`s. - scope-metrics: list, - } - - /// A collection of `metric`s produced by a meter. - record scope-metrics { - /// The instrumentation scope that the meter was created with. - scope: instrumentation-scope, - /// The list of aggregations created by the meter. - metrics: list, - } - - /// A collection of one or more aggregated time series from a metric. - record metric { - /// The name of the metric that created this data. - name: string, - /// The description of the metric, which can be used in documentation. - description: string, - /// The unit in which the metric reports. - unit: string, - /// The aggregated data from a metric. - data: metric-data - } - - /// Metric data for all types. - variant metric-data { - /// Metric data for an f64 gauge. - f64-gauge(gauge), - /// Metric data for an f64 sum. - f64-sum(sum), - /// Metric data for an f64 histogram. - f64-histogram(histogram), - /// Metric data for an f64 exponential-histogram. - f64-exponential-histogram(exponential-histogram), - /// Metric data for an u64 gauge. - u64-gauge(gauge), - /// Metric data for an u64 sum. - u64-sum(sum), - /// Metric data for an u64 histogram. - u64-histogram(histogram), - /// Metric data for an u64 exponential-histogram. - u64-exponential-histogram(exponential-histogram), - /// Metric data for an s64 gauge. - s64-gauge(gauge), - /// Metric data for an s64 sum. - s64-sum(sum), - /// Metric data for an s64 histogram. - s64-histogram(histogram), - /// Metric data for an s64 exponential-histogram. - s64-exponential-histogram(exponential-histogram), - } - - /// A measurement of the current value of an instrument. - record gauge { - /// Represents individual aggregated measurements with unique attributes. - data-points: list, - /// The time when the time series was started. - start-time: option, - /// The time when the time series was recorded. - time: datetime, - } - - /// A single data point in a time series to be associated with a `gauge`. - record gauge-data-point { - /// `attributes` is the set of key value pairs that uniquely identify the - /// time series. - attributes: list, - /// The value of this data point. - value: metric-number, - /// The sampled `exemplar`s collected during the time series. - exemplars: list, - } - - /// Represents the sum of all measurements of values from an instrument. - record sum { - /// Represents individual aggregated measurements with unique attributes. - data-points: list, - /// The time when the time series was started. - start-time: datetime, - /// The time when the time series was recorded. - time: datetime, - /// Describes if the aggregation is reported as the change from the last report - /// time, or the cumulative changes since a fixed start time. - temporality: temporality, - /// Whether this aggregation only increases or decreases. - is-monotonic: bool, - } - - /// A single data point in a time series to be associated with a `sum`. - record sum-data-point { - /// `attributes` is the set of key value pairs that uniquely identify the - /// time series. - attributes: list, - /// The value of this data point. - value: metric-number, - /// The sampled `exemplar`s collected during the time series. - exemplars: list, - } - - /// Represents the histogram of all measurements of values from an instrument. - record histogram { - /// Individual aggregated measurements with unique attributes. - data-points: list, - /// The time when the time series was started. - start-time: datetime, - /// The time when the time series was recorded. - time: datetime, - /// Describes if the aggregation is reported as the change from the last report - /// time, or the cumulative changes since a fixed start time. - temporality: temporality, - } - - /// A single data point in a time series to be associated with a `histogram`. - record histogram-data-point { - /// The set of key value pairs that uniquely identify the time series. - attributes: list, - /// The number of updates this histogram has been calculated with. - count: u64, - /// The upper bounds of the buckets of the histogram. - bounds: list, - /// The count of each of the buckets. - bucket-counts: list, - /// The minimum value recorded. - min: option, - /// The maximum value recorded. - max: option, - /// The sum of the values recorded - sum: metric-number, - /// The sampled `exemplar`s collected during the time series. - exemplars: list, - } - - /// The histogram of all measurements of values from an instrument. - record exponential-histogram { - /// The individual aggregated measurements with unique attributes. - data-points: list, - /// When the time series was started. - start-time: datetime, - /// The time when the time series was recorded. - time: datetime, - /// Describes if the aggregation is reported as the change from the last report - /// time, or the cumulative changes since a fixed start time. - temporality: temporality, - } - - /// A single data point in a time series to be associated with an `exponential-histogram `. - record exponential-histogram-data-point { - /// The set of key value pairs that uniquely identify the time series. - attributes: list, - /// The number of updates this histogram has been calculated with. - count: u64, - /// The minimum value recorded. - min: option, - /// The maximum value recorded. - max: option, - /// The maximum value recorded. - sum: metric-number, - /// Describes the resolution of the histogram. - /// - /// Boundaries are located at powers of the base, where: - /// - /// base = 2 ^ (2 ^ -scale) - scale: s8, - /// The number of values whose absolute value is less than or equal to - /// `zero_threshold`. - /// - /// When `zero_threshold` is `0`, this is the number of values that cannot be - /// expressed using the standard exponential formula as well as values that have - /// been rounded to zero. - zero-count: u64, - /// The range of positive value bucket counts. - positive-bucket: exponential-bucket, - /// The range of negative value bucket counts. - negative-bucket: exponential-bucket, - /// The width of the zero region. - /// - /// Where the zero region is defined as the closed interval - /// [-zero_threshold, zero_threshold]. - zero-threshold: f64, - /// The sampled exemplars collected during the time series. - exemplars: list, - } - - /// A set of bucket counts, encoded in a contiguous array of counts. - record exponential-bucket { - /// The bucket index of the first entry in the `counts` list. - offset: s32, - /// A list where `counts[i]` carries the count of the bucket at index `offset + i`. - /// - /// `counts[i]` is the count of values greater than base^(offset+i) and less than - /// or equal to base^(offset+i+1). - counts: list, - } - - /// A measurement sampled from a time series providing a typical example. - record exemplar { - /// The attributes recorded with the measurement but filtered out of the - /// time series' aggregated data. - filtered-attributes: list, - /// The time when the measurement was recorded. - time: datetime, - /// The measured value. - value: metric-number, - /// The ID of the span that was active during the measurement. - /// - /// If no span was active or the span was not sampled this will be empty. - span-id: span-id, - /// The ID of the trace the active span belonged to during the measurement. - /// - /// If no span was active or the span was not sampled this will be empty. - trace-id: trace-id, - } - - /// Defines the window that an aggregation was calculated over. - enum temporality { - /// A measurement interval that continues to expand forward in time from a - /// starting point. - /// - /// New measurements are added to all previous measurements since a start time. - /// - /// This is the default temporality. - cumulative, - /// A measurement interval that resets each cycle. - /// - /// Measurements from one cycle are recorded independently, measurements from - /// other cycles do not affect them. - delta, - /// Configures Synchronous Counter and Histogram instruments to use - /// Delta aggregation temporality, which allows them to shed memory - /// following a cardinality explosion, thus use less memory. - low-memory, - } - - /// The number types available for any given instrument. - variant metric-number { - %f64(f64), - %s64(s64), - %u64(u64), - } -} diff --git a/go/examples/spin-basic/wit/deps/wasi-otel-0.2.0-rc.2/tracing.wit b/go/examples/spin-basic/wit/deps/wasi-otel-0.2.0-rc.2/tracing.wit deleted file mode 100644 index 1143e9b..0000000 --- a/go/examples/spin-basic/wit/deps/wasi-otel-0.2.0-rc.2/tracing.wit +++ /dev/null @@ -1,122 +0,0 @@ -interface tracing { - use wasi:clocks/wall-clock@0.2.0.{datetime}; - use types.{key-value, instrumentation-scope}; - - /// Called when a span is started. - on-start: func(context: span-context); - - /// Called when a span is ended. - on-end: func(span: span-data); - - /// Returns the span context of the host. - outer-span-context: func() -> span-context; - - /// The data associated with a span. - record span-data { - /// Span context. - span-context: span-context, - /// Span parent id. - parent-span-id: string, - /// Span kind. - span-kind: span-kind, - // Span name. - name: string, - /// Span start time. - start-time: datetime, - /// Span end time. - end-time: datetime, - /// Span attributes. - attributes: list, - /// Span events. - events: list, - /// Span Links. - links: list, - /// Span status. - status: status, - /// Instrumentation scope that produced this span. - instrumentation-scope: instrumentation-scope, - /// Number of attributes dropped by the span due to limits being reached. - dropped-attributes: u32, - /// Number of events dropped by the span due to limits being reached. - dropped-events: u32, - /// Number of links dropped by the span due to limits being reached. - dropped-links: u32, - } - - /// Identifying trace information about a span that can be serialized and propagated. - record span-context { - /// The `trace-id` for this `span-context`. - trace-id: trace-id, - /// The `span-id` for this `span-context`. - span-id: span-id, - /// The `trace-flags` for this `span-context`. - trace-flags: trace-flags, - /// Whether this `span-context` was propagated from a remote parent. - is-remote: bool, - /// The `trace-state` for this `span-context`. - trace-state: trace-state, - } - - /// The trace that this `span-context` belongs to. - /// - /// 16 bytes encoded as a hexadecimal string. - type trace-id = string; - - /// The id of this `span-context`. - /// - /// 8 bytes encoded as a hexadecimal string. - type span-id = string; - - /// Flags that can be set on a `span-context`. - flags trace-flags { - /// Whether the `span` should be sampled or not. - sampled, - } - - /// Carries system-specific configuration data, represented as a list of key-value pairs. `trace-state` allows multiple tracing systems to participate in the same trace. - /// - /// If any invalid keys or values are provided then the `trace-state` will be treated as an empty list. - type trace-state = list>; - - /// Describes the relationship between the Span, its parents, and its children in a trace. - enum span-kind { - /// Indicates that the span describes a request to some remote service. This span is usually the parent of a remote server span and does not end until the response is received. - client, - /// Indicates that the span covers server-side handling of a synchronous RPC or other remote request. This span is often the child of a remote client span that was expected to wait for a response. - server, - /// Indicates that the span describes the initiators of an asynchronous request. This parent span will often end before the corresponding child consumer span, possibly even before the child span starts. In messaging scenarios with batching, tracing individual messages requires a new producer span per message to be created. - producer, - /// Indicates that the span describes a child of an asynchronous consumer request. - consumer, - /// Default value. Indicates that the span represents an internal operation within an application, as opposed to an operations with remote parents or children. - internal - } - - /// An event describing a specific moment in time on a span and associated attributes. - record event { - /// Event name. - name: string, - /// Event time. - time: datetime, - /// Event attributes. - attributes: list, - } - - /// Describes a relationship to another `span`. - record link { - /// Denotes which `span` to link to. - span-context: span-context, - /// Attributes describing the link. - attributes: list, - } - - /// The `status` of a `span`. - variant status { - /// The default status. - unset, - /// The operation has been validated by an Application developer or Operator to have completed successfully. - ok, - /// The operation contains an error with a description. - error(string), - } -} diff --git a/go/examples/spin-basic/wit/deps/wasi-otel-0.2.0-rc.2/types.wit b/go/examples/spin-basic/wit/deps/wasi-otel-0.2.0-rc.2/types.wit deleted file mode 100644 index 6fa87b5..0000000 --- a/go/examples/spin-basic/wit/deps/wasi-otel-0.2.0-rc.2/types.wit +++ /dev/null @@ -1,46 +0,0 @@ -interface types { - /// A key-value pair describing an attribute. - record key-value { - /// The attribute name. - key: key, - /// The attribute value. - value: value, - } - - /// The key part of attribute `key-value` pairs. - type key = string; - - /// The value part of attribute `key-value` pairs. - /// - /// This corresponds with the `AnyValue` type defined in the [attribute spec](https://opentelemetry.io/docs/specs/otel/common/#anyvalue). - /// Because WIT doesn't support recursive types, the data needs to be serialized. JSON is used as the encoding format. - /// - /// Byte arrays require special encoding since JSON cannot distinguish them from number arrays. - /// They are base64-encoded with a prefix that follows the Data URI RFC 2397 convention: - /// `data:application/octet-stream;base64,` - type value = string; - - /// An immutable representation of the entity producing telemetry as attributes. - record %resource { - /// Attributes that identify the resource. - attributes: list, - /// The schema URL to be recorded in the emitted resource. - schema-url: option, - } - - /// Describes the instrumentation scope that produced telemetry. - record instrumentation-scope { - /// Name of the instrumentation scope. - name: string, - - /// The library version. - version: option, - - /// Schema URL used by this library. - /// https://opentelemetry.io/docs/specs/otel/schemas/#schema-url - schema-url: option, - - /// Specifies the instrumentation scope attributes to associate with emitted telemetry. - attributes: list, - } -} diff --git a/go/examples/spin-basic/wit/deps/wasi-otel-0.2.0-rc.2/world.wit b/go/examples/spin-basic/wit/deps/wasi-otel-0.2.0-rc.2/world.wit deleted file mode 100644 index f2e9b85..0000000 --- a/go/examples/spin-basic/wit/deps/wasi-otel-0.2.0-rc.2/world.wit +++ /dev/null @@ -1,8 +0,0 @@ -package wasi:otel@0.2.0-rc.2; - -world imports { - import types; - import tracing; - import metrics; - import logs; -} diff --git a/go/examples/spin-basic/wit/deps/wasi-random-0.2.0/package.wit b/go/examples/spin-basic/wit/deps/wasi-random-0.2.0/package.wit deleted file mode 100644 index 4132731..0000000 --- a/go/examples/spin-basic/wit/deps/wasi-random-0.2.0/package.wit +++ /dev/null @@ -1,8 +0,0 @@ -package wasi:random@0.2.0; - -interface random { - get-random-bytes: func(len: u64) -> list; - - get-random-u64: func() -> u64; -} - diff --git a/go/examples/spin-basic/wit/world.wit b/go/examples/spin-basic/wit/world.wit deleted file mode 100644 index b6f901a..0000000 --- a/go/examples/spin-basic/wit/world.wit +++ /dev/null @@ -1,8 +0,0 @@ -// This is only here to satisfy the build tools. -package example:test@0.1.0; - -world http-trigger { - export wasi:http/incoming-handler@0.2.0; - include wasi:otel/imports@0.2.0-rc.2; - import fermyon:spin/key-value@2.0.0; -} diff --git a/go/go.mod b/go/go.mod index dda46ca..103897e 100644 --- a/go/go.mod +++ b/go/go.mod @@ -2,11 +2,9 @@ module github.com/calebschoepp/opentelemetry-wasi go 1.25.5 -replace github.com/bytecodealliance/wit-bindgen => github.com/bytecodealliance/wit-bindgen/crates/go/src/package v0.51.0 - require ( - github.com/bytecodealliance/wit-bindgen v0.0.0-00010101000000-000000000000 github.com/stretchr/testify v1.11.1 + go.bytecodealliance.org/pkg v0.2.1 go.opentelemetry.io/otel v1.39.0 go.opentelemetry.io/otel/log v0.14.0 go.opentelemetry.io/otel/sdk v1.39.0 @@ -16,10 +14,13 @@ require ( ) require ( + github.com/apparentlymart/go-userdirs v0.0.0-20200915174352-b0c018a67c13 // indirect + github.com/bytecodealliance/componentize-go v0.3.1 // indirect github.com/cespare/xxhash/v2 v2.3.0 // indirect github.com/davecgh/go-spew v1.1.1 // indirect github.com/go-logr/logr v1.4.3 // indirect github.com/go-logr/stdr v1.2.2 // indirect + github.com/gofrs/flock v0.13.0 // indirect github.com/google/uuid v1.6.0 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect go.opentelemetry.io/auto/sdk v1.2.1 // indirect @@ -27,3 +28,5 @@ require ( golang.org/x/sys v0.39.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) + +tool github.com/bytecodealliance/componentize-go diff --git a/go/go.sum b/go/go.sum index 3a2cf08..f974499 100644 --- a/go/go.sum +++ b/go/go.sum @@ -1,5 +1,7 @@ -github.com/bytecodealliance/wit-bindgen/crates/go/src/package v0.51.0 h1:fbwpkAmU6eZnDQpBHrdQwPXi5atE0KSfjU8zwFkClnw= -github.com/bytecodealliance/wit-bindgen/crates/go/src/package v0.51.0/go.mod h1:MUXxhOBN0hAtqHjc9/9XAEiXcGhcwYL6PeDXkKwVZN0= +github.com/apparentlymart/go-userdirs v0.0.0-20200915174352-b0c018a67c13 h1:JtuelWqyixKApmXm3qghhZ7O96P6NKpyrlSIe8Rwnhw= +github.com/apparentlymart/go-userdirs v0.0.0-20200915174352-b0c018a67c13/go.mod h1:7kfpUbyCdGJ9fDRCp3fopPQi5+cKNHgTE4ZuNrO71Cw= +github.com/bytecodealliance/componentize-go v0.3.1 h1:uXfSgjvIhYun74gcxnOxAO3pUKQ4SWmStxlROZLUoRA= +github.com/bytecodealliance/componentize-go v0.3.1/go.mod h1:w1QFtPLGI9o38epvMOPyCKbMc7q7GJ7yZhIvhGTpzA0= github.com/cespare/xxhash/v2 v2.3.0 h1:UL815xU9SqsFlibzuggzjXhog7bL6oX9BbNZnL2UFvs= github.com/cespare/xxhash/v2 v2.3.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= @@ -9,6 +11,9 @@ github.com/go-logr/logr v1.4.3 h1:CjnDlHq8ikf6E492q6eKboGOC0T8CDaOvkHCIg8idEI= github.com/go-logr/logr v1.4.3/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY= github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= +github.com/gofrs/flock v0.13.0 h1:95JolYOvGMqeH31+FC7D2+uULf6mG61mEZ/A8dRYMzw= +github.com/gofrs/flock v0.13.0/go.mod h1:jxeyy9R1auM5S6JYDBhDt+E2TCo7DkratH4Pgi8P+Z0= +github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= github.com/google/go-cmp v0.7.0 h1:wk8382ETsv4JYUZwIsn6YpYiWiBsYLSJiTsyBybVuN8= github.com/google/go-cmp v0.7.0/go.mod h1:pXiqmnSA92OHEEa9HXL2W4E7lf9JzCmGVUdgjX3N/iU= github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0= @@ -23,6 +28,8 @@ github.com/rogpeppe/go-internal v1.14.1 h1:UQB4HGPB6osV0SQTLymcB4TgvyWu6ZyliaW0t github.com/rogpeppe/go-internal v1.14.1/go.mod h1:MaRKkUm5W0goXpeCfT7UZI6fk/L7L7so1lCWt35ZSgc= github.com/stretchr/testify v1.11.1 h1:7s2iGBzp5EwR7/aIZr8ao5+dra3wiQyKjjFuvgVKu7U= github.com/stretchr/testify v1.11.1/go.mod h1:wZwfW3scLgRK+23gO65QZefKpKQRnfz6sD981Nm4B6U= +go.bytecodealliance.org/pkg v0.2.1 h1:TdRagooIcCW3UmlKqVO4cDR3GNDyfDnbiBzGI6TOvyg= +go.bytecodealliance.org/pkg v0.2.1/go.mod h1:OjA+V8g3uUFixeCKFfamm6sYhTJdg8fvwEdJ2GO0GSk= go.opentelemetry.io/auto/sdk v1.2.1 h1:jXsnJ4Lmnqd11kwkBV2LgLoFMZKizbCi5fNZ/ipaZ64= go.opentelemetry.io/auto/sdk v1.2.1/go.mod h1:KRTj+aOaElaLi+wW1kO/DZRXwkF4C5xPbEe3ZiIhN7Y= go.opentelemetry.io/otel v1.39.0 h1:8yPrr/S0ND9QEfTfdP9V+SiwT4E0G7Y5MO7p85nis48= @@ -41,6 +48,7 @@ go.opentelemetry.io/otel/trace v1.39.0 h1:2d2vfpEDmCJ5zVYz7ijaJdOF59xLomrvj7bjt6 go.opentelemetry.io/otel/trace v1.39.0/go.mod h1:88w4/PnZSazkGzz/w84VHpQafiU4EtqqlVdxWy+rNOA= go.uber.org/goleak v1.3.0 h1:2K3zAYmnTNqV73imy9J1T3WC+gmCePx2hEGkimedGto= go.uber.org/goleak v1.3.0/go.mod h1:CoHD4mav9JJNrW/WLlf7HGZPjdw8EucARQHekz1X6bE= +golang.org/x/sys v0.0.0-20190509141414-a5b02f93d862/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.39.0 h1:CvCKL8MeisomCi6qNZ+wbb0DN9E5AATixKsvNtMoMFk= golang.org/x/sys v0.39.0/go.mod h1:OgkHotnGiDImocRcuBABYBEXf8A9a87e/uXjp9XT3ks= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= diff --git a/go/internal/wasi_clocks_monotonic_clock/empty.s b/go/internal/wasi_clocks_monotonic_clock/empty.s new file mode 100644 index 0000000..308ab60 --- /dev/null +++ b/go/internal/wasi_clocks_monotonic_clock/empty.s @@ -0,0 +1,3 @@ +// This file exists for testing this package without WebAssembly, +// allowing empty function bodies with a //go:wasmimport directive. +// See https://pkg.go.dev/cmd/compile for more information. \ No newline at end of file diff --git a/go/internal/wasi_clocks_monotonic_clock/wit_bindings.go b/go/internal/wasi_clocks_monotonic_clock/wit_bindings.go index cd789ed..8a72ab7 100644 --- a/go/internal/wasi_clocks_monotonic_clock/wit_bindings.go +++ b/go/internal/wasi_clocks_monotonic_clock/wit_bindings.go @@ -1,4 +1,4 @@ -// Generated by `wit-bindgen` 0.51.0. DO NOT EDIT! +// Generated by `wit-bindgen` 0.54.0. DO NOT EDIT! // // This code was generated from the following packages: // wasi:io@0.2.0 diff --git a/go/internal/wasi_clocks_wall_clock/empty.s b/go/internal/wasi_clocks_wall_clock/empty.s new file mode 100644 index 0000000..308ab60 --- /dev/null +++ b/go/internal/wasi_clocks_wall_clock/empty.s @@ -0,0 +1,3 @@ +// This file exists for testing this package without WebAssembly, +// allowing empty function bodies with a //go:wasmimport directive. +// See https://pkg.go.dev/cmd/compile for more information. \ No newline at end of file diff --git a/go/internal/wasi_clocks_wall_clock/wit_bindings.go b/go/internal/wasi_clocks_wall_clock/wit_bindings.go index 4f907e8..712f336 100644 --- a/go/internal/wasi_clocks_wall_clock/wit_bindings.go +++ b/go/internal/wasi_clocks_wall_clock/wit_bindings.go @@ -1,4 +1,4 @@ -// Generated by `wit-bindgen` 0.51.0. DO NOT EDIT! +// Generated by `wit-bindgen` 0.54.0. DO NOT EDIT! // // This code was generated from the following packages: // wasi:io@0.2.0 @@ -8,7 +8,7 @@ package wasi_clocks_wall_clock import ( - "github.com/bytecodealliance/wit-bindgen/wit_runtime" + witRuntime "go.bytecodealliance.org/pkg/wit/runtime" "runtime" "unsafe" ) @@ -26,7 +26,7 @@ func Now() Datetime { pinner := &runtime.Pinner{} defer pinner.Unpin() - returnArea := uintptr(wit_runtime.Allocate(pinner, 16, 8)) + returnArea := uintptr(witRuntime.Allocate(pinner, 16, 8)) wasm_import_now(returnArea) result := Datetime{uint64(*(*int64)(unsafe.Add(unsafe.Pointer(returnArea), 0))), uint32(*(*int32)(unsafe.Add(unsafe.Pointer(returnArea), 8)))} return result @@ -40,7 +40,7 @@ func Resolution() Datetime { pinner := &runtime.Pinner{} defer pinner.Unpin() - returnArea := uintptr(wit_runtime.Allocate(pinner, 16, 8)) + returnArea := uintptr(witRuntime.Allocate(pinner, 16, 8)) wasm_import_resolution(returnArea) result := Datetime{uint64(*(*int64)(unsafe.Add(unsafe.Pointer(returnArea), 0))), uint32(*(*int32)(unsafe.Add(unsafe.Pointer(returnArea), 8)))} return result diff --git a/go/internal/wasi_io_poll/empty.s b/go/internal/wasi_io_poll/empty.s new file mode 100644 index 0000000..308ab60 --- /dev/null +++ b/go/internal/wasi_io_poll/empty.s @@ -0,0 +1,3 @@ +// This file exists for testing this package without WebAssembly, +// allowing empty function bodies with a //go:wasmimport directive. +// See https://pkg.go.dev/cmd/compile for more information. \ No newline at end of file diff --git a/go/internal/wasi_io_poll/wit_bindings.go b/go/internal/wasi_io_poll/wit_bindings.go index 38ae70e..393b731 100644 --- a/go/internal/wasi_io_poll/wit_bindings.go +++ b/go/internal/wasi_io_poll/wit_bindings.go @@ -1,4 +1,4 @@ -// Generated by `wit-bindgen` 0.51.0. DO NOT EDIT! +// Generated by `wit-bindgen` 0.54.0. DO NOT EDIT! // // This code was generated from the following packages: // wasi:io@0.2.0 @@ -8,7 +8,7 @@ package wasi_io_poll import ( - "github.com/bytecodealliance/wit-bindgen/wit_runtime" + witRuntime "go.bytecodealliance.org/pkg/wit/runtime" "runtime" "unsafe" ) @@ -17,7 +17,7 @@ import ( func resourceDropPollable(handle int32) type Pollable struct { - handle *wit_runtime.Handle + handle *witRuntime.Handle } func (self *Pollable) TakeHandle() int32 { @@ -40,7 +40,7 @@ func (self *Pollable) Drop() { } func PollableFromOwnHandle(handleValue int32) *Pollable { - handle := wit_runtime.MakeHandle(handleValue) + handle := witRuntime.MakeHandle(handleValue) value := &Pollable{handle} runtime.AddCleanup(value, func(_ int) { handleValue := handle.TakeOrNil() @@ -52,7 +52,8 @@ func PollableFromOwnHandle(handleValue int32) *Pollable { } func PollableFromBorrowHandle(handleValue int32) *Pollable { - return PollableFromOwnHandle(handleValue) + handle := witRuntime.MakeHandle(handleValue) + return &Pollable{handle} } //go:wasmimport wasi:io/poll@0.2.0 [method]pollable.ready @@ -81,10 +82,10 @@ func Poll(in []*Pollable) []uint32 { pinner := &runtime.Pinner{} defer pinner.Unpin() - returnArea := uintptr(wit_runtime.Allocate(pinner, (2 * 4), 4)) + returnArea := uintptr(witRuntime.Allocate(pinner, (2 * 4), 4)) slice := in length := uint32(len(slice)) - result := wit_runtime.Allocate(pinner, uintptr(length*4), 4) + result := witRuntime.Allocate(pinner, uintptr(length*4), 4) for index, element := range slice { base := unsafe.Add(result, index*4) *(*int32)(unsafe.Add(unsafe.Pointer(base), 0)) = (element).Handle() diff --git a/go/internal/wasi_otel_logs/empty.s b/go/internal/wasi_otel_logs/empty.s new file mode 100644 index 0000000..308ab60 --- /dev/null +++ b/go/internal/wasi_otel_logs/empty.s @@ -0,0 +1,3 @@ +// This file exists for testing this package without WebAssembly, +// allowing empty function bodies with a //go:wasmimport directive. +// See https://pkg.go.dev/cmd/compile for more information. \ No newline at end of file diff --git a/go/internal/wasi_otel_logs/wit_bindings.go b/go/internal/wasi_otel_logs/wit_bindings.go index c22f880..74e242c 100644 --- a/go/internal/wasi_otel_logs/wit_bindings.go +++ b/go/internal/wasi_otel_logs/wit_bindings.go @@ -1,4 +1,4 @@ -// Generated by `wit-bindgen` 0.51.0. DO NOT EDIT! +// Generated by `wit-bindgen` 0.54.0. DO NOT EDIT! // // This code was generated from the following packages: // wasi:io@0.2.0 @@ -8,11 +8,11 @@ package wasi_otel_logs import ( - "github.com/bytecodealliance/wit-bindgen/wit_runtime" - "github.com/bytecodealliance/wit-bindgen/wit_types" "github.com/calebschoepp/opentelemetry-wasi/internal/wasi_clocks_wall_clock" "github.com/calebschoepp/opentelemetry-wasi/internal/wasi_otel_tracing" "github.com/calebschoepp/opentelemetry-wasi/internal/wasi_otel_types" + witRuntime "go.bytecodealliance.org/pkg/wit/runtime" + witTypes "go.bytecodealliance.org/pkg/wit/types" "runtime" "unsafe" ) @@ -29,29 +29,29 @@ type Datetime = wasi_clocks_wall_clock.Datetime // Represents the recording of an event. type LogRecord struct { // Time when the event occurred. - Timestamp wit_types.Option[wasi_clocks_wall_clock.Datetime] + Timestamp witTypes.Option[wasi_clocks_wall_clock.Datetime] // Time when the event was observed. - ObservedTimestamp wit_types.Option[wasi_clocks_wall_clock.Datetime] + ObservedTimestamp witTypes.Option[wasi_clocks_wall_clock.Datetime] // The severity text(also known as log level). - SeverityText wit_types.Option[string] + SeverityText witTypes.Option[string] // The numerical value of the severity ranging from 1-24. - SeverityNumber wit_types.Option[uint8] + SeverityNumber witTypes.Option[uint8] // The body of the log record. - Body wit_types.Option[string] + Body witTypes.Option[string] // Additional information about the specific event occurrence. - Attributes wit_types.Option[[]wasi_otel_types.KeyValue] + Attributes witTypes.Option[[]wasi_otel_types.KeyValue] // Name that identifies the class / type of event. - EventName wit_types.Option[string] + EventName witTypes.Option[string] // Describes the source of the log. - Resource wit_types.Option[wasi_otel_types.Resource] + Resource witTypes.Option[wasi_otel_types.Resource] // Describes the scope that emitted the log. - InstrumentationScope wit_types.Option[wasi_otel_types.InstrumentationScope] + InstrumentationScope witTypes.Option[wasi_otel_types.InstrumentationScope] // Request trace id. - TraceId wit_types.Option[string] + TraceId witTypes.Option[string] // Request span id. - SpanId wit_types.Option[string] + SpanId witTypes.Option[string] // W3C trace flag. - TraceFlags wit_types.Option[wasi_otel_tracing.TraceFlags] + TraceFlags witTypes.Option[wasi_otel_tracing.TraceFlags] } //go:wasmimport wasi:otel/logs@0.2.0-rc.2 on-emit @@ -61,13 +61,13 @@ func OnEmit(data LogRecord) { pinner := &runtime.Pinner{} defer pinner.Unpin() - returnArea := uintptr(wit_runtime.Allocate(pinner, (56 + 36*4), 8)) + returnArea := uintptr(witRuntime.Allocate(pinner, (56 + 36*4), 8)) switch (data).Timestamp.Tag() { - case wit_types.OptionNone: + case witTypes.OptionNone: *(*int8)(unsafe.Add(unsafe.Pointer(returnArea), 0)) = int8(int32(0)) - case wit_types.OptionSome: + case witTypes.OptionSome: payload := (data).Timestamp.Some() *(*int8)(unsafe.Add(unsafe.Pointer(returnArea), 0)) = int8(int32(1)) *(*int64)(unsafe.Add(unsafe.Pointer(returnArea), 8)) = int64((payload).Seconds) @@ -78,10 +78,10 @@ func OnEmit(data LogRecord) { } switch (data).ObservedTimestamp.Tag() { - case wit_types.OptionNone: + case witTypes.OptionNone: *(*int8)(unsafe.Add(unsafe.Pointer(returnArea), 24)) = int8(int32(0)) - case wit_types.OptionSome: + case witTypes.OptionSome: payload := (data).ObservedTimestamp.Some() *(*int8)(unsafe.Add(unsafe.Pointer(returnArea), 24)) = int8(int32(1)) *(*int64)(unsafe.Add(unsafe.Pointer(returnArea), 32)) = int64((payload).Seconds) @@ -92,10 +92,10 @@ func OnEmit(data LogRecord) { } switch (data).SeverityText.Tag() { - case wit_types.OptionNone: + case witTypes.OptionNone: *(*int8)(unsafe.Add(unsafe.Pointer(returnArea), 48)) = int8(int32(0)) - case wit_types.OptionSome: + case witTypes.OptionSome: payload := (data).SeverityText.Some() *(*int8)(unsafe.Add(unsafe.Pointer(returnArea), 48)) = int8(int32(1)) utf8 := unsafe.Pointer(unsafe.StringData(payload)) @@ -108,10 +108,10 @@ func OnEmit(data LogRecord) { } switch (data).SeverityNumber.Tag() { - case wit_types.OptionNone: + case witTypes.OptionNone: *(*int8)(unsafe.Add(unsafe.Pointer(returnArea), (48 + 3*4))) = int8(int32(0)) - case wit_types.OptionSome: + case witTypes.OptionSome: payload := (data).SeverityNumber.Some() *(*int8)(unsafe.Add(unsafe.Pointer(returnArea), (48 + 3*4))) = int8(int32(1)) *(*int8)(unsafe.Add(unsafe.Pointer(returnArea), (49 + 3*4))) = int8(int32(payload)) @@ -121,10 +121,10 @@ func OnEmit(data LogRecord) { } switch (data).Body.Tag() { - case wit_types.OptionNone: + case witTypes.OptionNone: *(*int8)(unsafe.Add(unsafe.Pointer(returnArea), (48 + 4*4))) = int8(int32(0)) - case wit_types.OptionSome: + case witTypes.OptionSome: payload := (data).Body.Some() *(*int8)(unsafe.Add(unsafe.Pointer(returnArea), (48 + 4*4))) = int8(int32(1)) utf80 := unsafe.Pointer(unsafe.StringData(payload)) @@ -137,15 +137,15 @@ func OnEmit(data LogRecord) { } switch (data).Attributes.Tag() { - case wit_types.OptionNone: + case witTypes.OptionNone: *(*int8)(unsafe.Add(unsafe.Pointer(returnArea), (48 + 7*4))) = int8(int32(0)) - case wit_types.OptionSome: + case witTypes.OptionSome: payload := (data).Attributes.Some() *(*int8)(unsafe.Add(unsafe.Pointer(returnArea), (48 + 7*4))) = int8(int32(1)) slice := payload length := uint32(len(slice)) - result := wit_runtime.Allocate(pinner, uintptr(length*(4*4)), 4) + result := witRuntime.Allocate(pinner, uintptr(length*(4*4)), 4) for index, element := range slice { base := unsafe.Add(result, index*(4*4)) utf81 := unsafe.Pointer(unsafe.StringData((element).Key)) @@ -167,10 +167,10 @@ func OnEmit(data LogRecord) { } switch (data).EventName.Tag() { - case wit_types.OptionNone: + case witTypes.OptionNone: *(*int8)(unsafe.Add(unsafe.Pointer(returnArea), (48 + 10*4))) = int8(int32(0)) - case wit_types.OptionSome: + case witTypes.OptionSome: payload := (data).EventName.Some() *(*int8)(unsafe.Add(unsafe.Pointer(returnArea), (48 + 10*4))) = int8(int32(1)) utf83 := unsafe.Pointer(unsafe.StringData(payload)) @@ -183,15 +183,15 @@ func OnEmit(data LogRecord) { } switch (data).Resource.Tag() { - case wit_types.OptionNone: + case witTypes.OptionNone: *(*int8)(unsafe.Add(unsafe.Pointer(returnArea), (48 + 13*4))) = int8(int32(0)) - case wit_types.OptionSome: + case witTypes.OptionSome: payload := (data).Resource.Some() *(*int8)(unsafe.Add(unsafe.Pointer(returnArea), (48 + 13*4))) = int8(int32(1)) slice6 := (payload).Attributes length8 := uint32(len(slice6)) - result7 := wit_runtime.Allocate(pinner, uintptr(length8*(4*4)), 4) + result7 := witRuntime.Allocate(pinner, uintptr(length8*(4*4)), 4) for index, element := range slice6 { base := unsafe.Add(result7, index*(4*4)) utf84 := unsafe.Pointer(unsafe.StringData((element).Key)) @@ -209,10 +209,10 @@ func OnEmit(data LogRecord) { *(*uint32)(unsafe.Add(unsafe.Pointer(returnArea), (48 + 14*4))) = uint32(uintptr(uintptr(result7))) switch (payload).SchemaUrl.Tag() { - case wit_types.OptionNone: + case witTypes.OptionNone: *(*int8)(unsafe.Add(unsafe.Pointer(returnArea), (48 + 16*4))) = int8(int32(0)) - case wit_types.OptionSome: + case witTypes.OptionSome: payload := (payload).SchemaUrl.Some() *(*int8)(unsafe.Add(unsafe.Pointer(returnArea), (48 + 16*4))) = int8(int32(1)) utf89 := unsafe.Pointer(unsafe.StringData(payload)) @@ -229,10 +229,10 @@ func OnEmit(data LogRecord) { } switch (data).InstrumentationScope.Tag() { - case wit_types.OptionNone: + case witTypes.OptionNone: *(*int8)(unsafe.Add(unsafe.Pointer(returnArea), (48 + 19*4))) = int8(int32(0)) - case wit_types.OptionSome: + case witTypes.OptionSome: payload := (data).InstrumentationScope.Some() *(*int8)(unsafe.Add(unsafe.Pointer(returnArea), (48 + 19*4))) = int8(int32(1)) utf810 := unsafe.Pointer(unsafe.StringData((payload).Name)) @@ -241,10 +241,10 @@ func OnEmit(data LogRecord) { *(*uint32)(unsafe.Add(unsafe.Pointer(returnArea), (48 + 20*4))) = uint32(uintptr(uintptr(utf810))) switch (payload).Version.Tag() { - case wit_types.OptionNone: + case witTypes.OptionNone: *(*int8)(unsafe.Add(unsafe.Pointer(returnArea), (48 + 22*4))) = int8(int32(0)) - case wit_types.OptionSome: + case witTypes.OptionSome: payload := (payload).Version.Some() *(*int8)(unsafe.Add(unsafe.Pointer(returnArea), (48 + 22*4))) = int8(int32(1)) utf811 := unsafe.Pointer(unsafe.StringData(payload)) @@ -257,10 +257,10 @@ func OnEmit(data LogRecord) { } switch (payload).SchemaUrl.Tag() { - case wit_types.OptionNone: + case witTypes.OptionNone: *(*int8)(unsafe.Add(unsafe.Pointer(returnArea), (48 + 25*4))) = int8(int32(0)) - case wit_types.OptionSome: + case witTypes.OptionSome: payload := (payload).SchemaUrl.Some() *(*int8)(unsafe.Add(unsafe.Pointer(returnArea), (48 + 25*4))) = int8(int32(1)) utf812 := unsafe.Pointer(unsafe.StringData(payload)) @@ -273,7 +273,7 @@ func OnEmit(data LogRecord) { } slice15 := (payload).Attributes length17 := uint32(len(slice15)) - result16 := wit_runtime.Allocate(pinner, uintptr(length17*(4*4)), 4) + result16 := witRuntime.Allocate(pinner, uintptr(length17*(4*4)), 4) for index, element := range slice15 { base := unsafe.Add(result16, index*(4*4)) utf813 := unsafe.Pointer(unsafe.StringData((element).Key)) @@ -295,10 +295,10 @@ func OnEmit(data LogRecord) { } switch (data).TraceId.Tag() { - case wit_types.OptionNone: + case witTypes.OptionNone: *(*int8)(unsafe.Add(unsafe.Pointer(returnArea), (48 + 30*4))) = int8(int32(0)) - case wit_types.OptionSome: + case witTypes.OptionSome: payload := (data).TraceId.Some() *(*int8)(unsafe.Add(unsafe.Pointer(returnArea), (48 + 30*4))) = int8(int32(1)) utf818 := unsafe.Pointer(unsafe.StringData(payload)) @@ -311,10 +311,10 @@ func OnEmit(data LogRecord) { } switch (data).SpanId.Tag() { - case wit_types.OptionNone: + case witTypes.OptionNone: *(*int8)(unsafe.Add(unsafe.Pointer(returnArea), (48 + 33*4))) = int8(int32(0)) - case wit_types.OptionSome: + case witTypes.OptionSome: payload := (data).SpanId.Some() *(*int8)(unsafe.Add(unsafe.Pointer(returnArea), (48 + 33*4))) = int8(int32(1)) utf819 := unsafe.Pointer(unsafe.StringData(payload)) @@ -327,10 +327,10 @@ func OnEmit(data LogRecord) { } switch (data).TraceFlags.Tag() { - case wit_types.OptionNone: + case witTypes.OptionNone: *(*int8)(unsafe.Add(unsafe.Pointer(returnArea), (48 + 36*4))) = int8(int32(0)) - case wit_types.OptionSome: + case witTypes.OptionSome: payload := (data).TraceFlags.Some() *(*int8)(unsafe.Add(unsafe.Pointer(returnArea), (48 + 36*4))) = int8(int32(1)) *(*int8)(unsafe.Add(unsafe.Pointer(returnArea), (49 + 36*4))) = int8(int32(payload)) diff --git a/go/internal/wasi_otel_metrics/empty.s b/go/internal/wasi_otel_metrics/empty.s new file mode 100644 index 0000000..308ab60 --- /dev/null +++ b/go/internal/wasi_otel_metrics/empty.s @@ -0,0 +1,3 @@ +// This file exists for testing this package without WebAssembly, +// allowing empty function bodies with a //go:wasmimport directive. +// See https://pkg.go.dev/cmd/compile for more information. \ No newline at end of file diff --git a/go/internal/wasi_otel_metrics/wit_bindings.go b/go/internal/wasi_otel_metrics/wit_bindings.go index 4fc9ed5..c8b2f9e 100644 --- a/go/internal/wasi_otel_metrics/wit_bindings.go +++ b/go/internal/wasi_otel_metrics/wit_bindings.go @@ -1,4 +1,4 @@ -// Generated by `wit-bindgen` 0.51.0. DO NOT EDIT! +// Generated by `wit-bindgen` 0.54.0. DO NOT EDIT! // // This code was generated from the following packages: // wasi:io@0.2.0 @@ -8,10 +8,10 @@ package wasi_otel_metrics import ( - "github.com/bytecodealliance/wit-bindgen/wit_runtime" - "github.com/bytecodealliance/wit-bindgen/wit_types" "github.com/calebschoepp/opentelemetry-wasi/internal/wasi_clocks_wall_clock" "github.com/calebschoepp/opentelemetry-wasi/internal/wasi_otel_types" + witRuntime "go.bytecodealliance.org/pkg/wit/runtime" + witTypes "go.bytecodealliance.org/pkg/wit/types" "runtime" "unsafe" ) @@ -140,7 +140,7 @@ type Gauge struct { // Represents individual aggregated measurements with unique attributes. DataPoints []GaugeDataPoint // The time when the time series was started. - StartTime wit_types.Option[wasi_clocks_wall_clock.Datetime] + StartTime witTypes.Option[wasi_clocks_wall_clock.Datetime] // The time when the time series was recorded. Time wasi_clocks_wall_clock.Datetime } @@ -182,9 +182,9 @@ type HistogramDataPoint struct { // The count of each of the buckets. BucketCounts []uint64 // The minimum value recorded. - Min wit_types.Option[MetricNumber] + Min witTypes.Option[MetricNumber] // The maximum value recorded. - Max wit_types.Option[MetricNumber] + Max witTypes.Option[MetricNumber] // The sum of the values recorded Sum MetricNumber // The sampled `exemplar`s collected during the time series. @@ -211,9 +211,9 @@ type ExponentialHistogramDataPoint struct { // The number of updates this histogram has been calculated with. Count uint64 // The minimum value recorded. - Min wit_types.Option[MetricNumber] + Min witTypes.Option[MetricNumber] // The maximum value recorded. - Max wit_types.Option[MetricNumber] + Max witTypes.Option[MetricNumber] // The maximum value recorded. Sum MetricNumber // Describes the resolution of the histogram. @@ -433,14 +433,14 @@ type ResourceMetrics struct { //go:wasmimport wasi:otel/metrics@0.2.0-rc.2 export func wasm_import_export(arg0 uintptr, arg1 uint32, arg2 int32, arg3 uintptr, arg4 uint32, arg5 uintptr, arg6 uint32, arg7 uintptr) -func Export(metrics ResourceMetrics) wit_types.Result[wit_types.Unit, string] { +func Export(metrics ResourceMetrics) witTypes.Result[witTypes.Unit, string] { pinner := &runtime.Pinner{} defer pinner.Unpin() - returnArea := uintptr(wit_runtime.Allocate(pinner, (3 * 4), 4)) + returnArea := uintptr(witRuntime.Allocate(pinner, (3 * 4), 4)) slice := ((metrics).Resource).Attributes length := uint32(len(slice)) - result := wit_runtime.Allocate(pinner, uintptr(length*(4*4)), 4) + result := witRuntime.Allocate(pinner, uintptr(length*(4*4)), 4) for index, element := range slice { base := unsafe.Add(result, index*(4*4)) utf8 := unsafe.Pointer(unsafe.StringData((element).Key)) @@ -458,12 +458,12 @@ func Export(metrics ResourceMetrics) wit_types.Result[wit_types.Unit, string] { var option2 uintptr var option3 uint32 switch ((metrics).Resource).SchemaUrl.Tag() { - case wit_types.OptionNone: + case witTypes.OptionNone: option = int32(0) option2 = 0 option3 = 0 - case wit_types.OptionSome: + case witTypes.OptionSome: payload := ((metrics).Resource).SchemaUrl.Some() utf81 := unsafe.Pointer(unsafe.StringData(payload)) pinner.Pin(utf81) @@ -476,7 +476,7 @@ func Export(metrics ResourceMetrics) wit_types.Result[wit_types.Unit, string] { } slice248 := (metrics).ScopeMetrics length250 := uint32(len(slice248)) - result249 := wit_runtime.Allocate(pinner, uintptr(length250*(12*4)), 4) + result249 := witRuntime.Allocate(pinner, uintptr(length250*(12*4)), 4) for index, element := range slice248 { base := unsafe.Add(result249, index*(12*4)) utf84 := unsafe.Pointer(unsafe.StringData(((element).Scope).Name)) @@ -485,10 +485,10 @@ func Export(metrics ResourceMetrics) wit_types.Result[wit_types.Unit, string] { *(*uint32)(unsafe.Add(unsafe.Pointer(base), 0)) = uint32(uintptr(uintptr(utf84))) switch ((element).Scope).Version.Tag() { - case wit_types.OptionNone: + case witTypes.OptionNone: *(*int8)(unsafe.Add(unsafe.Pointer(base), (2 * 4))) = int8(int32(0)) - case wit_types.OptionSome: + case witTypes.OptionSome: payload := ((element).Scope).Version.Some() *(*int8)(unsafe.Add(unsafe.Pointer(base), (2 * 4))) = int8(int32(1)) utf85 := unsafe.Pointer(unsafe.StringData(payload)) @@ -501,10 +501,10 @@ func Export(metrics ResourceMetrics) wit_types.Result[wit_types.Unit, string] { } switch ((element).Scope).SchemaUrl.Tag() { - case wit_types.OptionNone: + case witTypes.OptionNone: *(*int8)(unsafe.Add(unsafe.Pointer(base), (5 * 4))) = int8(int32(0)) - case wit_types.OptionSome: + case witTypes.OptionSome: payload := ((element).Scope).SchemaUrl.Some() *(*int8)(unsafe.Add(unsafe.Pointer(base), (5 * 4))) = int8(int32(1)) utf86 := unsafe.Pointer(unsafe.StringData(payload)) @@ -517,7 +517,7 @@ func Export(metrics ResourceMetrics) wit_types.Result[wit_types.Unit, string] { } slice9 := ((element).Scope).Attributes length11 := uint32(len(slice9)) - result10 := wit_runtime.Allocate(pinner, uintptr(length11*(4*4)), 4) + result10 := witRuntime.Allocate(pinner, uintptr(length11*(4*4)), 4) for index, element := range slice9 { base := unsafe.Add(result10, index*(4*4)) utf87 := unsafe.Pointer(unsafe.StringData((element).Key)) @@ -535,7 +535,7 @@ func Export(metrics ResourceMetrics) wit_types.Result[wit_types.Unit, string] { *(*uint32)(unsafe.Add(unsafe.Pointer(base), (8 * 4))) = uint32(uintptr(uintptr(result10))) slice245 := (element).Metrics length247 := uint32(len(slice245)) - result246 := wit_runtime.Allocate(pinner, uintptr(length247*(48+8*4)), 8) + result246 := witRuntime.Allocate(pinner, uintptr(length247*(48+8*4)), 8) for index, element := range slice245 { base := unsafe.Add(result246, index*(48+8*4)) utf812 := unsafe.Pointer(unsafe.StringData((element).Name)) @@ -557,12 +557,12 @@ func Export(metrics ResourceMetrics) wit_types.Result[wit_types.Unit, string] { *(*int8)(unsafe.Add(unsafe.Pointer(base), (6 * 4))) = int8(int32(0)) slice30 := (payload).DataPoints length32 := uint32(len(slice30)) - result31 := wit_runtime.Allocate(pinner, uintptr(length32*(16+4*4)), 8) + result31 := witRuntime.Allocate(pinner, uintptr(length32*(16+4*4)), 8) for index, element := range slice30 { base := unsafe.Add(result31, index*(16+4*4)) slice17 := (element).Attributes length19 := uint32(len(slice17)) - result18 := wit_runtime.Allocate(pinner, uintptr(length19*(4*4)), 4) + result18 := witRuntime.Allocate(pinner, uintptr(length19*(4*4)), 4) for index, element := range slice17 { base := unsafe.Add(result18, index*(4*4)) utf815 := unsafe.Pointer(unsafe.StringData((element).Key)) @@ -600,12 +600,12 @@ func Export(metrics ResourceMetrics) wit_types.Result[wit_types.Unit, string] { } slice27 := (element).Exemplars length29 := uint32(len(slice27)) - result28 := wit_runtime.Allocate(pinner, uintptr(length29*(32+6*4)), 8) + result28 := witRuntime.Allocate(pinner, uintptr(length29*(32+6*4)), 8) for index, element := range slice27 { base := unsafe.Add(result28, index*(32+6*4)) slice22 := (element).FilteredAttributes length24 := uint32(len(slice22)) - result23 := wit_runtime.Allocate(pinner, uintptr(length24*(4*4)), 4) + result23 := witRuntime.Allocate(pinner, uintptr(length24*(4*4)), 4) for index, element := range slice22 { base := unsafe.Add(result23, index*(4*4)) utf820 := unsafe.Pointer(unsafe.StringData((element).Key)) @@ -663,10 +663,10 @@ func Export(metrics ResourceMetrics) wit_types.Result[wit_types.Unit, string] { *(*uint32)(unsafe.Add(unsafe.Pointer(base), (8 + 6*4))) = uint32(uintptr(uintptr(result31))) switch (payload).StartTime.Tag() { - case wit_types.OptionNone: + case witTypes.OptionNone: *(*int8)(unsafe.Add(unsafe.Pointer(base), (8 + 8*4))) = int8(int32(0)) - case wit_types.OptionSome: + case witTypes.OptionSome: payload := (payload).StartTime.Some() *(*int8)(unsafe.Add(unsafe.Pointer(base), (8 + 8*4))) = int8(int32(1)) *(*int64)(unsafe.Add(unsafe.Pointer(base), (16 + 8*4))) = int64((payload).Seconds) @@ -683,12 +683,12 @@ func Export(metrics ResourceMetrics) wit_types.Result[wit_types.Unit, string] { *(*int8)(unsafe.Add(unsafe.Pointer(base), (6 * 4))) = int8(int32(1)) slice48 := (payload).DataPoints length50 := uint32(len(slice48)) - result49 := wit_runtime.Allocate(pinner, uintptr(length50*(16+4*4)), 8) + result49 := witRuntime.Allocate(pinner, uintptr(length50*(16+4*4)), 8) for index, element := range slice48 { base := unsafe.Add(result49, index*(16+4*4)) slice35 := (element).Attributes length37 := uint32(len(slice35)) - result36 := wit_runtime.Allocate(pinner, uintptr(length37*(4*4)), 4) + result36 := witRuntime.Allocate(pinner, uintptr(length37*(4*4)), 4) for index, element := range slice35 { base := unsafe.Add(result36, index*(4*4)) utf833 := unsafe.Pointer(unsafe.StringData((element).Key)) @@ -726,12 +726,12 @@ func Export(metrics ResourceMetrics) wit_types.Result[wit_types.Unit, string] { } slice45 := (element).Exemplars length47 := uint32(len(slice45)) - result46 := wit_runtime.Allocate(pinner, uintptr(length47*(32+6*4)), 8) + result46 := witRuntime.Allocate(pinner, uintptr(length47*(32+6*4)), 8) for index, element := range slice45 { base := unsafe.Add(result46, index*(32+6*4)) slice40 := (element).FilteredAttributes length42 := uint32(len(slice40)) - result41 := wit_runtime.Allocate(pinner, uintptr(length42*(4*4)), 4) + result41 := witRuntime.Allocate(pinner, uintptr(length42*(4*4)), 4) for index, element := range slice40 { base := unsafe.Add(result41, index*(4*4)) utf838 := unsafe.Pointer(unsafe.StringData((element).Key)) @@ -805,12 +805,12 @@ func Export(metrics ResourceMetrics) wit_types.Result[wit_types.Unit, string] { *(*int8)(unsafe.Add(unsafe.Pointer(base), (6 * 4))) = int8(int32(2)) slice68 := (payload).DataPoints length70 := uint32(len(slice68)) - result69 := wit_runtime.Allocate(pinner, uintptr(length70*(72+8*4)), 8) + result69 := witRuntime.Allocate(pinner, uintptr(length70*(72+8*4)), 8) for index, element := range slice68 { base := unsafe.Add(result69, index*(72+8*4)) slice54 := (element).Attributes length56 := uint32(len(slice54)) - result55 := wit_runtime.Allocate(pinner, uintptr(length56*(4*4)), 4) + result55 := witRuntime.Allocate(pinner, uintptr(length56*(4*4)), 4) for index, element := range slice54 { base := unsafe.Add(result55, index*(4*4)) utf852 := unsafe.Pointer(unsafe.StringData((element).Key)) @@ -837,10 +837,10 @@ func Export(metrics ResourceMetrics) wit_types.Result[wit_types.Unit, string] { *(*uint32)(unsafe.Add(unsafe.Pointer(base), (8 + 4*4))) = uint32(uintptr(uintptr(data57))) switch (element).Min.Tag() { - case wit_types.OptionNone: + case witTypes.OptionNone: *(*int8)(unsafe.Add(unsafe.Pointer(base), (8 + 6*4))) = int8(int32(0)) - case wit_types.OptionSome: + case witTypes.OptionSome: payload := (element).Min.Some() *(*int8)(unsafe.Add(unsafe.Pointer(base), (8 + 6*4))) = int8(int32(1)) @@ -869,10 +869,10 @@ func Export(metrics ResourceMetrics) wit_types.Result[wit_types.Unit, string] { } switch (element).Max.Tag() { - case wit_types.OptionNone: + case witTypes.OptionNone: *(*int8)(unsafe.Add(unsafe.Pointer(base), (32 + 6*4))) = int8(int32(0)) - case wit_types.OptionSome: + case witTypes.OptionSome: payload := (element).Max.Some() *(*int8)(unsafe.Add(unsafe.Pointer(base), (32 + 6*4))) = int8(int32(1)) @@ -921,12 +921,12 @@ func Export(metrics ResourceMetrics) wit_types.Result[wit_types.Unit, string] { } slice65 := (element).Exemplars length67 := uint32(len(slice65)) - result66 := wit_runtime.Allocate(pinner, uintptr(length67*(32+6*4)), 8) + result66 := witRuntime.Allocate(pinner, uintptr(length67*(32+6*4)), 8) for index, element := range slice65 { base := unsafe.Add(result66, index*(32+6*4)) slice60 := (element).FilteredAttributes length62 := uint32(len(slice60)) - result61 := wit_runtime.Allocate(pinner, uintptr(length62*(4*4)), 4) + result61 := witRuntime.Allocate(pinner, uintptr(length62*(4*4)), 4) for index, element := range slice60 { base := unsafe.Add(result61, index*(4*4)) utf858 := unsafe.Pointer(unsafe.StringData((element).Key)) @@ -993,12 +993,12 @@ func Export(metrics ResourceMetrics) wit_types.Result[wit_types.Unit, string] { *(*int8)(unsafe.Add(unsafe.Pointer(base), (6 * 4))) = int8(int32(3)) slice88 := (payload).DataPoints length90 := uint32(len(slice88)) - result89 := wit_runtime.Allocate(pinner, uintptr(length90*(96+10*4)), 8) + result89 := witRuntime.Allocate(pinner, uintptr(length90*(96+10*4)), 8) for index, element := range slice88 { base := unsafe.Add(result89, index*(96+10*4)) slice73 := (element).Attributes length75 := uint32(len(slice73)) - result74 := wit_runtime.Allocate(pinner, uintptr(length75*(4*4)), 4) + result74 := witRuntime.Allocate(pinner, uintptr(length75*(4*4)), 4) for index, element := range slice73 { base := unsafe.Add(result74, index*(4*4)) utf871 := unsafe.Pointer(unsafe.StringData((element).Key)) @@ -1017,10 +1017,10 @@ func Export(metrics ResourceMetrics) wit_types.Result[wit_types.Unit, string] { *(*int64)(unsafe.Add(unsafe.Pointer(base), (2 * 4))) = int64((element).Count) switch (element).Min.Tag() { - case wit_types.OptionNone: + case witTypes.OptionNone: *(*int8)(unsafe.Add(unsafe.Pointer(base), (8 + 2*4))) = int8(int32(0)) - case wit_types.OptionSome: + case witTypes.OptionSome: payload := (element).Min.Some() *(*int8)(unsafe.Add(unsafe.Pointer(base), (8 + 2*4))) = int8(int32(1)) @@ -1049,10 +1049,10 @@ func Export(metrics ResourceMetrics) wit_types.Result[wit_types.Unit, string] { } switch (element).Max.Tag() { - case wit_types.OptionNone: + case witTypes.OptionNone: *(*int8)(unsafe.Add(unsafe.Pointer(base), (32 + 2*4))) = int8(int32(0)) - case wit_types.OptionSome: + case witTypes.OptionSome: payload := (element).Max.Some() *(*int8)(unsafe.Add(unsafe.Pointer(base), (32 + 2*4))) = int8(int32(1)) @@ -1114,12 +1114,12 @@ func Export(metrics ResourceMetrics) wit_types.Result[wit_types.Unit, string] { *(*float64)(unsafe.Add(unsafe.Pointer(base), (88 + 8*4))) = (element).ZeroThreshold slice85 := (element).Exemplars length87 := uint32(len(slice85)) - result86 := wit_runtime.Allocate(pinner, uintptr(length87*(32+6*4)), 8) + result86 := witRuntime.Allocate(pinner, uintptr(length87*(32+6*4)), 8) for index, element := range slice85 { base := unsafe.Add(result86, index*(32+6*4)) slice80 := (element).FilteredAttributes length82 := uint32(len(slice80)) - result81 := wit_runtime.Allocate(pinner, uintptr(length82*(4*4)), 4) + result81 := witRuntime.Allocate(pinner, uintptr(length82*(4*4)), 4) for index, element := range slice80 { base := unsafe.Add(result81, index*(4*4)) utf878 := unsafe.Pointer(unsafe.StringData((element).Key)) @@ -1186,12 +1186,12 @@ func Export(metrics ResourceMetrics) wit_types.Result[wit_types.Unit, string] { *(*int8)(unsafe.Add(unsafe.Pointer(base), (6 * 4))) = int8(int32(4)) slice106 := (payload).DataPoints length108 := uint32(len(slice106)) - result107 := wit_runtime.Allocate(pinner, uintptr(length108*(16+4*4)), 8) + result107 := witRuntime.Allocate(pinner, uintptr(length108*(16+4*4)), 8) for index, element := range slice106 { base := unsafe.Add(result107, index*(16+4*4)) slice93 := (element).Attributes length95 := uint32(len(slice93)) - result94 := wit_runtime.Allocate(pinner, uintptr(length95*(4*4)), 4) + result94 := witRuntime.Allocate(pinner, uintptr(length95*(4*4)), 4) for index, element := range slice93 { base := unsafe.Add(result94, index*(4*4)) utf891 := unsafe.Pointer(unsafe.StringData((element).Key)) @@ -1229,12 +1229,12 @@ func Export(metrics ResourceMetrics) wit_types.Result[wit_types.Unit, string] { } slice103 := (element).Exemplars length105 := uint32(len(slice103)) - result104 := wit_runtime.Allocate(pinner, uintptr(length105*(32+6*4)), 8) + result104 := witRuntime.Allocate(pinner, uintptr(length105*(32+6*4)), 8) for index, element := range slice103 { base := unsafe.Add(result104, index*(32+6*4)) slice98 := (element).FilteredAttributes length100 := uint32(len(slice98)) - result99 := wit_runtime.Allocate(pinner, uintptr(length100*(4*4)), 4) + result99 := witRuntime.Allocate(pinner, uintptr(length100*(4*4)), 4) for index, element := range slice98 { base := unsafe.Add(result99, index*(4*4)) utf896 := unsafe.Pointer(unsafe.StringData((element).Key)) @@ -1292,10 +1292,10 @@ func Export(metrics ResourceMetrics) wit_types.Result[wit_types.Unit, string] { *(*uint32)(unsafe.Add(unsafe.Pointer(base), (8 + 6*4))) = uint32(uintptr(uintptr(result107))) switch (payload).StartTime.Tag() { - case wit_types.OptionNone: + case witTypes.OptionNone: *(*int8)(unsafe.Add(unsafe.Pointer(base), (8 + 8*4))) = int8(int32(0)) - case wit_types.OptionSome: + case witTypes.OptionSome: payload := (payload).StartTime.Some() *(*int8)(unsafe.Add(unsafe.Pointer(base), (8 + 8*4))) = int8(int32(1)) *(*int64)(unsafe.Add(unsafe.Pointer(base), (16 + 8*4))) = int64((payload).Seconds) @@ -1312,12 +1312,12 @@ func Export(metrics ResourceMetrics) wit_types.Result[wit_types.Unit, string] { *(*int8)(unsafe.Add(unsafe.Pointer(base), (6 * 4))) = int8(int32(5)) slice124 := (payload).DataPoints length126 := uint32(len(slice124)) - result125 := wit_runtime.Allocate(pinner, uintptr(length126*(16+4*4)), 8) + result125 := witRuntime.Allocate(pinner, uintptr(length126*(16+4*4)), 8) for index, element := range slice124 { base := unsafe.Add(result125, index*(16+4*4)) slice111 := (element).Attributes length113 := uint32(len(slice111)) - result112 := wit_runtime.Allocate(pinner, uintptr(length113*(4*4)), 4) + result112 := witRuntime.Allocate(pinner, uintptr(length113*(4*4)), 4) for index, element := range slice111 { base := unsafe.Add(result112, index*(4*4)) utf8109 := unsafe.Pointer(unsafe.StringData((element).Key)) @@ -1355,12 +1355,12 @@ func Export(metrics ResourceMetrics) wit_types.Result[wit_types.Unit, string] { } slice121 := (element).Exemplars length123 := uint32(len(slice121)) - result122 := wit_runtime.Allocate(pinner, uintptr(length123*(32+6*4)), 8) + result122 := witRuntime.Allocate(pinner, uintptr(length123*(32+6*4)), 8) for index, element := range slice121 { base := unsafe.Add(result122, index*(32+6*4)) slice116 := (element).FilteredAttributes length118 := uint32(len(slice116)) - result117 := wit_runtime.Allocate(pinner, uintptr(length118*(4*4)), 4) + result117 := witRuntime.Allocate(pinner, uintptr(length118*(4*4)), 4) for index, element := range slice116 { base := unsafe.Add(result117, index*(4*4)) utf8114 := unsafe.Pointer(unsafe.StringData((element).Key)) @@ -1434,12 +1434,12 @@ func Export(metrics ResourceMetrics) wit_types.Result[wit_types.Unit, string] { *(*int8)(unsafe.Add(unsafe.Pointer(base), (6 * 4))) = int8(int32(6)) slice145 := (payload).DataPoints length147 := uint32(len(slice145)) - result146 := wit_runtime.Allocate(pinner, uintptr(length147*(72+8*4)), 8) + result146 := witRuntime.Allocate(pinner, uintptr(length147*(72+8*4)), 8) for index, element := range slice145 { base := unsafe.Add(result146, index*(72+8*4)) slice130 := (element).Attributes length132 := uint32(len(slice130)) - result131 := wit_runtime.Allocate(pinner, uintptr(length132*(4*4)), 4) + result131 := witRuntime.Allocate(pinner, uintptr(length132*(4*4)), 4) for index, element := range slice130 { base := unsafe.Add(result131, index*(4*4)) utf8128 := unsafe.Pointer(unsafe.StringData((element).Key)) @@ -1466,10 +1466,10 @@ func Export(metrics ResourceMetrics) wit_types.Result[wit_types.Unit, string] { *(*uint32)(unsafe.Add(unsafe.Pointer(base), (8 + 4*4))) = uint32(uintptr(uintptr(data134))) switch (element).Min.Tag() { - case wit_types.OptionNone: + case witTypes.OptionNone: *(*int8)(unsafe.Add(unsafe.Pointer(base), (8 + 6*4))) = int8(int32(0)) - case wit_types.OptionSome: + case witTypes.OptionSome: payload := (element).Min.Some() *(*int8)(unsafe.Add(unsafe.Pointer(base), (8 + 6*4))) = int8(int32(1)) @@ -1498,10 +1498,10 @@ func Export(metrics ResourceMetrics) wit_types.Result[wit_types.Unit, string] { } switch (element).Max.Tag() { - case wit_types.OptionNone: + case witTypes.OptionNone: *(*int8)(unsafe.Add(unsafe.Pointer(base), (32 + 6*4))) = int8(int32(0)) - case wit_types.OptionSome: + case witTypes.OptionSome: payload := (element).Max.Some() *(*int8)(unsafe.Add(unsafe.Pointer(base), (32 + 6*4))) = int8(int32(1)) @@ -1550,12 +1550,12 @@ func Export(metrics ResourceMetrics) wit_types.Result[wit_types.Unit, string] { } slice142 := (element).Exemplars length144 := uint32(len(slice142)) - result143 := wit_runtime.Allocate(pinner, uintptr(length144*(32+6*4)), 8) + result143 := witRuntime.Allocate(pinner, uintptr(length144*(32+6*4)), 8) for index, element := range slice142 { base := unsafe.Add(result143, index*(32+6*4)) slice137 := (element).FilteredAttributes length139 := uint32(len(slice137)) - result138 := wit_runtime.Allocate(pinner, uintptr(length139*(4*4)), 4) + result138 := witRuntime.Allocate(pinner, uintptr(length139*(4*4)), 4) for index, element := range slice137 { base := unsafe.Add(result138, index*(4*4)) utf8135 := unsafe.Pointer(unsafe.StringData((element).Key)) @@ -1622,12 +1622,12 @@ func Export(metrics ResourceMetrics) wit_types.Result[wit_types.Unit, string] { *(*int8)(unsafe.Add(unsafe.Pointer(base), (6 * 4))) = int8(int32(7)) slice165 := (payload).DataPoints length167 := uint32(len(slice165)) - result166 := wit_runtime.Allocate(pinner, uintptr(length167*(96+10*4)), 8) + result166 := witRuntime.Allocate(pinner, uintptr(length167*(96+10*4)), 8) for index, element := range slice165 { base := unsafe.Add(result166, index*(96+10*4)) slice150 := (element).Attributes length152 := uint32(len(slice150)) - result151 := wit_runtime.Allocate(pinner, uintptr(length152*(4*4)), 4) + result151 := witRuntime.Allocate(pinner, uintptr(length152*(4*4)), 4) for index, element := range slice150 { base := unsafe.Add(result151, index*(4*4)) utf8148 := unsafe.Pointer(unsafe.StringData((element).Key)) @@ -1646,10 +1646,10 @@ func Export(metrics ResourceMetrics) wit_types.Result[wit_types.Unit, string] { *(*int64)(unsafe.Add(unsafe.Pointer(base), (2 * 4))) = int64((element).Count) switch (element).Min.Tag() { - case wit_types.OptionNone: + case witTypes.OptionNone: *(*int8)(unsafe.Add(unsafe.Pointer(base), (8 + 2*4))) = int8(int32(0)) - case wit_types.OptionSome: + case witTypes.OptionSome: payload := (element).Min.Some() *(*int8)(unsafe.Add(unsafe.Pointer(base), (8 + 2*4))) = int8(int32(1)) @@ -1678,10 +1678,10 @@ func Export(metrics ResourceMetrics) wit_types.Result[wit_types.Unit, string] { } switch (element).Max.Tag() { - case wit_types.OptionNone: + case witTypes.OptionNone: *(*int8)(unsafe.Add(unsafe.Pointer(base), (32 + 2*4))) = int8(int32(0)) - case wit_types.OptionSome: + case witTypes.OptionSome: payload := (element).Max.Some() *(*int8)(unsafe.Add(unsafe.Pointer(base), (32 + 2*4))) = int8(int32(1)) @@ -1743,12 +1743,12 @@ func Export(metrics ResourceMetrics) wit_types.Result[wit_types.Unit, string] { *(*float64)(unsafe.Add(unsafe.Pointer(base), (88 + 8*4))) = (element).ZeroThreshold slice162 := (element).Exemplars length164 := uint32(len(slice162)) - result163 := wit_runtime.Allocate(pinner, uintptr(length164*(32+6*4)), 8) + result163 := witRuntime.Allocate(pinner, uintptr(length164*(32+6*4)), 8) for index, element := range slice162 { base := unsafe.Add(result163, index*(32+6*4)) slice157 := (element).FilteredAttributes length159 := uint32(len(slice157)) - result158 := wit_runtime.Allocate(pinner, uintptr(length159*(4*4)), 4) + result158 := witRuntime.Allocate(pinner, uintptr(length159*(4*4)), 4) for index, element := range slice157 { base := unsafe.Add(result158, index*(4*4)) utf8155 := unsafe.Pointer(unsafe.StringData((element).Key)) @@ -1815,12 +1815,12 @@ func Export(metrics ResourceMetrics) wit_types.Result[wit_types.Unit, string] { *(*int8)(unsafe.Add(unsafe.Pointer(base), (6 * 4))) = int8(int32(8)) slice183 := (payload).DataPoints length185 := uint32(len(slice183)) - result184 := wit_runtime.Allocate(pinner, uintptr(length185*(16+4*4)), 8) + result184 := witRuntime.Allocate(pinner, uintptr(length185*(16+4*4)), 8) for index, element := range slice183 { base := unsafe.Add(result184, index*(16+4*4)) slice170 := (element).Attributes length172 := uint32(len(slice170)) - result171 := wit_runtime.Allocate(pinner, uintptr(length172*(4*4)), 4) + result171 := witRuntime.Allocate(pinner, uintptr(length172*(4*4)), 4) for index, element := range slice170 { base := unsafe.Add(result171, index*(4*4)) utf8168 := unsafe.Pointer(unsafe.StringData((element).Key)) @@ -1858,12 +1858,12 @@ func Export(metrics ResourceMetrics) wit_types.Result[wit_types.Unit, string] { } slice180 := (element).Exemplars length182 := uint32(len(slice180)) - result181 := wit_runtime.Allocate(pinner, uintptr(length182*(32+6*4)), 8) + result181 := witRuntime.Allocate(pinner, uintptr(length182*(32+6*4)), 8) for index, element := range slice180 { base := unsafe.Add(result181, index*(32+6*4)) slice175 := (element).FilteredAttributes length177 := uint32(len(slice175)) - result176 := wit_runtime.Allocate(pinner, uintptr(length177*(4*4)), 4) + result176 := witRuntime.Allocate(pinner, uintptr(length177*(4*4)), 4) for index, element := range slice175 { base := unsafe.Add(result176, index*(4*4)) utf8173 := unsafe.Pointer(unsafe.StringData((element).Key)) @@ -1921,10 +1921,10 @@ func Export(metrics ResourceMetrics) wit_types.Result[wit_types.Unit, string] { *(*uint32)(unsafe.Add(unsafe.Pointer(base), (8 + 6*4))) = uint32(uintptr(uintptr(result184))) switch (payload).StartTime.Tag() { - case wit_types.OptionNone: + case witTypes.OptionNone: *(*int8)(unsafe.Add(unsafe.Pointer(base), (8 + 8*4))) = int8(int32(0)) - case wit_types.OptionSome: + case witTypes.OptionSome: payload := (payload).StartTime.Some() *(*int8)(unsafe.Add(unsafe.Pointer(base), (8 + 8*4))) = int8(int32(1)) *(*int64)(unsafe.Add(unsafe.Pointer(base), (16 + 8*4))) = int64((payload).Seconds) @@ -1941,12 +1941,12 @@ func Export(metrics ResourceMetrics) wit_types.Result[wit_types.Unit, string] { *(*int8)(unsafe.Add(unsafe.Pointer(base), (6 * 4))) = int8(int32(9)) slice201 := (payload).DataPoints length203 := uint32(len(slice201)) - result202 := wit_runtime.Allocate(pinner, uintptr(length203*(16+4*4)), 8) + result202 := witRuntime.Allocate(pinner, uintptr(length203*(16+4*4)), 8) for index, element := range slice201 { base := unsafe.Add(result202, index*(16+4*4)) slice188 := (element).Attributes length190 := uint32(len(slice188)) - result189 := wit_runtime.Allocate(pinner, uintptr(length190*(4*4)), 4) + result189 := witRuntime.Allocate(pinner, uintptr(length190*(4*4)), 4) for index, element := range slice188 { base := unsafe.Add(result189, index*(4*4)) utf8186 := unsafe.Pointer(unsafe.StringData((element).Key)) @@ -1984,12 +1984,12 @@ func Export(metrics ResourceMetrics) wit_types.Result[wit_types.Unit, string] { } slice198 := (element).Exemplars length200 := uint32(len(slice198)) - result199 := wit_runtime.Allocate(pinner, uintptr(length200*(32+6*4)), 8) + result199 := witRuntime.Allocate(pinner, uintptr(length200*(32+6*4)), 8) for index, element := range slice198 { base := unsafe.Add(result199, index*(32+6*4)) slice193 := (element).FilteredAttributes length195 := uint32(len(slice193)) - result194 := wit_runtime.Allocate(pinner, uintptr(length195*(4*4)), 4) + result194 := witRuntime.Allocate(pinner, uintptr(length195*(4*4)), 4) for index, element := range slice193 { base := unsafe.Add(result194, index*(4*4)) utf8191 := unsafe.Pointer(unsafe.StringData((element).Key)) @@ -2063,12 +2063,12 @@ func Export(metrics ResourceMetrics) wit_types.Result[wit_types.Unit, string] { *(*int8)(unsafe.Add(unsafe.Pointer(base), (6 * 4))) = int8(int32(10)) slice222 := (payload).DataPoints length224 := uint32(len(slice222)) - result223 := wit_runtime.Allocate(pinner, uintptr(length224*(72+8*4)), 8) + result223 := witRuntime.Allocate(pinner, uintptr(length224*(72+8*4)), 8) for index, element := range slice222 { base := unsafe.Add(result223, index*(72+8*4)) slice207 := (element).Attributes length209 := uint32(len(slice207)) - result208 := wit_runtime.Allocate(pinner, uintptr(length209*(4*4)), 4) + result208 := witRuntime.Allocate(pinner, uintptr(length209*(4*4)), 4) for index, element := range slice207 { base := unsafe.Add(result208, index*(4*4)) utf8205 := unsafe.Pointer(unsafe.StringData((element).Key)) @@ -2095,10 +2095,10 @@ func Export(metrics ResourceMetrics) wit_types.Result[wit_types.Unit, string] { *(*uint32)(unsafe.Add(unsafe.Pointer(base), (8 + 4*4))) = uint32(uintptr(uintptr(data211))) switch (element).Min.Tag() { - case wit_types.OptionNone: + case witTypes.OptionNone: *(*int8)(unsafe.Add(unsafe.Pointer(base), (8 + 6*4))) = int8(int32(0)) - case wit_types.OptionSome: + case witTypes.OptionSome: payload := (element).Min.Some() *(*int8)(unsafe.Add(unsafe.Pointer(base), (8 + 6*4))) = int8(int32(1)) @@ -2127,10 +2127,10 @@ func Export(metrics ResourceMetrics) wit_types.Result[wit_types.Unit, string] { } switch (element).Max.Tag() { - case wit_types.OptionNone: + case witTypes.OptionNone: *(*int8)(unsafe.Add(unsafe.Pointer(base), (32 + 6*4))) = int8(int32(0)) - case wit_types.OptionSome: + case witTypes.OptionSome: payload := (element).Max.Some() *(*int8)(unsafe.Add(unsafe.Pointer(base), (32 + 6*4))) = int8(int32(1)) @@ -2179,12 +2179,12 @@ func Export(metrics ResourceMetrics) wit_types.Result[wit_types.Unit, string] { } slice219 := (element).Exemplars length221 := uint32(len(slice219)) - result220 := wit_runtime.Allocate(pinner, uintptr(length221*(32+6*4)), 8) + result220 := witRuntime.Allocate(pinner, uintptr(length221*(32+6*4)), 8) for index, element := range slice219 { base := unsafe.Add(result220, index*(32+6*4)) slice214 := (element).FilteredAttributes length216 := uint32(len(slice214)) - result215 := wit_runtime.Allocate(pinner, uintptr(length216*(4*4)), 4) + result215 := witRuntime.Allocate(pinner, uintptr(length216*(4*4)), 4) for index, element := range slice214 { base := unsafe.Add(result215, index*(4*4)) utf8212 := unsafe.Pointer(unsafe.StringData((element).Key)) @@ -2251,12 +2251,12 @@ func Export(metrics ResourceMetrics) wit_types.Result[wit_types.Unit, string] { *(*int8)(unsafe.Add(unsafe.Pointer(base), (6 * 4))) = int8(int32(11)) slice242 := (payload).DataPoints length244 := uint32(len(slice242)) - result243 := wit_runtime.Allocate(pinner, uintptr(length244*(96+10*4)), 8) + result243 := witRuntime.Allocate(pinner, uintptr(length244*(96+10*4)), 8) for index, element := range slice242 { base := unsafe.Add(result243, index*(96+10*4)) slice227 := (element).Attributes length229 := uint32(len(slice227)) - result228 := wit_runtime.Allocate(pinner, uintptr(length229*(4*4)), 4) + result228 := witRuntime.Allocate(pinner, uintptr(length229*(4*4)), 4) for index, element := range slice227 { base := unsafe.Add(result228, index*(4*4)) utf8225 := unsafe.Pointer(unsafe.StringData((element).Key)) @@ -2275,10 +2275,10 @@ func Export(metrics ResourceMetrics) wit_types.Result[wit_types.Unit, string] { *(*int64)(unsafe.Add(unsafe.Pointer(base), (2 * 4))) = int64((element).Count) switch (element).Min.Tag() { - case wit_types.OptionNone: + case witTypes.OptionNone: *(*int8)(unsafe.Add(unsafe.Pointer(base), (8 + 2*4))) = int8(int32(0)) - case wit_types.OptionSome: + case witTypes.OptionSome: payload := (element).Min.Some() *(*int8)(unsafe.Add(unsafe.Pointer(base), (8 + 2*4))) = int8(int32(1)) @@ -2307,10 +2307,10 @@ func Export(metrics ResourceMetrics) wit_types.Result[wit_types.Unit, string] { } switch (element).Max.Tag() { - case wit_types.OptionNone: + case witTypes.OptionNone: *(*int8)(unsafe.Add(unsafe.Pointer(base), (32 + 2*4))) = int8(int32(0)) - case wit_types.OptionSome: + case witTypes.OptionSome: payload := (element).Max.Some() *(*int8)(unsafe.Add(unsafe.Pointer(base), (32 + 2*4))) = int8(int32(1)) @@ -2372,12 +2372,12 @@ func Export(metrics ResourceMetrics) wit_types.Result[wit_types.Unit, string] { *(*float64)(unsafe.Add(unsafe.Pointer(base), (88 + 8*4))) = (element).ZeroThreshold slice239 := (element).Exemplars length241 := uint32(len(slice239)) - result240 := wit_runtime.Allocate(pinner, uintptr(length241*(32+6*4)), 8) + result240 := witRuntime.Allocate(pinner, uintptr(length241*(32+6*4)), 8) for index, element := range slice239 { base := unsafe.Add(result240, index*(32+6*4)) slice234 := (element).FilteredAttributes length236 := uint32(len(slice234)) - result235 := wit_runtime.Allocate(pinner, uintptr(length236*(4*4)), 4) + result235 := witRuntime.Allocate(pinner, uintptr(length236*(4*4)), 4) for index, element := range slice234 { base := unsafe.Add(result235, index*(4*4)) utf8232 := unsafe.Pointer(unsafe.StringData((element).Key)) @@ -2451,15 +2451,15 @@ func Export(metrics ResourceMetrics) wit_types.Result[wit_types.Unit, string] { } wasm_import_export(uintptr(result), length, option, option2, option3, uintptr(result249), length250, returnArea) - var result251 wit_types.Result[wit_types.Unit, string] + var result251 witTypes.Result[witTypes.Unit, string] switch uint8(*(*uint32)(unsafe.Add(unsafe.Pointer(returnArea), 0))) { case 0: - result251 = wit_types.Ok[wit_types.Unit, string](wit_types.Unit{}) + result251 = witTypes.Ok[witTypes.Unit, string](witTypes.Unit{}) case 1: value := unsafe.String((*uint8)(unsafe.Pointer(uintptr(*(*uint32)(unsafe.Add(unsafe.Pointer(returnArea), 4))))), *(*uint32)(unsafe.Add(unsafe.Pointer(returnArea), (2 * 4)))) - result251 = wit_types.Err[wit_types.Unit, string](value) + result251 = witTypes.Err[witTypes.Unit, string](value) default: panic("unreachable") } diff --git a/go/internal/wasi_otel_tracing/empty.s b/go/internal/wasi_otel_tracing/empty.s new file mode 100644 index 0000000..308ab60 --- /dev/null +++ b/go/internal/wasi_otel_tracing/empty.s @@ -0,0 +1,3 @@ +// This file exists for testing this package without WebAssembly, +// allowing empty function bodies with a //go:wasmimport directive. +// See https://pkg.go.dev/cmd/compile for more information. \ No newline at end of file diff --git a/go/internal/wasi_otel_tracing/wit_bindings.go b/go/internal/wasi_otel_tracing/wit_bindings.go index 67c7340..cebe416 100644 --- a/go/internal/wasi_otel_tracing/wit_bindings.go +++ b/go/internal/wasi_otel_tracing/wit_bindings.go @@ -1,4 +1,4 @@ -// Generated by `wit-bindgen` 0.51.0. DO NOT EDIT! +// Generated by `wit-bindgen` 0.54.0. DO NOT EDIT! // // This code was generated from the following packages: // wasi:io@0.2.0 @@ -8,10 +8,10 @@ package wasi_otel_tracing import ( - "github.com/bytecodealliance/wit-bindgen/wit_runtime" - "github.com/bytecodealliance/wit-bindgen/wit_types" "github.com/calebschoepp/opentelemetry-wasi/internal/wasi_clocks_wall_clock" "github.com/calebschoepp/opentelemetry-wasi/internal/wasi_otel_types" + witRuntime "go.bytecodealliance.org/pkg/wit/runtime" + witTypes "go.bytecodealliance.org/pkg/wit/types" "runtime" "unsafe" ) @@ -41,7 +41,7 @@ type TraceFlags = uint8 // Carries system-specific configuration data, represented as a list of key-value pairs. `trace-state` allows multiple tracing systems to participate in the same trace. // // If any invalid keys or values are provided then the `trace-state` will be treated as an empty list. -type TraceState = []wit_types.Tuple2[string, string] +type TraceState = []witTypes.Tuple2[string, string] // Identifying trace information about a span that can be serialized and propagated. type SpanContext struct { @@ -54,7 +54,7 @@ type SpanContext struct { // Whether this `span-context` was propagated from a remote parent. IsRemote bool // The `trace-state` for this `span-context`. - TraceState []wit_types.Tuple2[string, string] + TraceState []witTypes.Tuple2[string, string] } const ( @@ -178,7 +178,7 @@ func OnStart(context SpanContext) { } slice := (context).TraceState length := uint32(len(slice)) - result3 := wit_runtime.Allocate(pinner, uintptr(length*(4*4)), 4) + result3 := witRuntime.Allocate(pinner, uintptr(length*(4*4)), 4) for index, element := range slice { base := unsafe.Add(result3, index*(4*4)) utf81 := unsafe.Pointer(unsafe.StringData((element).F0)) @@ -203,7 +203,7 @@ func OnEnd(span SpanData) { pinner := &runtime.Pinner{} defer pinner.Unpin() - returnArea := uintptr(wit_runtime.Allocate(pinner, (40 + 32*4), 8)) + returnArea := uintptr(witRuntime.Allocate(pinner, (40 + 32*4), 8)) utf8 := unsafe.Pointer(unsafe.StringData(((span).SpanContext).TraceId)) pinner.Pin(utf8) *(*uint32)(unsafe.Add(unsafe.Pointer(returnArea), 4)) = uint32(uint32(len(((span).SpanContext).TraceId))) @@ -222,7 +222,7 @@ func OnEnd(span SpanData) { *(*int8)(unsafe.Add(unsafe.Pointer(returnArea), (1 + 4*4))) = int8(result) slice := ((span).SpanContext).TraceState length := uint32(len(slice)) - result3 := wit_runtime.Allocate(pinner, uintptr(length*(4*4)), 4) + result3 := witRuntime.Allocate(pinner, uintptr(length*(4*4)), 4) for index, element := range slice { base := unsafe.Add(result3, index*(4*4)) utf81 := unsafe.Pointer(unsafe.StringData((element).F0)) @@ -253,7 +253,7 @@ func OnEnd(span SpanData) { *(*int32)(unsafe.Add(unsafe.Pointer(returnArea), (24 + 12*4))) = int32(((span).EndTime).Nanoseconds) slice8 := (span).Attributes length10 := uint32(len(slice8)) - result9 := wit_runtime.Allocate(pinner, uintptr(length10*(4*4)), 4) + result9 := witRuntime.Allocate(pinner, uintptr(length10*(4*4)), 4) for index, element := range slice8 { base := unsafe.Add(result9, index*(4*4)) utf86 := unsafe.Pointer(unsafe.StringData((element).Key)) @@ -271,7 +271,7 @@ func OnEnd(span SpanData) { *(*uint32)(unsafe.Add(unsafe.Pointer(returnArea), (32 + 12*4))) = uint32(uintptr(uintptr(result9))) slice17 := (span).Events length19 := uint32(len(slice17)) - result18 := wit_runtime.Allocate(pinner, uintptr(length19*(16+4*4)), 8) + result18 := witRuntime.Allocate(pinner, uintptr(length19*(16+4*4)), 8) for index, element := range slice17 { base := unsafe.Add(result18, index*(16+4*4)) utf811 := unsafe.Pointer(unsafe.StringData((element).Name)) @@ -282,7 +282,7 @@ func OnEnd(span SpanData) { *(*int32)(unsafe.Add(unsafe.Pointer(base), (8 + 2*4))) = int32(((element).Time).Nanoseconds) slice14 := (element).Attributes length16 := uint32(len(slice14)) - result15 := wit_runtime.Allocate(pinner, uintptr(length16*(4*4)), 4) + result15 := witRuntime.Allocate(pinner, uintptr(length16*(4*4)), 4) for index, element := range slice14 { base := unsafe.Add(result15, index*(4*4)) utf812 := unsafe.Pointer(unsafe.StringData((element).Key)) @@ -305,7 +305,7 @@ func OnEnd(span SpanData) { *(*uint32)(unsafe.Add(unsafe.Pointer(returnArea), (32 + 14*4))) = uint32(uintptr(uintptr(result18))) slice33 := (span).Links length35 := uint32(len(slice33)) - result34 := wit_runtime.Allocate(pinner, uintptr(length35*(9*4)), 4) + result34 := witRuntime.Allocate(pinner, uintptr(length35*(9*4)), 4) for index, element := range slice33 { base := unsafe.Add(result34, index*(9*4)) utf820 := unsafe.Pointer(unsafe.StringData(((element).SpanContext).TraceId)) @@ -326,7 +326,7 @@ func OnEnd(span SpanData) { *(*int8)(unsafe.Add(unsafe.Pointer(base), (1 + 4*4))) = int8(result22) slice25 := ((element).SpanContext).TraceState length27 := uint32(len(slice25)) - result26 := wit_runtime.Allocate(pinner, uintptr(length27*(4*4)), 4) + result26 := witRuntime.Allocate(pinner, uintptr(length27*(4*4)), 4) for index, element := range slice25 { base := unsafe.Add(result26, index*(4*4)) utf823 := unsafe.Pointer(unsafe.StringData((element).F0)) @@ -344,7 +344,7 @@ func OnEnd(span SpanData) { *(*uint32)(unsafe.Add(unsafe.Pointer(base), (5 * 4))) = uint32(uintptr(uintptr(result26))) slice30 := (element).Attributes length32 := uint32(len(slice30)) - result31 := wit_runtime.Allocate(pinner, uintptr(length32*(4*4)), 4) + result31 := witRuntime.Allocate(pinner, uintptr(length32*(4*4)), 4) for index, element := range slice30 { base := unsafe.Add(result31, index*(4*4)) utf828 := unsafe.Pointer(unsafe.StringData((element).Key)) @@ -392,10 +392,10 @@ func OnEnd(span SpanData) { *(*uint32)(unsafe.Add(unsafe.Pointer(returnArea), (32 + 21*4))) = uint32(uintptr(uintptr(utf837))) switch ((span).InstrumentationScope).Version.Tag() { - case wit_types.OptionNone: + case witTypes.OptionNone: *(*int8)(unsafe.Add(unsafe.Pointer(returnArea), (32 + 23*4))) = int8(int32(0)) - case wit_types.OptionSome: + case witTypes.OptionSome: payload := ((span).InstrumentationScope).Version.Some() *(*int8)(unsafe.Add(unsafe.Pointer(returnArea), (32 + 23*4))) = int8(int32(1)) utf838 := unsafe.Pointer(unsafe.StringData(payload)) @@ -408,10 +408,10 @@ func OnEnd(span SpanData) { } switch ((span).InstrumentationScope).SchemaUrl.Tag() { - case wit_types.OptionNone: + case witTypes.OptionNone: *(*int8)(unsafe.Add(unsafe.Pointer(returnArea), (32 + 26*4))) = int8(int32(0)) - case wit_types.OptionSome: + case witTypes.OptionSome: payload := ((span).InstrumentationScope).SchemaUrl.Some() *(*int8)(unsafe.Add(unsafe.Pointer(returnArea), (32 + 26*4))) = int8(int32(1)) utf839 := unsafe.Pointer(unsafe.StringData(payload)) @@ -424,7 +424,7 @@ func OnEnd(span SpanData) { } slice42 := ((span).InstrumentationScope).Attributes length44 := uint32(len(slice42)) - result43 := wit_runtime.Allocate(pinner, uintptr(length44*(4*4)), 4) + result43 := witRuntime.Allocate(pinner, uintptr(length44*(4*4)), 4) for index, element := range slice42 { base := unsafe.Add(result43, index*(4*4)) utf840 := unsafe.Pointer(unsafe.StringData((element).Key)) @@ -454,17 +454,17 @@ func OuterSpanContext() SpanContext { pinner := &runtime.Pinner{} defer pinner.Unpin() - returnArea := uintptr(wit_runtime.Allocate(pinner, (7 * 4), 4)) + returnArea := uintptr(witRuntime.Allocate(pinner, (7 * 4), 4)) wasm_import_outer_span_context(returnArea) value := unsafe.String((*uint8)(unsafe.Pointer(uintptr(*(*uint32)(unsafe.Add(unsafe.Pointer(returnArea), 0))))), *(*uint32)(unsafe.Add(unsafe.Pointer(returnArea), 4))) value0 := unsafe.String((*uint8)(unsafe.Pointer(uintptr(*(*uint32)(unsafe.Add(unsafe.Pointer(returnArea), (2 * 4)))))), *(*uint32)(unsafe.Add(unsafe.Pointer(returnArea), (3 * 4)))) - result := make([]wit_types.Tuple2[string, string], 0, *(*uint32)(unsafe.Add(unsafe.Pointer(returnArea), (6 * 4)))) + result := make([]witTypes.Tuple2[string, string], 0, *(*uint32)(unsafe.Add(unsafe.Pointer(returnArea), (6 * 4)))) for index := 0; index < int(*(*uint32)(unsafe.Add(unsafe.Pointer(returnArea), (6 * 4)))); index++ { base := unsafe.Add(unsafe.Pointer(uintptr(*(*uint32)(unsafe.Add(unsafe.Pointer(returnArea), (5 * 4))))), index*(4*4)) value1 := unsafe.String((*uint8)(unsafe.Pointer(uintptr(*(*uint32)(unsafe.Add(unsafe.Pointer(base), 0))))), *(*uint32)(unsafe.Add(unsafe.Pointer(base), 4))) value2 := unsafe.String((*uint8)(unsafe.Pointer(uintptr(*(*uint32)(unsafe.Add(unsafe.Pointer(base), (2 * 4)))))), *(*uint32)(unsafe.Add(unsafe.Pointer(base), (3 * 4)))) - result = append(result, wit_types.Tuple2[string, string]{value1, value2}) + result = append(result, witTypes.Tuple2[string, string]{value1, value2}) } result3 := SpanContext{value, value0, uint8(uint8(*(*uint32)(unsafe.Add(unsafe.Pointer(returnArea), (4 * 4))))), (uint8(*(*uint32)(unsafe.Add(unsafe.Pointer(returnArea), (1 + 4*4)))) != 0), result} diff --git a/go/internal/wasi_otel_types/empty.s b/go/internal/wasi_otel_types/empty.s new file mode 100644 index 0000000..308ab60 --- /dev/null +++ b/go/internal/wasi_otel_types/empty.s @@ -0,0 +1,3 @@ +// This file exists for testing this package without WebAssembly, +// allowing empty function bodies with a //go:wasmimport directive. +// See https://pkg.go.dev/cmd/compile for more information. \ No newline at end of file diff --git a/go/internal/wasi_otel_types/wit_bindings.go b/go/internal/wasi_otel_types/wit_bindings.go index 0db7f00..f1b739d 100644 --- a/go/internal/wasi_otel_types/wit_bindings.go +++ b/go/internal/wasi_otel_types/wit_bindings.go @@ -1,4 +1,4 @@ -// Generated by `wit-bindgen` 0.51.0. DO NOT EDIT! +// Generated by `wit-bindgen` 0.54.0. DO NOT EDIT! // // This code was generated from the following packages: // wasi:io@0.2.0 @@ -8,7 +8,7 @@ package wasi_otel_types import ( - "github.com/bytecodealliance/wit-bindgen/wit_types" + witTypes "go.bytecodealliance.org/pkg/wit/types" ) // The key part of attribute `key-value` pairs. @@ -37,7 +37,7 @@ type Resource struct { // Attributes that identify the resource. Attributes []KeyValue // The schema URL to be recorded in the emitted resource. - SchemaUrl wit_types.Option[string] + SchemaUrl witTypes.Option[string] } // Describes the instrumentation scope that produced telemetry. @@ -45,10 +45,10 @@ type InstrumentationScope struct { // Name of the instrumentation scope. Name string // The library version. - Version wit_types.Option[string] + Version witTypes.Option[string] // Schema URL used by this library. // https://opentelemetry.io/docs/specs/otel/schemas/#schema-url - SchemaUrl wit_types.Option[string] + SchemaUrl witTypes.Option[string] // Specifies the instrumentation scope attributes to associate with emitted telemetry. Attributes []KeyValue } diff --git a/go/internal/wit_exports/wit_exports.go b/go/internal/wit_exports/wit_exports.go index 7f168a5..6b2c0a0 100644 --- a/go/internal/wit_exports/wit_exports.go +++ b/go/internal/wit_exports/wit_exports.go @@ -1,4 +1,4 @@ -// Generated by `wit-bindgen` 0.51.0. DO NOT EDIT! +// Generated by `wit-bindgen` 0.54.0. DO NOT EDIT! // // This code was generated from the following packages: // wasi:io@0.2.0 @@ -8,10 +8,10 @@ package wit_exports import ( - "github.com/bytecodealliance/wit-bindgen/wit_runtime" + witRuntime "go.bytecodealliance.org/pkg/wit/runtime" "runtime" ) var staticPinner = runtime.Pinner{} -var exportReturnArea = uintptr(wit_runtime.Allocate(&staticPinner, 0, 1)) +var exportReturnArea = uintptr(witRuntime.Allocate(&staticPinner, 0, 1)) var syncExportPinner = runtime.Pinner{} diff --git a/go/logs/conversions.go b/go/logs/conversions.go index 3a10df3..8b3c646 100644 --- a/go/logs/conversions.go +++ b/go/logs/conversions.go @@ -5,48 +5,48 @@ import ( "encoding/json" "fmt" - "github.com/bytecodealliance/wit-bindgen/wit_types" "github.com/calebschoepp/opentelemetry-wasi/internal/wasi_clocks_wall_clock" "github.com/calebschoepp/opentelemetry-wasi/internal/wasi_otel_logs" "github.com/calebschoepp/opentelemetry-wasi/internal/wasi_otel_tracing" "github.com/calebschoepp/opentelemetry-wasi/internal/wasi_otel_types" "github.com/calebschoepp/opentelemetry-wasi/types" + witTypes "go.bytecodealliance.org/pkg/wit/types" logApi "go.opentelemetry.io/otel/log" "go.opentelemetry.io/otel/sdk/log" ) func toWasiLogRecord(r log.Record) wasi_otel_logs.LogRecord { - var ts wit_types.Option[wasi_otel_logs.Datetime] + var ts witTypes.Option[wasi_otel_logs.Datetime] if r.Timestamp().IsZero() { - ts = wit_types.None[wasi_clocks_wall_clock.Datetime]() + ts = witTypes.None[wasi_clocks_wall_clock.Datetime]() } else { - ts = wit_types.Some(types.ToWasiTime(r.Timestamp())) + ts = witTypes.Some(types.ToWasiTime(r.Timestamp())) } - var ots wit_types.Option[wasi_otel_logs.Datetime] + var ots witTypes.Option[wasi_otel_logs.Datetime] if r.ObservedTimestamp().IsZero() { - ots = wit_types.None[wasi_clocks_wall_clock.Datetime]() + ots = witTypes.None[wasi_clocks_wall_clock.Datetime]() } else { - ots = wit_types.Some(types.ToWasiTime(r.ObservedTimestamp())) + ots = witTypes.Some(types.ToWasiTime(r.ObservedTimestamp())) } - var sn wit_types.Option[uint8] + var sn witTypes.Option[uint8] if r.Severity() == logApi.SeverityUndefined { - sn = wit_types.None[uint8]() + sn = witTypes.None[uint8]() } else { - sn = wit_types.Some(uint8(r.Severity())) + sn = witTypes.Some(uint8(r.Severity())) } - var st wit_types.Option[string] + var st witTypes.Option[string] if r.SeverityText() == "" { - st = wit_types.None[string]() + st = witTypes.None[string]() } else { - st = wit_types.Some(r.SeverityText()) + st = witTypes.Some(r.SeverityText()) } - var attrs wit_types.Option[[]wasi_otel_types.KeyValue] + var attrs witTypes.Option[[]wasi_otel_types.KeyValue] if r.AttributesLen() == 0 { - attrs = wit_types.None[[]wasi_otel_types.KeyValue]() + attrs = witTypes.None[[]wasi_otel_types.KeyValue]() } else { attrList := make([]wasi_otel_types.KeyValue, 0) r.WalkAttributes(func(attr logApi.KeyValue) bool { @@ -58,28 +58,28 @@ func toWasiLogRecord(r log.Record) wasi_otel_logs.LogRecord { return true }) - attrs = wit_types.Some(attrList) + attrs = witTypes.Some(attrList) } - var res wit_types.Option[wasi_otel_types.Resource] + var res witTypes.Option[wasi_otel_types.Resource] if r.Resource() == nil { - res = wit_types.None[wasi_otel_logs.Resource]() + res = witTypes.None[wasi_otel_logs.Resource]() } else { - res = wit_types.Some(types.ToWasiResource(*r.Resource())) + res = witTypes.Some(types.ToWasiResource(*r.Resource())) } - var is wit_types.Option[wasi_otel_types.InstrumentationScope] + var is witTypes.Option[wasi_otel_types.InstrumentationScope] if r.InstrumentationScope().Name == "" { - is = wit_types.None[wasi_otel_logs.InstrumentationScope]() + is = witTypes.None[wasi_otel_logs.InstrumentationScope]() } else { - is = wit_types.Some(types.ToWasiInstrumentationScope(r.InstrumentationScope())) + is = witTypes.Some(types.ToWasiInstrumentationScope(r.InstrumentationScope())) } - var tf wit_types.Option[wasi_otel_tracing.TraceFlags] + var tf witTypes.Option[wasi_otel_tracing.TraceFlags] if !r.TraceFlags().IsSampled() { - tf = wit_types.None[wasi_otel_tracing.TraceFlags]() + tf = witTypes.None[wasi_otel_tracing.TraceFlags]() } else { - tf = wit_types.Some(wasi_otel_tracing.TraceFlagsSampled) + tf = witTypes.Some(wasi_otel_tracing.TraceFlagsSampled) } return wasi_otel_logs.LogRecord{ diff --git a/go/metrics/conversions.go b/go/metrics/conversions.go index 0181b79..82b4b7a 100644 --- a/go/metrics/conversions.go +++ b/go/metrics/conversions.go @@ -3,11 +3,11 @@ package metrics import ( "time" - "github.com/bytecodealliance/wit-bindgen/wit_types" "github.com/calebschoepp/opentelemetry-wasi/internal/wasi_clocks_wall_clock" "github.com/calebschoepp/opentelemetry-wasi/internal/wasi_otel_metrics" "github.com/calebschoepp/opentelemetry-wasi/internal/wasi_otel_types" "github.com/calebschoepp/opentelemetry-wasi/types" + witTypes "go.bytecodealliance.org/pkg/wit/types" "go.opentelemetry.io/otel/sdk/metric/metricdata" ) @@ -53,12 +53,12 @@ func toWasiMetrics(metrics []metricdata.Metrics) []wasi_otel_metrics.Metric { func toWasiMetricData(data metricdata.Aggregation) wasi_otel_metrics.MetricData { switch v := data.(type) { case metricdata.Gauge[int64]: - var startOpt wit_types.Option[wasi_clocks_wall_clock.Datetime] + var startOpt witTypes.Option[wasi_clocks_wall_clock.Datetime] start, timeVal := extractTimestamps(v.DataPoints) if start == nil { - startOpt = wit_types.None[wasi_clocks_wall_clock.Datetime]() + startOpt = witTypes.None[wasi_clocks_wall_clock.Datetime]() } else { - startOpt = wit_types.Some(*start) + startOpt = witTypes.Some(*start) } return wasi_otel_metrics.MakeMetricDataS64Gauge(wasi_otel_metrics.Gauge{ @@ -67,12 +67,12 @@ func toWasiMetricData(data metricdata.Aggregation) wasi_otel_metrics.MetricData Time: timeVal, }) case metricdata.Gauge[float64]: - var startOpt wit_types.Option[wasi_clocks_wall_clock.Datetime] + var startOpt witTypes.Option[wasi_clocks_wall_clock.Datetime] start, timeVal := extractTimestamps(v.DataPoints) if start == nil { - startOpt = wit_types.None[wasi_clocks_wall_clock.Datetime]() + startOpt = witTypes.None[wasi_clocks_wall_clock.Datetime]() } else { - startOpt = wit_types.Some(*start) + startOpt = witTypes.Some(*start) } return wasi_otel_metrics.MakeMetricDataF64Gauge(wasi_otel_metrics.Gauge{ DataPoints: toWasiGaugeDataPoint(v.DataPoints), @@ -207,12 +207,12 @@ func toWasiExponentialHistogram[T float64 | int64](dataPoints []metricdata.Expon return result } -func toWasiOptMetricNumber[T float64 | int64](n metricdata.Extrema[T]) wit_types.Option[wasi_otel_metrics.MetricNumber] { +func toWasiOptMetricNumber[T float64 | int64](n metricdata.Extrema[T]) witTypes.Option[wasi_otel_metrics.MetricNumber] { num, exists := n.Value() if exists { - return wit_types.Some(toWasiMetricNumber(num)) + return witTypes.Some(toWasiMetricNumber(num)) } else { - return wit_types.None[wasi_otel_metrics.MetricNumber]() + return witTypes.None[wasi_otel_metrics.MetricNumber]() } } diff --git a/go/tracing/conversions.go b/go/tracing/conversions.go index bb567ac..9be14a1 100644 --- a/go/tracing/conversions.go +++ b/go/tracing/conversions.go @@ -5,9 +5,9 @@ import ( "fmt" "strings" - "github.com/bytecodealliance/wit-bindgen/wit_types" "github.com/calebschoepp/opentelemetry-wasi/internal/wasi_otel_tracing" "github.com/calebschoepp/opentelemetry-wasi/types" + witTypes "go.bytecodealliance.org/pkg/wit/types" "go.opentelemetry.io/otel/codes" "go.opentelemetry.io/otel/sdk/trace" traceApi "go.opentelemetry.io/otel/trace" @@ -129,9 +129,9 @@ func toOtelSpanContext(ctx wasi_otel_tracing.SpanContext) traceApi.SpanContext { } func toWasiSpanContext(s traceApi.SpanContext) wasi_otel_tracing.SpanContext { - traceState := make([]wit_types.Tuple2[string, string], s.TraceState().Len()) + traceState := make([]witTypes.Tuple2[string, string], s.TraceState().Len()) s.TraceState().Walk(func(key, value string) bool { - traceState = append(traceState, wit_types.Tuple2[string, string]{ + traceState = append(traceState, witTypes.Tuple2[string, string]{ F0: key, F1: value, }) diff --git a/go/types/conversions.go b/go/types/conversions.go index 1cc45a6..2570985 100644 --- a/go/types/conversions.go +++ b/go/types/conversions.go @@ -4,9 +4,9 @@ import ( "encoding/json" "time" - "github.com/bytecodealliance/wit-bindgen/wit_types" "github.com/calebschoepp/opentelemetry-wasi/internal/wasi_clocks_wall_clock" "github.com/calebschoepp/opentelemetry-wasi/internal/wasi_otel_types" + witTypes "go.bytecodealliance.org/pkg/wit/types" "go.opentelemetry.io/otel/attribute" "go.opentelemetry.io/otel/sdk/instrumentation" "go.opentelemetry.io/otel/sdk/resource" @@ -65,12 +65,12 @@ func otelValueToJson(v attribute.Value) string { } } -func ToWasiOptStr(s string) wit_types.Option[string] { +func ToWasiOptStr(s string) witTypes.Option[string] { if s == "" { - return wit_types.None[string]() + return witTypes.None[string]() } - return wit_types.Some(s) + return witTypes.Some(s) } func ToWasiInstrumentationScope(s instrumentation.Scope) wasi_otel_types.InstrumentationScope {