- Having to initialize it globally is weird. Having an implicit global client would be fine, but it's much more idiomatic for Go libraries to be able to launch your own client that maintains state completely independently for a while. That tripped me up at first – I tried to instantiate a
Builder
without init'ing globally, and it didn't work. - relatedly, I expected
NewBuilder
should take aConfig
so I could configure it without having to mutate separately. It's unclear from the docs whether I have to callNewBuilder
or whether&Builder{}
is a validBuilder
- The implicit global keys and
func()
s is convenient but also scares me a little because ew global state. An interesting compromise might be to have
func AddContextField(key string, value func(context.Context)interface{})
func (b *Builder) NewEventContext(context.Context) *Event
and then I could register a function that extracts trace IDs or authorized user or URL or w/e from my context
, since often that data is stored there anyways
SendNow()
confused me as a name - whyNow()
? Does it send synchronously and block or something?- Is there any way to explicitly flush buffers and send now?
- It's unclear to me from the docs what happens if I send a complex object as a value. One thing I ended up wanting a bunch was “add all the k,v pairs on this object, with a prefix on the keys” as a way to namespace fields in an event. I might be weird.