Skip to content

Commit

Permalink
Merge pull request #55 from spinnaker/flatten-details-to-strings
Browse files Browse the repository at this point in the history
allow details to be flattened to json string to facilitate downstream processing
  • Loading branch information
tomaslin committed Dec 21, 2015
2 parents f433e6c + ea59a7f commit 6f60674
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ class RestProperties {
Boolean wrap = false
@NotEmpty
String url
Boolean flatten = false

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -55,11 +55,18 @@ class RestEventListener implements EchoEventListener {
sentEvent = [
"eventName": "${service.config.eventName ?: eventName}" as String,
]

if (service.config.flatten) {
eventAsMap.content = mapper.writeValueAsString(eventAsMap.content)
eventAsMap.details = mapper.writeValueAsString(eventAsMap.details)
}

sentEvent["${service.config.fieldName ?: fieldName}" as String] = eventAsMap

}
service.client.recordEvent(sentEvent)
} catch (e) {
log.error("Could not send event ${eventAsMap} to ${service.config.url}")
log.error("Could not send event ${eventAsMap} to ${service.config.url}", e)
}
}
}
Expand Down

0 comments on commit 6f60674

Please sign in to comment.