Skip to content

Instantly share code, notes, and snippets.

@nelhage
Created August 26, 2016 01:40
Show Gist options
  • Save nelhage/eb4ac2126ed8051875e15e938f232e40 to your computer and use it in GitHub Desktop.
Save nelhage/eb4ac2126ed8051875e15e938f232e40 to your computer and use it in GitHub Desktop.

honey-go feedback

  • 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 a Config so I could configure it without having to mutate separately. It's unclear from the docs whether I have to call NewBuilder or whether &Builder{} is a valid Builder
  • 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 - why Now()? 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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment