instaclustr / cassandra-exporter

Java agent for exporting Cassandra metrics to Prometheus
Apache License 2.0
73 stars 46 forks source link

v0.9.12(agent) doesn't work with Cassandra 4.1.4 [java.lang.NoSuchMethodError] #118

Closed Subetov closed 5 months ago

Subetov commented 8 months ago
$ curl http://localhost:9500/metrics
curl: (18) transfer closed with outstanding read data remaining

WARN  [prometheus-netty-pool-0] 2024-04-01 12:42:23,377 DefaultChannelPipeline.java:1152 - An exceptionCaught() event was fired, and it reached at the tail of the pipeline. It usually means the last handler in the pipeline did not handle the exception.
java.lang.NoSuchMethodError: 'com.google.common.collect.ImmutableSet org.apache.cassandra.schema.Schema.getKeyspaces()'
    at com.zegelin.cassandra.exporter.InternalMetadataFactory.keyspaces(InternalMetadataFactory.java:64)
    at com.zegelin.cassandra.exporter.collector.StorageServiceMBeanMetricFamilyCollector.collect(StorageServiceMBeanMetricFamilyCollector.java:95)
    at com.zegelin.cassandra.exporter.collector.CachingCollector.lambda$new$1(CachingCollector.java:42)
    at com.google.common.base.Suppliers$ExpiringMemoizingSupplier.get(Suppliers.java:242)
    at com.zegelin.cassandra.exporter.collector.CachingCollector.collect(CachingCollector.java:77)
    at com.zegelin.cassandra.exporter.Harvester.lambda$collect$4(Harvester.java:239)
    at java.base/java.util.stream.ReferencePipeline$7$1.accept(Unknown Source)
    at java.base/java.util.concurrent.ConcurrentHashMap$EntrySpliterator.tryAdvance(Unknown Source)
    at java.base/java.util.stream.StreamSpliterators$WrappingSpliterator.lambda$initPartialTraversalState$0(Unknown Source)
    at java.base/java.util.stream.StreamSpliterators$AbstractWrappingSpliterator.fillBuffer(Unknown Source)
    at java.base/java.util.stream.StreamSpliterators$AbstractWrappingSpliterator.doAdvance(Unknown Source)
    at java.base/java.util.stream.StreamSpliterators$WrappingSpliterator.tryAdvance(Unknown Source)
    at java.base/java.util.Spliterators$1Adapter.hasNext(Unknown Source)
    at com.zegelin.prometheus.exposition.text.TextFormatExposition.nextSlice(TextFormatExposition.java:64)
    at com.zegelin.prometheus.exposition.FormattedByteChannel.read(FormattedByteChannel.java:24)
    at io.netty.handler.stream.ChunkedNioStream.readChunk(ChunkedNioStream.java:112)
    at io.netty.handler.stream.ChunkedNioStream.readChunk(ChunkedNioStream.java:31)
    at io.netty.handler.codec.http.HttpChunkedInput.readChunk(HttpChunkedInput.java:102)
    at io.netty.handler.codec.http.HttpChunkedInput.readChunk(HttpChunkedInput.java:43)
    at io.netty.handler.stream.ChunkedWriteHandler.doFlush(ChunkedWriteHandler.java:230)
    at io.netty.handler.stream.ChunkedWriteHandler.flush(ChunkedWriteHandler.java:132)
    at io.netty.channel.AbstractChannelHandlerContext.invokeFlush0(AbstractChannelHandlerContext.java:750)
    at io.netty.channel.AbstractChannelHandlerContext.invokeWriteAndFlush(AbstractChannelHandlerContext.java:765)
    at io.netty.channel.AbstractChannelHandlerContext.write(AbstractChannelHandlerContext.java:790)
    at io.netty.channel.AbstractChannelHandlerContext.writeAndFlush(AbstractChannelHandlerContext.java:758)
    at io.netty.channel.AbstractChannelHandlerContext.writeAndFlush(AbstractChannelHandlerContext.java:808)
    at com.zegelin.cassandra.exporter.netty.HttpHandler.sendMetrics(HttpHandler.java:303)
    at com.zegelin.cassandra.exporter.netty.HttpHandler.channelRead0(HttpHandler.java:94)
    at com.zegelin.cassandra.exporter.netty.HttpHandler.channelRead0(HttpHandler.java:39)
    at io.netty.channel.SimpleChannelInboundHandler.channelRead(SimpleChannelInboundHandler.java:99)
    at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:379)
    at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:365)
    at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:357)
    at io.netty.handler.codec.MessageToMessageDecoder.channelRead(MessageToMessageDecoder.java:103)
    at io.netty.handler.codec.MessageToMessageCodec.channelRead(MessageToMessageCodec.java:111)
    at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:379)
    at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:365)
    at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:357)
    at io.netty.handler.codec.MessageToMessageDecoder.channelRead(MessageToMessageDecoder.java:103)
    at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:379)
    at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:365)
    at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:357)
    at io.netty.channel.CombinedChannelDuplexHandler$DelegatingChannelHandlerContext.fireChannelRead(CombinedChannelDuplexHandler.java:436)
    at io.netty.handler.codec.ByteToMessageDecoder.fireChannelRead(ByteToMessageDecoder.java:324)
    at io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:296)
    at io.netty.channel.CombinedChannelDuplexHandler.channelRead(CombinedChannelDuplexHandler.java:251)
    at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:379)
    at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:365)
    at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:357)
    at io.netty.channel.DefaultChannelPipeline$HeadContext.channelRead(DefaultChannelPipeline.java:1410)
    at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:379)
    at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:365)
    at io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:919)
    at io.netty.channel.nio.AbstractNioByteChannel$NioByteUnsafe.read(AbstractNioByteChannel.java:166)
    at io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:719)
    at io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:655)
    at io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:581)
    at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:493)
    at io.netty.util.concurrent.SingleThreadEventExecutor$4.run(SingleThreadEventExecutor.java:989)
    at io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74)
    at java.base/java.lang.Thread.run(Unknown Source)
egrishina commented 7 months ago

Hi, @Subetov

I have the same issue. Did you find any workaround?

UPD: I found out that the return type of the method org.apache.cassandra.schema.Schema.getKeyspaces() has been changed.

smiklosovic commented 5 months ago

all what was needed was to recompile the project with Cassandra 4.1.4. No code change was necessary.

This is fixed for 4.1.4 in version 0.9.14 of the exporter (released).