Skip to content

Commit 7eca8ef

Browse files
committed
docs: add SDK-API-VERSIONING.md to document how to do api changes
1 parent b34de93 commit 7eca8ef

1 file changed

Lines changed: 26 additions & 0 deletions

File tree

SDK-API-VERSIONING.md

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
## This guide is for developers of the Observe SDK. If you are just using the SDK you may ignore this document.
2+
3+
# SDK API Versioning
4+
5+
To avoid confusion with users of the Instrumentation Service and the Observe API, we must be careful with API changes. Users may have modules instrumented with an older version of the Instrumentation Service or built with an older version of the API. When possible we should support the older api to avoid breaking those modules. When too painful to maintain support we should at least detect the issue pre-linking and recommend a path forward.
6+
7+
## General How-To
8+
1. If a change is non-breaking, such as an extension of the API maintaining the same signature, just change the function in all the sdks and call it a day.
9+
2. Otherwise, implement the new version of the function with a new name in all the sdks. Generally, the new name would be `old-name-vX` where `X` is the version number. The first `vX` should be `v2`.
10+
3. If possible keep the old function. It is preferred to modify it to use the new implementation when viable rather than maintaining duplicate implementations. **Pre-linking should warn that the old function is deprecated.**
11+
4. If not possible or unwieldy, pre-linking should error out when a module contains a removed function.
12+
13+
## Language specific notes
14+
### Rust
15+
Pre-linking checks are done in `rust/src/wasm_instr.rs` in `WasmInstrInfo::new`
16+
### Go
17+
Pre-linking checks are done in `go/wasm.go` in `parseNames`
18+
### JS
19+
Pre-linking checks are done in `js/src/lib/collectors/span/mod.ts` in `SpanCollector::setNames`
20+
21+
## Observe API SDKs
22+
TBD whether to change the signatures of the prototypes to match the new versions or to add new prototypes for the new versions.
23+
24+
## Wasm-Instr / Instrumentation Service
25+
Bump `WASM_INSTR_VERSION_MAJOR` and `WASM_INSTR_VERSION_MINOR` (and equivalents in Go and JS) when the observe sdk should warn when a module older than those is loaded (Such as when older versions use deprecated or removed functions). This is purely advisory information, the other SDK API Versioning checks handle whether the observe sdk will error out.
26+

0 commit comments

Comments
 (0)