jmxtrans / jmxtrans-agent

Java Agent based JMX metrics exporter.
MIT License
179 stars 110 forks source link

RollingFileOutputWriter writes additional empty line when setting 'singleLine' is true #130

Closed raiderx closed 5 years ago

raiderx commented 6 years ago

Empty line is written after each line with metrics:

[2018-04-28T18:49:13.588Z] os.systemLoadAverage=1.26, jvm.heapMemoryUsage.used=33344160, jvm.heapMemoryUsage.committed=250609664, jvm.nonHeapMemoryUsage.used=18237672, jvm.nonHeapMemoryUsage.committed=24576000, jvm.loadedClassesCount=2563, jvm.threadCount=13, tomcat.requestCount=0, tomcat.errorCount=0, tomcat.processingTime=0, tomcat.bytesSent=0, tomcat.bytesReceived=0, tomcat.maxThreads=200, tomcat.connectionCount=1

[2018-04-28T18:49:33.593Z] os.systemLoadAverage=1.02, jvm.heapMemoryUsage.used=33344160, jvm.heapMemoryUsage.committed=250609664, jvm.nonHeapMemoryUsage.used=18237672, jvm.nonHeapMemoryUsage.committed=24576000, jvm.loadedClassesCount=2563, jvm.threadCount=13, tomcat.requestCount=0, tomcat.errorCount=0, tomcat.processingTime=0, tomcat.bytesSent=0, tomcat.bytesReceived=0, tomcat.maxThreads=200, tomcat.connectionCount=1

[2018-04-28T18:49:53.595Z] os.systemLoadAverage=0.92, jvm.heapMemoryUsage.used=33344160, jvm.heapMemoryUsage.committed=250609664, jvm.nonHeapMemoryUsage.used=18237672, jvm.nonHeapMemoryUsage.committed=24576000, jvm.loadedClassesCount=2563, jvm.threadCount=13, tomcat.requestCount=0, tomcat.errorCount=0, tomcat.processingTime=0, tomcat.bytesSent=0, tomcat.bytesReceived=0, tomcat.maxThreads=200, tomcat.connectionCount=1

Probably, method org.jmxtrans.agent.RollingFileOutputWriter#postCollect should not write end of line to temporary file writer when signleLine is true.

I'm not sure if it is a bug. But I must ignore this empty line while parsing file with metrics.

raiderx commented 6 years ago

I created PR #131

raiderx commented 5 years ago

Fixed