Skip to content

Commit

Permalink
Apply suggestions from code review
Browse files Browse the repository at this point in the history
Co-authored-by: Carson Ip <[email protected]>
  • Loading branch information
felixbarny and carsonip authored Jan 3, 2025
1 parent 0b20f36 commit dc67d21
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 3 deletions.
2 changes: 1 addition & 1 deletion .chloggen/elasticsearchexporter_event-name.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ change_type: enhancement
component: elasticsearchexporter

# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`).
note: Handle `EventName` for log records
note: Handle `EventName` for log records in OTel mode

# Mandatory: One or more tracking issues related to the change. You can use the PR number here if no issue exists.
issues: [37011]
Expand Down
3 changes: 1 addition & 2 deletions exporter/elasticsearchexporter/model.go
Original file line number Diff line number Diff line change
Expand Up @@ -178,10 +178,9 @@ func (m *encodeModel) encodeLogOTelMode(resource pcommon.Resource, resourceSchem
document.AddInt("severity_number", int64(record.SeverityNumber()))
document.AddInt("dropped_attributes_count", int64(record.DroppedAttributesCount()))

eventNameAttr, ok := record.Attributes().Get("event.name")
if record.EventName() != "" {
document.AddString("event_name", record.EventName())
} else if ok && eventNameAttr.Str() != "" {
} else if eventNameAttr, ok := record.Attributes().Get("event.name"); ok && eventNameAttr.Str() != "" {
document.AddString("event_name", eventNameAttr.Str())
}

Expand Down

0 comments on commit dc67d21

Please sign in to comment.