This article describes Stream-JMX formatters and shows how they output JMX data in different formats.
com.jkoolcloud.tnt4j.stream.jmx.format.FactNameValueFormatter- this class provides key/value formatting for tnt4j activities, events and snapshots. The output uses the following format:"OBJ:name-value-prefix1\name1=value1,name-value-prefix1\name2=value2,....,name-value-prefixN\nameN=valueN"
Sample output:
OBJ:Streams\0, 0\HQDC\samtis\com.jkoolcloud.tnt4j.stream.jmx.impl.PlatformJmxSampler\Activities, Self\location=0, 0, Self\level=INFO, Self\id.count=0, Self\pid=7660, Self\tid=63, Self\snap.count=34, Self\elapsed.usec=9989365, JMImplementation:type\MBeanServerDelegate\MBeanServerId=samtis_1486645461070, JMImplementation:type\MBeanServerDelegate\SpecificationName=Java Management Extensions, JMImplementation:type\MBeanServerDelegate\SpecificationVersion=1.4, JMImplementation:type\MBeanServerDelegate\SpecificationVendor=Oracle Corporation, JMImplementation:type\MBeanServerDelegate\ImplementationName=JMX, JMImplementation:type\MBeanServerDelegate\ImplementationVersion=1.8.0_121-b13, JMImplementation:type\MBeanServerDelegate\ImplementationVendor=Oracle Corporation, org.apache.activemq:brokerName\localhost!type\Broker\Uptime=1 minute, org.apache.activemq:brokerName\localhost!type\Broker\MemoryPercentUsage=0, org.apache.activemq:brokerName\localhost!type\Broker\Persistent=true, org.apache.activemq:brokerName\localhost!type\Broker\DataDirectory=D:\tmp\apache-activemq-5.14.3\data, org.apache.activemq:brokerName\localhost!type\Broker\VMURL=vm://localhost, org.apache.activemq:brokerName\localhost!type\Broker\TempLimit=42844577792, org.apache.activemq:brokerName\localhost!type\Broker\MemoryLimit=668309914, org.apache.activemq:brokerName\localhost!type\Broker\StoreLimit=42846849471, org.apache.activemq:brokerName\localhost!type\Broker\MaxMessageSize=1024, org.apache.activemq:brokerName\localhost!type\Broker\AverageMessageSize=1024, org.apache.activemq:brokerName\localhost!type\Broker\TotalDequeueCount=0, org.apache.activemq:brokerName\localhost!type\Broker\TotalConsumerCount=0, org.apache.activemq:brokerName\localhost!type\Broker\StatisticsEnabled=true, org.apache.activemq:brokerName\localhost!type\Broker\JobSchedulerStoreLimit=0, org.apache.activemq:brokerName\localhost!type\Broker\MinMessageSize=1024, org.apache.activemq:brokerName\localhost!type\Broker\JobSchedulerStorePercentUsage=0, org.apache.activemq:brokerName\localhost!type\Broker\StorePercentUsage=0, org.apache.activemq:brokerName\localhost!type\Broker\TempPercentUsage=0, org.apache.activemq:brokerName\localhost!type\Broker\CurrentConnectionsCount=0, org.apache.activemq:brokerName\localhost!type\Broker\TotalMessageCount=0, org.apache.activemq:brokerName\localhost!type\Broker\TotalConnectionsCount=0, org.apache.activemq:brokerName\localhost!type\Broker\TotalEnqueueCount=1, org.apache.activemq:brokerName\localhost!type\Broker\TotalProducerCount=0, org.apache.activemq:brokerName\localhost!type\Broker\TransportConnectors=[openwire=tcp://samtis:61616?maximumConnections=1000&wireFormat.maxFrameSize=104857600, amqp=amqp://samtis:5672?maximumConnections=1000&wireFormat.maxFrameSize=104857600, mqtt=mqtt://samtis:1883?maximumConnections=1000&wireFormat.maxFrameSize=104857600, stomp=stomp://samtis:61613?maximumConnections=1000&wireFormat.maxFrameSize=104857600, ws=ws://samtis:61614?maximumConnections=1000&wireFormat.maxFrameSize=104857600], org.apache.activemq:brokerName\localhost!type\Broker\BrokerVersion=5.14.3, org.apache.activemq:brokerName\localhost!type\Broker\UptimeMillis=62787, org.apache.activemq:brokerName\localhost!type\Broker\BrokerName=localhost, org.apache.activemq:brokerName\localhost!type\Broker\Slave=false, org.apache.activemq:brokerName\localhost!type\Broker\BrokerId=ID:samtis-52769-1486645462150-0:1, SampleContext\noop.count=0, SampleContext\sample.count=6, SampleContext\total.error.count=6, SampleContext\total.exclude.count=204, SampleContext\mbean.count=37, SampleContext\condition.count=0, SampleContext\listener.count=1, SampleContext\total.action.count=0, SampleContext\total.metric.count=3582, SampleContext\last.metric.count=595, SampleContext\sample.time.usec=10054, SampleContext\listener.exclude.set.count=6, SampleContext\listener.trace.mode=false, ...
Entries are not sorted; sequence is the same as that returned by activity-contained snapshot map entries and snapshot property iterators.
com.jkoolcloud.tnt4j.stream.jmx.format.FactPathValueFormatter- this class provides key/value formatting for tnt4j activities, events and snapshots. The output uses the following format:"OBJ:object-path1\name1=value1,object-path1\name2=value2,....,object-pathN\nameN=valueN"
Sample output:
OBJ:Streams\0, 0\HQDC\samtis\com.jkoolcloud.tnt4j.stream.jmx.impl.PlatformJmxSampler\Activities, Self\location=0, 0, Self\level=INFO, Self\id.count=0, Self\pid=3136, Self\tid=24, Self\snap.count=34, Self\elapsed.usec=9885208, JMImplementation\MBeanServerDelegate\ImplementationName=JMX, JMImplementation\MBeanServerDelegate\ImplementationVendor=Oracle Corporation, JMImplementation\MBeanServerDelegate\ImplementationVersion=1.8.0_121-b13, JMImplementation\MBeanServerDelegate\MBeanServerId=samtis_1486998422874, JMImplementation\MBeanServerDelegate\SpecificationName=Java Management Extensions, JMImplementation\MBeanServerDelegate\SpecificationVendor=Oracle Corporation, JMImplementation\MBeanServerDelegate\SpecificationVersion=1.4, SampleContext\condition.count=0, SampleContext\last.metric.count=633, SampleContext\listener.count=1, SampleContext\listener.exclude.set.count=6, SampleContext\listener.trace.mode=true, SampleContext\mbean.count=37, SampleContext\noop.count=0, SampleContext\sample.count=2, SampleContext\sample.time.usec=72856, SampleContext\total.action.count=0, SampleContext\total.error.count=6, SampleContext\total.exclude.count=66, SampleContext\total.metric.count=1272, org.apache.activemq\Broker\localhost\AverageMessageSize=1024, org.apache.activemq\Broker\localhost\BrokerId=ID:samtis-63754-1486998424125-0:1, org.apache.activemq\Broker\localhost\BrokerName=localhost, org.apache.activemq\Broker\localhost\BrokerVersion=5.14.3, org.apache.activemq\Broker\localhost\CurrentConnectionsCount=0, org.apache.activemq\Broker\localhost\DataDirectory=D:\tmp\apache-activemq-5.14.3\data, org.apache.activemq\Broker\localhost\DurableTopicSubscribers=[], org.apache.activemq\Broker\localhost\DynamicDestinationProducers=[], org.apache.activemq\Broker\localhost\InactiveDurableTopicSubscribers=[], org.apache.activemq\Broker\localhost\JMSJobScheduler=null, org.apache.activemq\Broker\localhost\JobSchedulerStoreLimit=0, org.apache.activemq\Broker\localhost\JobSchedulerStorePercentUsage=0, org.apache.activemq\Broker\localhost\MaxMessageSize=1024, org.apache.activemq\Broker\localhost\MemoryLimit=668309914, org.apache.activemq\Broker\localhost\MemoryPercentUsage=0, org.apache.activemq\Broker\localhost\MinMessageSize=1024, org.apache.activemq\Broker\localhost\Persistent=true, org.apache.activemq\Broker\localhost\QueueProducers=[], org.apache.activemq\Broker\localhost\QueueSubscribers=[], org.apache.activemq\Broker\localhost\Queues=[], org.apache.activemq\Broker\localhost\Slave=false, org.apache.activemq\Broker\localhost\StatisticsEnabled=true, org.apache.activemq\Broker\localhost\StoreLimit=42845775469, org.apache.activemq\Broker\localhost\StorePercentUsage=0, org.apache.activemq\Broker\localhost\TempLimit=42842071040, org.apache.activemq\Broker\localhost\TempPercentUsage=0, org.apache.activemq\Broker\localhost\TemporaryQueueProducers=[], org.apache.activemq\Broker\localhost\TemporaryQueueSubscribers=[], org.apache.activemq\Broker\localhost\TemporaryQueues=[], org.apache.activemq\Broker\localhost\TemporaryTopicProducers=[], org.apache.activemq\Broker\localhost\TemporaryTopicSubscribers=[], org.apache.activemq\Broker\localhost\TemporaryTopics=[], org.apache.activemq\Broker\localhost\TopicProducers=[], org.apache.activemq\Broker\localhost\TopicSubscribers=[], org.apache.activemq\Broker\localhost\Topics=[org.apache.activemq:type=Broker, brokerName=localhost, destinationType=Topic, destinationName=ActiveMQ.Advisory.MasterBroker], org.apache.activemq\Broker\localhost\TotalConnectionsCount=0, org.apache.activemq\Broker\localhost\TotalConsumerCount=0, org.apache.activemq\Broker\localhost\TotalDequeueCount=0, org.apache.activemq\Broker\localhost\TotalEnqueueCount=1, org.apache.activemq\Broker\localhost\TotalMessageCount=0, org.apache.activemq\Broker\localhost\TotalProducerCount=0, org.apache.activemq\Broker\localhost\TransportConnectors=[amqp=amqp://samtis:5672?maximumConnections=1000&wireFormat.maxFrameSize=104857600, mqtt=mqtt://samtis:1883?maximumConnections=1000&wireFormat.maxFrameSize=104857600, ws=ws://samtis:61614?maximumConnections=1000&wireFormat.maxFrameSize=104857600, openwire=tcp://samtis:61616?maximumConnections=1000&wireFormat.maxFrameSize=104857600, stomp=stomp://samtis:61613?maximumConnections=1000&wireFormat.maxFrameSize=104857600], org.apache.activemq\Broker\localhost\Uptime=13 minutes, org.apache.activemq\Broker\localhost\UptimeMillis=822599, org.apache.activemq\Broker\localhost\VMURL=vm://localhost, ...
Entries are sorted by key in alphanumeric
order, and the key representation is more commonly used for, e.g., tree model
construction, to represent the JMX structure more like JConsole does.
com.jkoolcloud.tnt4j.format.LevelingJSONFormatter- this class provides JSON formatting for tnt4j activities, events and snapshots. The difference fromcom.jkoolcloud.tnt4j.format.JSONFormatteris that only the facts payload is present in the produced JSON without most of the TNT4J metadata.Sample output:
{ "source": "com.jkoolcloud.tnt4j.stream.jmx.impl.PlatformJmxSampler", "source-ssn": "tnt4j-stream-jmx", "type": "ACTIVITY", "snapshots": [ { "type": "SNAPSHOT", "name": "JMImplementation:type=MBeanServerDelegate", "properties": { "ImplementationName": "JMX", "ImplementationVendor": "Oracle Corporation", "ImplementationVersion": "1.8.0_152-b16", "MBeanServerId": "samtis_1517919369871", "SpecificationName": "Java Management Extensions", "SpecificationVendor": "Oracle Corporation", "SpecificationVersion": "1.4", "type": "MBeanServerDelegate" } }, { "type": "SNAPSHOT", "name": "SampleContext", "properties": { "condition.count": 0, "last.metric.count": 5688, "listener.compositeProperty.delimiter": "\\", "listener.count": 1, "listener.exclude.set.count": 0, "listener.forceObjectName.mode": false, "listener.silence.set.count": 6, "listener.trace.mode": true, "listener.useObjectNameProperties.mode": true, "mbean.count": 636, "noop.count": 0, "sample.count": 1, "sample.time.usec": 452552, "total.action.count": 0, "total.error.count": 6, "total.exclude.count": 0, "total.metric.count": 5688 } }, { "type": "SNAPSHOT", "name": "Self", "properties": { "elapsed.usec": 10442872, "id.count": 0, "level": "INFO", "pid": 13388, "snap.count": 637, "tid": 1 } }, { "type": "SNAPSHOT", "name": "java.lang:name=Code Cache,type=MemoryPool", "properties": { "CollectionUsage": null, "CollectionUsageThreshold": "<unsupported>", "CollectionUsageThresholdCount": "<unsupported>", "CollectionUsageThresholdExceeded": "<unsupported>", "CollectionUsageThresholdSupported": false, "MemoryManagerNames": "[CodeCacheManager]", "Name": "Code Cache", "ObjectName": "java.lang:type=MemoryPool,name=Code Cache", "PeakUsage.committed": 16384000, "PeakUsage.init": 2555904, "PeakUsage.max": 251658240, "PeakUsage.used": 16255488, "Type": "NON_HEAP", "UsageThreshold": 0, "UsageThresholdCount": 0, "UsageThresholdExceeded": false, "UsageThresholdSupported": true, "Usage.committed": 16384000, "Usage.init": 2555904, "Usage.max": 251658240, "Usage.used": 16062016, "Valid": true, "name": "Code Cache", "type": "MemoryPool" } }, { "type": "SNAPSHOT", "name": "java.lang:name=CodeCacheManager,type=MemoryManager", "properties": { "MemoryPoolNames": "[Code Cache]", "Name": "CodeCacheManager", "ObjectName": "java.lang:type=MemoryManager,name=CodeCacheManager", "Valid": true, "name": "CodeCacheManager", "type": "MemoryManager" } }, { "type": "SNAPSHOT", "name": "java.lang:name=Compressed Class Space,type=MemoryPool", "properties": { "CollectionUsage": null, "CollectionUsageThreshold": "<unsupported>", "CollectionUsageThresholdCount": "<unsupported>", "CollectionUsageThresholdExceeded": "<unsupported>", "CollectionUsageThresholdSupported": false, "MemoryManagerNames": ["Metaspace Manager"], "Name": "Compressed Class Space", "ObjectName": "java.lang:type=MemoryPool,name=Compressed Class Space", "PeakUsage.committed": 4325376, "PeakUsage.init": 0, "PeakUsage.max": 1073741824, "PeakUsage.used": 4108024, "Type": "NON_HEAP", "UsageThreshold": 0, "UsageThresholdCount": 0, "UsageThresholdExceeded": false, "UsageThresholdSupported": true, "Usage.committed": 4325376, "Usage.init": 0, "Usage.max": 1073741824, "Usage.used": 4108024, "Valid": true, "name": "Compressed Class Space", "type": "MemoryPool" } }, ... ] }
Entries are sorted by snapshot name and property key alphanumeric order.