@@ -23,19 +23,15 @@ Table of Content
23
23
* [ Span creation] ( #span-creation )
24
24
* [ StartSpan] ( #startspan )
25
25
* [ Span operations] ( #span-operations )
26
- * [ GetContext ] ( #getcontext )
26
+ * [ Get Context ] ( #get-context )
27
27
* [ IsRecordingEvents] ( #isrecordingevents )
28
- * [ SetAttribute ] ( #setattribute )
29
- * [ AddEvent ] ( #addevent )
30
- * [ AddLink ] ( #addlink )
31
- * [ SetStatus ] ( #setstatus )
28
+ * [ Set Attributes ] ( #set-attributes )
29
+ * [ Add Events ] ( #add-events )
30
+ * [ Add Links ] ( #add-links )
31
+ * [ Set Status ] ( #set-status )
32
32
* [ UpdateName] ( #updatename )
33
33
* [ End] ( #end )
34
34
* [ Span lifetime] ( #span-lifetime )
35
- * [ Link] ( #link )
36
- * [ Link creation] ( #link-creation )
37
- * [ GetContext] ( #getcontext-1 )
38
- * [ GetAttributes] ( #getattributes )
39
35
* [ Status] ( #status )
40
36
* [ StatusCanonicalCode] ( #statuscanonicalcode )
41
37
* [ Status creation] ( #status-creation )
@@ -49,7 +45,7 @@ Table of Content
49
45
* [ GetKind] ( #getkind )
50
46
* [ GetStartTimestamp] ( #getstarttimestamp )
51
47
* [ GetEndTimestamp] ( #getendtimestamp )
52
- * [ GetContext] ( #getcontext-2 )
48
+ * [ GetContext] ( #getcontext )
53
49
* [ GetParentSpanId] ( #getparentspanid )
54
50
* [ GetResource] ( #getresource )
55
51
* [ GetAttributes] ( #getattributes-1 )
@@ -282,14 +278,12 @@ Returns the newly created `Span`.
282
278
With the exception of the method to retrieve the ` Span ` 's ` SpanContext ` and
283
279
recording status, none of the below may be called after the ` Span ` is finished.
284
280
285
- #### GetContext
286
-
287
- Retrieve the ` Span ` s ` SpanContext `
281
+ #### Get Context
288
282
289
- There should be no parameter.
290
-
291
- Returns the ` SpanContext ` for the given ` Span ` . The returned value may be
292
- used even after the ` Span ` is finished .
283
+ The Span interface MUST provide:
284
+ - An API that returns the ` SpanContext ` for the given ` Span ` . The returned value
285
+ may be used even after the ` Span ` is finished . The returned value MUST be the
286
+ same for the entire Span lifetime. This MAY be called ` GetContext ` .
293
287
294
288
#### IsRecordingEvents
295
289
@@ -300,63 +294,76 @@ There should be no parameter.
300
294
Returns true if this ` Span ` is active and recording information like events with
301
295
the ` AddEvent ` operation and attributes using ` SetAttributes ` .
302
296
303
- #### SetAttribute
297
+ #### Set Attributes
304
298
305
- Set the ` Span ` 's attribute .
299
+ A ` Span ` MUST have the ability to set attributes associated with it .
306
300
307
- Required parameters
301
+ An ` Attribute ` is defined by the following properties:
302
+ - (Required) The attribute key, which must be a string.
303
+ - (Required) The attribute value, which must be either a string, a boolean
304
+ value, or a numeric type.
308
305
309
- - The attribute key, which must be a string.
310
- - The attribute value, which must be either a string, a boolean value, or a
311
- numeric type.
306
+ The Span interface MUST provide:
307
+ - An API to set a single ` Attribute ` where the attribute properties are passed
308
+ as arguments. This MAY be called ` SetAttribute ` . To avoid extra allocations some
309
+ implementations may offer a separate API for each of the possible value types.
312
310
313
311
Note that the OpenTelemetry project documents certain [ "standard
314
312
attributes"] ( ../semantic-conventions.md ) that have prescribed semantic meanings.
315
313
316
- #### AddEvent
314
+ #### Add Events
317
315
318
- Add an ` Event ` to ` Span ` .
316
+ A ` Span ` MUST have the ability to add events. Events have a time associated
317
+ with the moment when they are added to the ` Span ` .
319
318
320
- Required parameters:
319
+ An ` Event ` is defined by the following properties:
320
+ - (Required) Name of the event.
321
+ - (Optional) One or more ` Attribute ` .
321
322
322
- - Name of the event .
323
+ The ` Event ` SHOULD be an immutable type .
323
324
324
- Optional parameters:
325
-
326
- - One or more key: value pairs, where the keys must be strings and the values may
327
- be string, booleans or numeric type.
325
+ The Span interface MUST provide:
326
+ - An API to record a single ` Event ` where the ` Event ` properties are passed as
327
+ arguments. This MAY be called ` AddEvent ` .
328
+ - An API to record a single lazily initialized ` Event ` . This can be implemented
329
+ by providing an ` Event ` interface or a concrete ` Event ` definition and an
330
+ ` EventFormatter ` . If the language supports overloads then this SHOULD be called
331
+ ` AddEvent ` otherwise ` AddLazyEvent ` may be considered.
328
332
329
333
Note that the OpenTelemetry project documents certain [ "standard event names and
330
334
keys"] ( ../semantic-conventions.md ) which have prescribed semantic meanings.
331
335
332
- #### AddLink
333
-
334
- Adds a link to another ` Span ` from this ` Span ` . Linked ` Span ` can be from the
335
- same or different trace. See [ Links description] ( ../terminology.md#links-between-spans ) .
336
+ #### Add Links
336
337
337
- Required parameters
338
+ A ` Span ` MUST have the ability to record links to other ` Span ` s. Linked ` Span ` s
339
+ can be from the same or a different trace. See [ Links
340
+ description] ( ../terminology.md#links-between-spans ) .
338
341
339
- - ` SpanContext ` of the ` Span ` to link to
342
+ A ` Link ` is defined by the following properties:
343
+ - (Required) ` SpanContext ` of the ` Span ` to link to.
344
+ - (Optional) One or more ` Attribute ` .
340
345
341
- Optional parameters
346
+ The ` Link ` SHOULD be an immutable type.
342
347
343
- - Map of attributes associated with this link. Attributes are key: value pairs
344
- where hey is a string and value is one of string, boolean and numeric.
348
+ The Span interface MUST provide:
349
+ - An API to record a single ` Link ` where the ` Link ` properties are passed as
350
+ arguments. This MAY be called ` AddLink ` .
351
+ - An API to record a single lazily initialized ` Link ` . This can be implemented
352
+ by providing a ` Link ` interface or a concrete ` Link ` definition and a
353
+ ` LinkFormatter ` . If the language supports overloads then this MAY be called
354
+ ` AddLink ` otherwise ` AddLazyLink ` MAY be consider.
345
355
346
- API MUST also provide an overload that accepts a [ ` Link ` interface] ( #link ) . This
347
- overload allows instrumentation to supply a lazily calculated ` Link ` .
356
+ #### Set Status
348
357
349
- #### SetStatus
350
-
351
- Sets the ` Status ` to the ` Span ` . If used, this will override the default ` Span `
352
- status. Default is ` OK ` .
358
+ Sets the [ ` Status ` ] ( #status ) of the ` Span ` . If used, this will override the
359
+ default ` Span ` status, which is ` OK ` .
353
360
354
361
Only the value of the last call will be recorded, and implementations are free
355
362
to ignore previous calls.
356
363
357
- Required parameters
358
-
359
- - New status for the span .
364
+ The Span interface MUST provide:
365
+ - An API to set the ` Status ` where the new status is the only argument. This
366
+ SHOULD be called ` SetStatus ` .
360
367
361
368
#### UpdateName
362
369
@@ -394,34 +401,6 @@ Start and end time as well as Event's timestamps MUST be recorded at a time of a
394
401
calling of corresponding API and MUST not be passed as an argument. In order to
395
402
record already completed span - [ ` SpanData ` ] ( #spandata ) API HAVE TO be used.
396
403
397
- ## Link
398
-
399
- ` Link ` interface represents the [ link between
400
- spans] ( ../terminology.md#links-between-spans ) . Interface only expose two
401
- getters. API also MUST provide a way to create a Link.
402
-
403
- ### Link creation
404
-
405
- API MUST provide a way to create a new ` Link ` .
406
-
407
- Required parameters
408
-
409
- - ` SpanContext ` of the ` Span ` to link to
410
-
411
- Optional parameters
412
-
413
- - Map of attributes associated with this link. Attributes are key: value pairs
414
- where key is a string and value is one of string, boolean and numeric.
415
-
416
- ### GetContext
417
-
418
- Returns the ` SpanContext ` of a linked span.
419
-
420
- ### GetAttributes
421
-
422
- Returns the immutable collection of attributes associated with this ` Link ` .
423
- Order of attributes is not significant.
424
-
425
404
## Status
426
405
427
406
` Status ` interface represents the status of a finished ` Span ` . It's composed of
0 commit comments