You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Ensure that any global state (e.g. component ID counters) is reset between tests.
1111
1111
1112
+
### Experimental Features
1113
+
1114
+
To support the development of new features in the specification, we use the following patterns to implement in-development features without adding new public artifacts in stable modules.
1115
+
1116
+
#### Experimental behavior with no API artifacts
1117
+
1118
+
Features that change behavior without changing the API (e.g., exemplar collection, auto-generation of identifiers) are implemented behind a feature gate.
1119
+
The implementation resides in an `/internal/x` package and is activated through environment variables with the `OTEL_GO_X_` prefix (e.g., `OTEL_GO_X_OBSERVABILITY`).
1120
+
The feature must be documented in a `README.md` file in the `/internal/x` package.
1121
+
1122
+
#### Experimental methods on SDK-only interfaces
1123
+
1124
+
Features that require new methods on SDK interfaces are defined as a new interface in an experimental module (e.g., `go.opentelemetry.io/otel/sdk/x`).
1125
+
The SDK uses type assertions (without importing the unstable package) to check if passing types implement these experimental interfaces.
1126
+
The SDK must not depend on the experimental module.
1127
+
1128
+
#### Experimental structs, functions, or interfaces
1129
+
1130
+
Features that don't need any changes to the existing stable package are implemented in an experimental module (e.g., `go.opentelemetry.io/otel/sdk/x`).
1131
+
1132
+
#### Experimental signals and components
1133
+
1134
+
New telemetry signals (e.g., Logs before stabilization) and components (e.g. bridges) are hosted in new, unstable modules (e.g., `go.opentelemetry.io/otel/log` before 1.0.0).
1135
+
The package should have the final name it will use once stabilized (i.e. not `/x`), and is released at a v0.x.y version to indicate it is not stable.
1136
+
Most new components are hosted in [opentelemetry-go-contrib](https://github.com/open-telemetry/opentelemetry-go-contrib).
1137
+
1138
+
#### Experimental options for API or SDK functions
1139
+
1140
+
Experimental Options functions are implemented in an experimental module (e.g., `go.opentelemetry.io/otel/sdk/x`).
1141
+
The return type of the Option function must embed the option's type (e.g. `metric.InstrumentOption`), and have an `Experimental()` method to prevent the API from panicking when the option is used.
1142
+
The SDK uses type assertions (without importing the unstable package) to check if passing types implement these experimental interfaces.
1143
+
The SDK must not depend on the experimental module.
1144
+
1145
+
For example:
1146
+
1147
+
```go
1148
+
type myOption struct {
1149
+
// Embed the stable option type.
1150
+
metric.InstrumentOption
1151
+
value string
1152
+
}
1153
+
1154
+
// Experimental prevents the API from panicking when the option is used.
1155
+
func(omyOption) Experimental() {}
1156
+
1157
+
// The SDK can use type assertions to use this function.
0 commit comments