Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

signalfx event ingest requires Event Type to be set #11121

Merged
merged 1 commit into from
Jun 20, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@
- `pkg/stanza`: Fix access to atomic variable without using atomic package (#11023)
- `exporter/awsemfexporter:`: Fix dead links in README.md. (#11027)
- `googlecloudexporter`: Fix (self-obs) point_count metric calculation, concurrent map write panic, and dropped log attributes (#11051)
- `signalfxexporter`: Event Type is a required field, if not set, set it to `unknown` to prevent signalfx ingest from dropping it (#11121)

## v0.53.0

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,12 @@ func convertLogRecord(lr plog.LogRecord, resourceAttrs pcommon.Map, logger *zap.
// SignalFx event timestamps.
event.Timestamp = int64(lr.Timestamp()) / 1e6

// EventType is a required field, if not set sfx event ingest will drop it
if event.EventType == "" {
logger.Debug("EventType is not set; setting it to unknown")
event.EventType = "unknown"
}

return &event, true
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,20 @@ func TestLogDataToSignalFxEvents(t *testing.T) {
return logs
}(),
},
{
name: "missing event type",
sfxEvents: func() []*sfxpb.Event {
e := buildDefaultSFxEvent()
e.EventType = "unknown"
return []*sfxpb.Event{e}
}(),
logData: func() plog.Logs {
logs := buildDefaultLogs()
lrs := logs.ResourceLogs().At(0).ScopeLogs().At(0).LogRecords()
lrs.At(0).Attributes().Remove("com.splunk.signalfx.event_type")
return logs
}(),
},
}

for _, tt := range tests {
Expand Down
6 changes: 4 additions & 2 deletions receiver/signalfxreceiver/signalfxv2_event_to_logdata.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,11 @@ func signalFxV2EventsToLogRecords(events []*sfxpb.Event, lrs plog.LogRecordSlice
attrs.EnsureCapacity(2 + len(event.Dimensions) + len(event.Properties))

// The EventType field is stored as an attribute.
if event.EventType != "" {
attrs.InsertString(splunk.SFxEventType, event.EventType)
eventType := event.EventType
if eventType == "" {
eventType = "unknown"
}
attrs.InsertString(splunk.SFxEventType, eventType)

// SignalFx timestamps are in millis so convert to nanos by multiplying
// by 1 million.
Expand Down