fluent-plugin-sentry
fluent-plugin-sentry copied to clipboard
enhancements for sentry 8
Hello,
I'm enhancing the plugin for sentry 8.x support. Part of sentry8 support includes some protocol changes.
https://docs.getsentry.com/on-premise/clientdev/attributes
Some of these changes involve sending arrays and hashes. Upstream, fluentd record_transformer (for instance) converts all record values to strings.
Option 1:
<filter **>
type record_transformer
enable_ruby
<record>
fingerprint ${require 'json' ; ["{{ default }}", "http://example.com/my.url"].to_json}
</record>
</filter>
def notify_sentry(tag, time, record)
...
event.fingerprint = JSON.parse(record['fingerprint']) if record['fingerprint']
...
Option 2
<filter **>
type record_transformer
enable_ruby
<record>
fingerprint ${["{{ default }}", "http://example.com/my.url"]}
</record>
</filter>
And then we do
def notify_sentry(tag, time, record)
...
event.fingerprint = eval(record['fingerprint']) if record['fingerprint']
...
I prefer option 1 because eval is evil. But I am unsure if we should force json. Yaml would work too. Thoughts?
Also, do we want to handle backwards compatibility to older Sentry 7.x?
For those looking for a way to capture Sentry events from syslog, you might find my sentry-syslog script helpful. It can be used, for example, as the binary for Rsyslog's omprog output module to send syslog messaages to Sentry as breadcrumbs and events.