Skip to content

Commit 708d5df

Browse files
authored
Clarify event timestamp origin and range (#839)
1 parent 7c3cbd8 commit 708d5df

File tree

2 files changed

+20
-6
lines changed

2 files changed

+20
-6
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,8 @@ Updates:
4343
([#669](https://github.com/open-telemetry/opentelemetry-specification/pull/669))
4444
* SpanProcessors must provide read/write access at least in OnStart.
4545
- Specify how `Probability` sampler is used with `ParentOrElse` sampler.
46+
- Clarify event timestamp origin and range
47+
([#839](https://github.com/open-telemetry/opentelemetry-specification/pull/839))
4648
- Clean up api-propagators.md, by extending documentation and removing redundant
4749
sections
4850
([#577](https://github.com/open-telemetry/opentelemetry-specification/pull/577))

specification/trace/api.md

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -456,19 +456,31 @@ with the moment when they are added to the `Span`.
456456

457457
An `Event` is defined by the following properties:
458458

459-
- (Required) Name of the event.
460-
- (Optional) [`Attributes`](../common/common.md#attributes).
461-
- (Optional) Timestamp for the event. If not provided, the current time when the event is added MUST be used.
459+
- Name of the event.
460+
- A timestamp for the event. Either the time at which the event was
461+
added or a custom timestamp provided by the user.
462+
- [`Attributes`](../common/common.md#attributes) further describing the event.
462463

463464
The `Event` SHOULD be an immutable type.
464465

465466
The Span interface MUST provide:
466467

467468
- An API to record a single `Event` where the `Event` properties are passed as
468469
arguments. This MAY be called `AddEvent`.
469-
470-
Events SHOULD preserve the order in which they're set. This will typically match
471-
the ordering of the events' timestamps.
470+
This API takes the name of the event, optional `Attributes` and an optional
471+
`Timestamp` which can be used to specify the time at which the event occurred.
472+
If no custom timestamp is provided by the user, the implementation automatically
473+
sets the time at which this API is called on the event.
474+
475+
Events SHOULD preserve the order in which they are recorded.
476+
This will typically match the ordering of the events' timestamps,
477+
but events may be recorded out-of-order using custom timestamps.
478+
479+
Consumers should be aware that an event's timestamp might be before the start or
480+
after the end of the span if custom timestamps were provided by the user for the
481+
event or when starting or ending the span.
482+
The specification does not require any normalization if provided timestamps are
483+
out of range.
472484

473485
Note that the OpenTelemetry project documents certain ["standard event names and
474486
keys"](semantic_conventions/README.md) which have prescribed semantic meanings.

0 commit comments

Comments
 (0)