Skip to content

Commit 9758cdd

Browse files
authored
Clarify possibility to extend SDK interfaces (#4030)
1 parent c99b5f8 commit 9758cdd

File tree

2 files changed

+28
-13
lines changed

2 files changed

+28
-13
lines changed

CHANGELOG.md

+3
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,9 @@ release.
4949

5050
### Supplementary Guidelines
5151

52+
- Clarify that it is permissible to extend SDK interfaces without requiring a major version bump
53+
([#4030](https://github.com/open-telemetry/opentelemetry-specification/pull/4030))
54+
5255
## v1.33.0 (2024-05-09)
5356

5457
### Context

specification/versioning-and-stability.md

+25-13
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@
1212
* [Development](#development)
1313
* [Stable](#stable)
1414
+ [API Stability](#api-stability)
15-
- [Extending Existing API Calls](#extending-existing-api-calls)
1615
+ [SDK Stability](#sdk-stability)
16+
+ [Extending API/SDK abstractions](#extending-apisdk-abstractions)
1717
+ [Contrib Stability](#contrib-stability)
1818
+ [Semantic Conventions Stability](#semantic-conventions-stability)
1919
+ [Telemetry Stability](#telemetry-stability)
@@ -108,13 +108,23 @@ All existing API calls MUST continue to compile and function against all future
108108

109109
Languages which ship binary artifacts SHOULD offer [ABI compatibility](glossary.md#abi-compatibility) for API packages.
110110

111-
##### Extending Existing API Calls
111+
#### SDK Stability
112+
113+
Public portions of SDK packages MUST remain backwards compatible.
114+
There are two categories of public features: **plugin interfaces** and **constructors**.
115+
A plugin interface is an extension point provided by the SDK which is intended to be implemented by end users in order to customize SDK behaviors.
116+
Examples of plugins interfaces include SpanProcessor, Exporter, and Sampler.
117+
Examples of constructors include configuration objects, environment variables, and SDK builders.
112118

113-
An existing API call MAY be extended without incrementing the major version
119+
Languages which ship binary artifacts SHOULD offer [ABI compatibility](glossary.md#abi-compatibility) for SDK packages.
120+
121+
#### Extending API/SDK abstractions
122+
123+
An existing API/SDK call MAY be extended without incrementing the major version
114124
number if the particular language allows to do it in a backward-compatible
115125
manner.
116126

117-
To add a new parameter to an existing API call depending on the language several
127+
To add a new parameter to an existing API/SDK call depending on the language several
118128
approaches are possible:
119129

120130
- Add a new optional parameter to existing methods. This may not be the right
@@ -125,17 +135,19 @@ approaches are possible:
125135
include the new parameter. This is likely the preferred approach for languages
126136
where method overloads are possible.
127137

128-
There may be other ways to extend existing APIs in non-breaking manner. Language
129-
maintainers SHOULD choose the idiomatic way for their language.
130-
131-
#### SDK Stability
138+
Similarly, existing SDK plugin interfaces MAY be extended with new methods without incrementing the major version
139+
number if the particular language allows to do it in a backward-compatible
140+
manner (e.g. by providing default implementations). Hereby, backwards-compatible means that end user's code that implements
141+
the plugin interfaces MUST continue to be possible to use with newer versions of the SDK without making changes to the end user's code.
142+
For languages that commonly share code via binary artifacts, e.g. Java, backwards-compatible means that end user's code that implements plugin interfaces MUST continue to be possible to use with newer minor or patch versions without recompiling the end user's code.
132143

133-
Public portions of SDK packages MUST remain backwards compatible.
134-
There are two categories of public features: **plugin interfaces** and **constructors**.
135-
Examples of plugins include the SpanProcessor, Exporter, and Sampler interfaces.
136-
Examples of constructors include configuration objects, environment variables, and SDK builders.
144+
If this backwards compatible addition of methods to interfaces is not possible for a language,
145+
the language maintainers MAY still implement the addition using backwards-compatible workarounds without incrementing the major version.
146+
For example, a possible workaround might be to add a new interface instead of extending the existing one and accept the
147+
new interface in addition to the old one in every place.
137148

138-
Languages which ship binary artifacts SHOULD offer [ABI compatibility](glossary.md#abi-compatibility) for SDK packages.
149+
There may be other ways to extend existing API/SDKs in non-breaking manner. Language
150+
maintainers SHOULD choose the idiomatic way for their language.
139151

140152
#### Contrib Stability
141153

0 commit comments

Comments
 (0)