embedded.go raw

   1  // Copyright The OpenTelemetry Authors
   2  // SPDX-License-Identifier: Apache-2.0
   3  
   4  // Package embedded provides interfaces embedded within the [OpenTelemetry
   5  // trace API].
   6  //
   7  // Implementers of the [OpenTelemetry trace API] can embed the relevant type
   8  // from this package into their implementation directly. Doing so will result
   9  // in a compilation error for users when the [OpenTelemetry trace API] is
  10  // extended (which is something that can happen without a major version bump of
  11  // the API package).
  12  //
  13  // [OpenTelemetry trace API]: https://pkg.go.dev/go.opentelemetry.io/otel/trace
  14  package embedded // import "go.opentelemetry.io/otel/trace/embedded"
  15  
  16  // TracerProvider is embedded in
  17  // [go.opentelemetry.io/otel/trace.TracerProvider].
  18  //
  19  // Embed this interface in your implementation of the
  20  // [go.opentelemetry.io/otel/trace.TracerProvider] if you want users to
  21  // experience a compilation error, signaling they need to update to your latest
  22  // implementation, when the [go.opentelemetry.io/otel/trace.TracerProvider]
  23  // interface is extended (which is something that can happen without a major
  24  // version bump of the API package).
  25  type TracerProvider interface{ tracerProvider() }
  26  
  27  // Tracer is embedded in [go.opentelemetry.io/otel/trace.Tracer].
  28  //
  29  // Embed this interface in your implementation of the
  30  // [go.opentelemetry.io/otel/trace.Tracer] if you want users to experience a
  31  // compilation error, signaling they need to update to your latest
  32  // implementation, when the [go.opentelemetry.io/otel/trace.Tracer] interface
  33  // is extended (which is something that can happen without a major version bump
  34  // of the API package).
  35  type Tracer interface{ tracer() }
  36  
  37  // Span is embedded in [go.opentelemetry.io/otel/trace.Span].
  38  //
  39  // Embed this interface in your implementation of the
  40  // [go.opentelemetry.io/otel/trace.Span] if you want users to experience a
  41  // compilation error, signaling they need to update to your latest
  42  // implementation, when the [go.opentelemetry.io/otel/trace.Span] interface is
  43  // extended (which is something that can happen without a major version bump of
  44  // the API package).
  45  type Span interface{ span() }
  46