ananthakumaran/memcachex

Emit Telemetry events

Closed this issue · 3 comments

Hello!

Telemetry is getting traction now that it's included in Phoenix and Ecto out-of-the-box. What's your stance on emitting telemetry events from this library? Would you welcome contributions?

It would allow users of this library to capture important metrics and send them to their monitoring solution. This way, we save everyone the time to instrument their own usage of this library.

Stephan

I am definitely interested in adding support for telemetry. I would be happy to accept contributions. It would be great if you could put together a spec that explains what events (including metadata, measurements) would be published, sort of like this

Cool! Their documentation is really neat; I'll get a first draft out as soon as I can :)

[:memcachex, :commands]

  • :elapsed_time (integer) the elapsed time that it took to send the pipeline to the server and get a reply. (a measurement)
  • :server the server the commands were sent to
  • :opts the options that were sent along with the command
  • :server_options the server options that were sent along with the command
  • :commands the commands sent to the server
  • :start_time the system time when the commands were issued

[:memcachex, :commands, :error]

  • :server the server the commands were sent to
  • :opts the options that were sent along with the command
  • :server_options the server options that were sent along with the command
  • :commands the commands sent to the server
  • :start_time the system time when the commands were issued
  • :reason the error reason.

[:memcachex, :connection]

  • :reconnected boolean to indicate this was a reconnection
  • :opts the connection options

[:memcachex, :connection, :error]

  • :opts the connection options
  • :reason the error reason.

Some notes:

  • I'm not intimately familiar with the codebase
  • I followed the Redix patterns, they seem to make sense
  • I'm not sure the connection should include the entire opts or just the host/port for privacy/security reasons
  • not sure I'd have a separate event for reconnection like Redix, seems overkill
  • I assumed that even with a single command, it'd be wrapped in a list (ie commands)

Let me know what you think!