Line data Source code
1 : // Copyright The OpenTelemetry Authors
2 : // SPDX-License-Identifier: Apache-2.0
3 :
4 : part of 'span.dart';
5 :
6 : /// Factory for creating Span instances.
7 : ///
8 : /// This factory class provides a static create method for constructing
9 : /// properly configured Span instances. It follows the factory pattern
10 : /// to separate the construction logic from the Span class itself.
11 : @internal
12 : class SDKSpanCreate {
13 : /// Creates a new Span with the specified delegate and tracer.
14 : ///
15 : /// @param delegateSpan The API Span implementation to delegate to
16 : /// @param sdkTracer The SDK Tracer that created this Span
17 : /// @param isRecording Whether the span records data, per the sampling
18 : /// decision made at creation time (see the Trace SDK spec, ShouldSample).
19 : /// @return A new Span instance
20 59 : static Span create({
21 : required APISpan delegateSpan,
22 : required Tracer sdkTracer,
23 : bool isRecording = true,
24 : }) {
25 59 : return Span._(delegateSpan, sdkTracer, isRecording: isRecording);
26 : }
27 : }
|