newrelic / infra-integrations-sdk

New Relic Infrastructure Integrations SDK
Apache License 2.0
44 stars 23 forks source link

JMX: handle commented lines #273

Open varas opened 3 years ago

varas commented 3 years ago

Description

JMX server endpoint may return "Java comment" lines like # An error report file with more information is saved as:.

In this case JMX will return an error like error: invalid character '#' looking for beginning of value.

It'd be great to handle this case properly and log this as a warning.

Ideally an integration execution instance should be able to keep fetching the rest of the requested data/queries defined.

Nice to haves

  1. A JMX server error may report several lines. Current jmx package is limited to read just 1 line. It'd be great to get the whole error message logged as a single entry.

  2. Circuit breaker. Whenever several queries fail in a row (in this case we are handling "java comment" lines, but this could be extrapolated to other errors), the jmx package client (let's call it that way, although API is a set of awful global functions sharing global state) should prevent next queries to be submitted and log an error instead. This will avoid worsening the JMX endpoint scenario, as it already returned N errors in a row.