Skip to content

Commit

Permalink
signalfx event ingest requires Event Type to be set (#11121)
Browse files Browse the repository at this point in the history
The signalfx event ingest requires the EventType attribute to be set, otherwise it will not process and drop the event silently.

Signed-off-by: Dani Louca <[email protected]>
  • Loading branch information
dloucasfx authored Jun 20, 2022
1 parent 7584947 commit d54d02e
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,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

0 comments on commit d54d02e

Please sign in to comment.