Skip to content

Commit

Permalink
otlplog: Emit Record.EventName field (#6211)
Browse files Browse the repository at this point in the history
Fixes #6185
  • Loading branch information
pellared authored Jan 25, 2025
1 parent 5d25818 commit ae7ac48
Show file tree
Hide file tree
Showing 7 changed files with 11 additions and 0 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm
- `AssertRecordEqual` in `go.opentelemetry.io/otel/log/logtest` checks `Record.EventName`. (#6187)
- Add `EventName` and `SetEventName` to `Record` in `go.opentelemetry.io/otel/sdk/log`. (#6193)
- Add `EventName` to `RecordFactory` in `go.opentelemetry.io/otel/sdk/log/logtest`. (#6193)
- Emit `Record.EventName` field in `go.opentelemetry.io/otel/exporters/otlp/otlplog/otlploggrpc`. (#6211)
- Emit `Record.EventName` field in `go.opentelemetry.io/otel/exporters/otlp/otlplog/otlploghttp`. (#6211)

### Changed

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ func LogRecord(record log.Record) *lpb.LogRecord {
r := &lpb.LogRecord{
TimeUnixNano: timeUnixNano(record.Timestamp()),
ObservedTimeUnixNano: timeUnixNano(record.ObservedTimestamp()),
EventName: record.EventName(),
SeverityNumber: SeverityNumber(record.Severity()),
SeverityText: record.SeverityText(),
Body: LogAttrValue(record.Body()),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,7 @@ var (
out = append(out, logtest.RecordFactory{
Timestamp: ts,
ObservedTimestamp: obs,
EventName: "evnt",
Severity: sevC,
SeverityText: "C",
Body: bodyC,
Expand Down Expand Up @@ -229,6 +230,7 @@ var (
{
TimeUnixNano: uint64(ts.UnixNano()),
ObservedTimeUnixNano: uint64(obs.UnixNano()),
EventName: "evnt",
SeverityNumber: pbSevC,
SeverityText: "C",
Body: pbBodyC,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ func LogRecord(record log.Record) *lpb.LogRecord {
r := &lpb.LogRecord{
TimeUnixNano: timeUnixNano(record.Timestamp()),
ObservedTimeUnixNano: timeUnixNano(record.ObservedTimestamp()),
EventName: record.EventName(),
SeverityNumber: SeverityNumber(record.Severity()),
SeverityText: record.SeverityText(),
Body: LogAttrValue(record.Body()),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,7 @@ var (
out = append(out, logtest.RecordFactory{
Timestamp: ts,
ObservedTimestamp: obs,
EventName: "evnt",
Severity: sevC,
SeverityText: "C",
Body: bodyC,
Expand Down Expand Up @@ -229,6 +230,7 @@ var (
{
TimeUnixNano: uint64(ts.UnixNano()),
ObservedTimeUnixNano: uint64(obs.UnixNano()),
EventName: "evnt",
SeverityNumber: pbSevC,
SeverityText: "C",
Body: pbBodyC,
Expand Down
1 change: 1 addition & 0 deletions internal/shared/otlp/otlplog/transform/log.go.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ func LogRecord(record log.Record) *lpb.LogRecord {
r := &lpb.LogRecord{
TimeUnixNano: timeUnixNano(record.Timestamp()),
ObservedTimeUnixNano: timeUnixNano(record.ObservedTimestamp()),
EventName: record.EventName(),
SeverityNumber: SeverityNumber(record.Severity()),
SeverityText: record.SeverityText(),
Body: LogAttrValue(record.Body()),
Expand Down
2 changes: 2 additions & 0 deletions internal/shared/otlp/otlplog/transform/log_test.go.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,7 @@ var (
out = append(out, logtest.RecordFactory{
Timestamp: ts,
ObservedTimestamp: obs,
EventName: "evnt",
Severity: sevC,
SeverityText: "C",
Body: bodyC,
Expand Down Expand Up @@ -229,6 +230,7 @@ var (
{
TimeUnixNano: uint64(ts.UnixNano()),
ObservedTimeUnixNano: uint64(obs.UnixNano()),
EventName: "evnt",
SeverityNumber: pbSevC,
SeverityText: "C",
Body: pbBodyC,
Expand Down

0 comments on commit ae7ac48

Please sign in to comment.