logstash-logback-encoder icon indicating copy to clipboard operation
logstash-logback-encoder copied to clipboard

LogstachTcpSocketAppender: collect metrics

Open brenuart opened this issue 10 years ago • 2 comments

Would be nice to collect metrics about the appender usage/behaviour:

  • sending rates
  • drop rates
  • total number of TCP connections created
  • total number of connection failure
  • connection rate
  • average time to send events
  • etc

The implementation should be independent of the actual metric implementation (DropWizard, Servo, etc). For this, we could report important events to an interface whose actual implementation would be backed by the appropriate metric implementation.

Implementations could be provided in separate artifacts for Dropwizard for instance and possibly other metric packages.

brenuart avatar Aug 24 '15 15:08 brenuart

Appender listeners have been added in 5.0.

The listeners give you the ability to monitor the appenders.

The behavior requested in this ticket could be implemented with a listener. i.e. you could collect and report on metrics you mentioned in a listener.

philsttr avatar Feb 20 '18 04:02 philsttr

Sorry for the late reply :-( This event mechanism is a great improvement, thanks! It provides access to most of the information required to build a decent metrics mechanism.

A few comments tho:

  • DelegatingAsyncDisruptorAppender does not export anything about the time it takes to process an event - I mean something like TcpAppenderListener#eventSent(..).
  • There is no easy/public access to the current size of the RingBuffer. This information is particularly useful to build a metric reporting the buffer usage. I added such public method myself for this purpose. This may be useful for others as well...

Otherwise, I could build the following metrics (with the additions mentioned above):

  • ingress rate: number of events added to the ring buffer
  • ingress latency: time it takes to enqueue an event in the ring buffer
  • ingress drop rate: number of events dropped because the buffer is full
  • buffer usage: min/max usage of the ring buffer (ie. number of pending events)
  • event enqueue time: time an event stays in the buffer waiting to be sent outside
  • egress rate: number of events processed from the buffer and sent "outside"
  • egress latency: time it takes to process an event out of the ring buffer

Note: Built on top of version 6.1

brenuart avatar Jun 25 '19 09:06 brenuart