Skip to content

Commit d03a622

Browse files
pegasassrikanthccv
andauthored
Logs: ObservedTimestamp field is missing in console exporter output (#3564)
* ObservedTimestamp field is not set * Update CHANGELOG.md unrelease --------- Co-authored-by: Srikanth Chekuri <[email protected]>
1 parent b9ee532 commit d03a622

File tree

3 files changed

+5
-0
lines changed

3 files changed

+5
-0
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
77

88
## Unreleased
99

10+
- Logs: ObservedTimestamp field is missing in console exporter output
11+
([#3564](https://github.com/open-telemetry/opentelemetry-python/pull/3564))
1012
- Fix explicit bucket histogram aggregation
1113
([#3429](https://github.com/open-telemetry/opentelemetry-python/pull/3429))
1214
- Add `code.lineno`, `code.function` and `code.filepath` to all logs

opentelemetry-sdk/src/opentelemetry/sdk/_logs/_internal/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -206,6 +206,7 @@ def to_json(self, indent=4) -> str:
206206
else None,
207207
"dropped_attributes": self.dropped_attributes,
208208
"timestamp": ns_to_iso_str(self.timestamp),
209+
"observed_timestamp": ns_to_iso_str(self.observed_timestamp),
209210
"trace_id": f"0x{format_trace_id(self.trace_id)}"
210211
if self.trace_id is not None
211212
else "",

opentelemetry-sdk/tests/logs/test_log_record.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ def test_log_record_to_json(self):
2929
"attributes": None,
3030
"dropped_attributes": 0,
3131
"timestamp": "1970-01-01T00:00:00.000000Z",
32+
"observed_timestamp": "1970-01-01T00:00:00.000000Z",
3233
"trace_id": "",
3334
"span_id": "",
3435
"trace_flags": None,
@@ -38,6 +39,7 @@ def test_log_record_to_json(self):
3839
)
3940
actual = LogRecord(
4041
timestamp=0,
42+
observed_timestamp=0,
4143
body="a log line",
4244
).to_json()
4345
self.assertEqual(expected, actual)

0 commit comments

Comments
 (0)