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
When implementing the span interface, consider the following guidelines:
53
64
54
65
- SDKs MAY implement additional APIs, such as getters/setters for properties (e.g. `span.getStatus()`), or additional methods for convenience (e.g. `Span::spanContext()`).
@@ -63,7 +74,7 @@ SDKs MUST expose at least one API to start a span. SDKs MAY expose additional AP
63
74
64
75
SDKs MUST expose a default `startSpan` API that takes options and returns a span:
65
76
66
-
```ts
77
+
```ts {tabTitle:TypeScript}
67
78
function startSpan(options:StartSpanOptions):Span;
68
79
69
80
interfaceStartSpanOptions {
@@ -74,6 +85,25 @@ interface StartSpanOptions {
74
85
}
75
86
```
76
87
88
+
```Python {tabTitle:Python}
89
+
# The context-manager way of starting a span. The span will be finished
90
+
# automatically when exiting the context manager.
91
+
92
+
with start_span(
93
+
name, # type:str
94
+
attributes, # type:SpanAttributes
95
+
parent_span, # type:Span
96
+
active, # type:bool
97
+
) as span:
98
+
...
99
+
100
+
# Alternative API without the use of a context manager, to allow for more
0 commit comments