embedded.go 2.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. // Copyright The OpenTelemetry Authors
  2. //
  3. // Licensed under the Apache License, Version 2.0 (the "License");
  4. // you may not use this file except in compliance with the License.
  5. // You may obtain a copy of the License at
  6. //
  7. // http://www.apache.org/licenses/LICENSE-2.0
  8. //
  9. // Unless required by applicable law or agreed to in writing, software
  10. // distributed under the License is distributed on an "AS IS" BASIS,
  11. // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12. // See the License for the specific language governing permissions and
  13. // limitations under the License.
  14. // Package embedded provides interfaces embedded within the [OpenTelemetry
  15. // trace API].
  16. //
  17. // Implementers of the [OpenTelemetry trace API] can embed the relevant type
  18. // from this package into their implementation directly. Doing so will result
  19. // in a compilation error for users when the [OpenTelemetry trace API] is
  20. // extended (which is something that can happen without a major version bump of
  21. // the API package).
  22. //
  23. // [OpenTelemetry trace API]: https://pkg.go.dev/go.opentelemetry.io/otel/trace
  24. package embedded // import "go.opentelemetry.io/otel/trace/embedded"
  25. // TracerProvider is embedded in
  26. // [go.opentelemetry.io/otel/trace.TracerProvider].
  27. //
  28. // Embed this interface in your implementation of the
  29. // [go.opentelemetry.io/otel/trace.TracerProvider] if you want users to
  30. // experience a compilation error, signaling they need to update to your latest
  31. // implementation, when the [go.opentelemetry.io/otel/trace.TracerProvider]
  32. // interface is extended (which is something that can happen without a major
  33. // version bump of the API package).
  34. type TracerProvider interface{ tracerProvider() }
  35. // Tracer is embedded in [go.opentelemetry.io/otel/trace.Tracer].
  36. //
  37. // Embed this interface in your implementation of the
  38. // [go.opentelemetry.io/otel/trace.Tracer] if you want users to experience a
  39. // compilation error, signaling they need to update to your latest
  40. // implementation, when the [go.opentelemetry.io/otel/trace.Tracer] interface
  41. // is extended (which is something that can happen without a major version bump
  42. // of the API package).
  43. type Tracer interface{ tracer() }
  44. // Span is embedded in [go.opentelemetry.io/otel/trace.Span].
  45. //
  46. // Embed this interface in your implementation of the
  47. // [go.opentelemetry.io/otel/trace.Span] if you want users to experience a
  48. // compilation error, signaling they need to update to your latest
  49. // implementation, when the [go.opentelemetry.io/otel/trace.Span] interface is
  50. // extended (which is something that can happen without a major version bump of
  51. // the API package).
  52. type Span interface{ span() }