Skip to content

Commit

Permalink
Add ObservedTimestamp to pdata.LogRecord (#5171)
Browse files Browse the repository at this point in the history
Resolves #5170
  • Loading branch information
djaglowski authored Apr 11, 2022
1 parent 418ae40 commit 87ad1ae
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
### 💡 Enhancements 💡

- OTLP HTTP receiver will use HTTP/2 over TLS if client supports it (#5190)
- Add `ObservedTimestamp` field to `pdata.LogRecord` (#5171)

### 🧰 Bug fixes 🧰

Expand Down
1 change: 1 addition & 0 deletions internal/otlptext/logs.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ func (textLogsMarshaler) MarshalLogs(ld pdata.Logs) ([]byte, error) {
for k := 0; k < logs.Len(); k++ {
buf.logEntry("LogRecord #%d", k)
lr := logs.At(k)
buf.logEntry("ObservedTimestamp: %s", lr.ObservedTimestamp())
buf.logEntry("Timestamp: %s", lr.Timestamp())
buf.logEntry("Severity: %s", lr.SeverityText())
buf.logEntry("Body: %s", attributeValueToString(lr.Body()))
Expand Down
8 changes: 8 additions & 0 deletions model/internal/cmd/pdatagen/internal/log_structs.go
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,14 @@ var logRecord = &messageValueStruct{
description: "// LogRecord are experimental implementation of OpenTelemetry Log Data Model.\n",
originFullName: "otlplogs.LogRecord",
fields: []baseField{
&primitiveTypedField{
fieldName: "ObservedTimestamp",
originFieldName: "ObservedTimeUnixNano",
returnType: "Timestamp",
rawType: "uint64",
defaultVal: "Timestamp(0)",
testVal: "Timestamp(1234567890)",
},
&primitiveTypedField{
fieldName: "Timestamp",
originFieldName: "TimeUnixNano",
Expand Down
11 changes: 11 additions & 0 deletions model/internal/generated_log.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 9 additions & 0 deletions model/internal/generated_log_test.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 87ad1ae

Please sign in to comment.