Skip to content

Commit

Permalink
Add ObservedTimestamp to the Log Data Model
Browse files Browse the repository at this point in the history
Resolves #1875

See the issue for the discussion and the description of the source vs observed timestamps.
  • Loading branch information
tigrannajaryan committed Dec 2, 2021
1 parent a6cfbc9 commit ff3f5f5
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 0 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@ release.

### Logs

- Added ObservedTimestamp to the Log Data Model.
([#2184](https://github.com/open-telemetry/opentelemetry-specification/pull/2184))

### Resource

### Semantic Conventions
Expand Down
19 changes: 19 additions & 0 deletions specification/logs/data-model.md
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,7 @@ Here is the list of fields in a log record:
Field Name |Description
---------------|--------------------------------------------
Timestamp |Time when the event occurred.
ObservedTimestamp|Time when the event was observed.
TraceId |Request trace id.
SpanId |Request span id.
TraceFlags |W3C trace flag.
Expand All @@ -197,6 +198,24 @@ Type: Timestamp, uint64 nanoseconds since Unix epoch.
Description: Time when the event occurred measured by the origin clock. This
field is optional, it may be missing if the timestamp is unknown.

### Field: `ObservedTimestamp`

Type: Timestamp, uint64 nanoseconds since Unix epoch.

Description: Time when the event was observed by the collection system. For
events that originate in OpenTelemetry this timestamp is typically set at the
generation time and is equal to Timestamp. For events originating externally and
collected by OpenTelemetry (e.g. using Collector) this is the time when the
OpenTelemetry's code observed the event measure by the clock of the
OpenTelemetry code. This field SHOULD be set once the event is observed by
OpenTelemetry.

For converting OpenTelemetry log data to formats that support only one timestamp
or when receiving OpenTelemetry log data by recipients that support only one
timestamp internally the following logic is recommended:

- Use `Timestamp` if it is present, otherwise use `ObservedTimestamp`.

### Trace Context Fields

#### Field: `TraceId`
Expand Down

0 comments on commit ff3f5f5

Please sign in to comment.