From ff3f5f5483ee5bbcdab30985f0c7c02554298878 Mon Sep 17 00:00:00 2001 From: Tigran Najaryan Date: Thu, 2 Dec 2021 16:09:48 -0500 Subject: [PATCH] Add ObservedTimestamp to the Log Data Model Resolves https://github.com/open-telemetry/opentelemetry-specification/issues/1875 See the issue for the discussion and the description of the source vs observed timestamps. --- CHANGELOG.md | 3 +++ specification/logs/data-model.md | 19 +++++++++++++++++++ 2 files changed, 22 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index f20b80b2bd7..a3b97b27e5c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 diff --git a/specification/logs/data-model.md b/specification/logs/data-model.md index 3dab3de1996..5f418320fd1 100644 --- a/specification/logs/data-model.md +++ b/specification/logs/data-model.md @@ -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. @@ -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`