Skip to content

Commit c186f8d

Browse files
songy23mayurkale22
authored andcommitted
Add Tracer operations specs. (#105)
* Add Tracer operations specs. Fixes #38. * recordSpanData should be async. * Fix typos. * Fix review comments. * Fix another typo. Co-Authored-By: Mayur Kale <mayurkale@google.com>
1 parent d343182 commit c186f8d

File tree

1 file changed

+59
-4
lines changed

1 file changed

+59
-4
lines changed

specification/tracing-api.md

Lines changed: 59 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,62 @@ TODO: How tracer can be constructed? https://github.com/open-telemetry/opentelem
1616

1717
### Tracer operations
1818

19-
TODO: Tracing operations. https://github.com/open-telemetry/opentelemetry-specification/issues/38
19+
#### `GetCurrentSpan`: returns the current Span from the current context.
20+
21+
There should be no parameter.
22+
23+
Returns the default `Span` that does nothing and has an invalid `SpanContext` if no
24+
`Span` is associated with the current context, otherwise the current `Span` from the context.
25+
26+
#### `WithSpan`: enters the scope of code where the given `Span` is in the current context.
27+
28+
Required parameters:
29+
30+
- The `Span` to be set to the current context.
31+
32+
Returns an object that defines a scope where the given `Span` will be set to the current context.
33+
34+
The scope is exited and previous state should be restored when the returned object is closed.
35+
36+
#### `SpanBuilder`: returns a `SpanBuilder` to create and start a new `Span`.
37+
38+
Required parameters:
39+
40+
- Name of the span.
41+
42+
Returns a `SpanBuilder` to create and start a new `Span`.
43+
44+
#### `RecordSpanData`: records a `SpanData`.
45+
46+
Required parameters:
47+
48+
- `SpanData` to be reported to all exporters.
49+
50+
This API allows to send a pre-populated span object to the exporter.
51+
Sampling and recording decisions as well as other collection optimizations are a
52+
responsibility of a caller.
53+
54+
Note, the `SpanContext` object in the span population with
55+
the values that will allow correlation of telemetry is also a caller responsibility.
56+
57+
This API should be non-blocking.
58+
59+
#### `GetBinaryFormat`: returns the binary format interface which can serialize/deserialize `Span`s.
60+
61+
There should be no parameter.
62+
63+
Returns the binary format for this implementation. If no implementation is provided
64+
then no-op implementation will be used.
65+
66+
#### `GetHttpTextFormat`: returns the HTTP text format interface which can inject/extract `Span`s.
67+
68+
There should be no parameter.
69+
70+
Returns the HTTP text format for this implementation. If no implementation is provided
71+
then no-op implementation will be used.
72+
73+
Usually this will be the W3C Trace Context as the HTTP text format. For more details, see
74+
[trace-context](https://github.com/w3c/trace-context).
2075

2176
## Span
2277

@@ -50,14 +105,14 @@ recording status, none of the below may be called after the `Span` is finished.
50105

51106
#### `GetContext`: retrieve the `Span`s `SpanContext`
52107

53-
There should be no parameters.
108+
There should be no parameter.
54109

55110
**Returns** the `SpanContext` for the given `Span`. The returned value may be
56111
used even after the `Span` is finished.
57112

58113
#### `IsRecordingEvents`: returns the flag whether this span will be recorded
59114

60-
There should be no parameters.
115+
There should be no parameter.
61116

62117
Returns true if this `Span` is active and recording information like events with
63118
the `AddEvent` operation and attributes using `SetAttributes`.
@@ -136,7 +191,7 @@ with the `Span`).
136191
Call to `End` of a `Span` MUST not have any effects on child spans. Those may
137192
still be running and can be ended later.
138193

139-
There MUST be no parameters.
194+
There MUST be no parameter.
140195

141196
This API MUST be non-blocking.
142197

0 commit comments

Comments
 (0)