Skip to content

Commit 807b0b1

Browse files
committed
guidance for sdk extension interfaces
1 parent eef3bf3 commit 807b0b1

1 file changed

Lines changed: 13 additions & 0 deletions

File tree

docs/knowledge/api-design.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,19 @@ To investigate misuse, enable the logger named `io.opentelemetry.usage` at `FINE
103103
development, or periodically in staging/production. Check each argument once, at the first
104104
public entry point — internal methods called by that entry point do not need to re-validate.
105105

106+
### SDK extension interfaces and SPIs
107+
108+
These interfaces are called by the SDK, not directly by application developers.
109+
Examples include `Sampler`, `SpanExporter`, `SpanProcessor`, `LogRecordExporter`,
110+
`MetricExporter`, `MetricReader`, `ComponentProvider`, and SPI interfaces such as those in
111+
`sdk-extensions/autoconfigure-spi` (`ResourceProvider`, `AutoConfigurationCustomizerProvider`,
112+
etc.), `HttpSenderProvider`, and `ContextStorageProvider`.
113+
114+
Because the SDK is NullAway-verified, a null argument here indicates a bug in the SDK itself,
115+
not misuse by an application developer. Use `Objects.requireNonNull` — a hard failure surfaces
116+
the bug immediately and unambiguously, which is preferable to silent degradation that would
117+
mask the underlying SDK defect.
118+
106119
### Where to implement guards
107120

108121
Add guards in the concrete implementation class, or in an existing `default` interface method

0 commit comments

Comments
 (0)