[ 
https://issues.apache.org/jira/browse/CASSANDRA-19269?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Sam Tunnicliffe updated CASSANDRA-19269:
----------------------------------------
    Reviewers: Alex Petrov, Sam Tunnicliffe, Sam Tunnicliffe  (was: Alex 
Petrov, Sam Tunnicliffe)
               Alex Petrov, Sam Tunnicliffe, Sam Tunnicliffe  (was: Alex 
Petrov, Sam Tunnicliffe)
       Status: Review In Progress  (was: Patch Available)

> NPE in MetaStrategy.java when collecting metrics
> ------------------------------------------------
>
>                 Key: CASSANDRA-19269
>                 URL: https://issues.apache.org/jira/browse/CASSANDRA-19269
>             Project: Cassandra
>          Issue Type: Bug
>          Components: Observability/Metrics
>            Reporter: Jon Haddad
>            Assignee: Marcus Eriksson
>            Priority: Normal
>             Fix For: 5.x
>
>         Attachments: ci_summary.html, result_details.tar.gz
>
>
> Now that the metrics exporter has been removed in CASSANDRA-18743, I thought 
> I'd take a stab at setting up a metrics collector through DropWizard.  I have 
> a POC of an agent that exposes a Prometheus endpoint using the Prometheus 
> simpleclient here: 
> https://github.com/rustyrazorblade/cassandra-prometheus-exporter
> There's build instructions in the README - it's just a simple agent on a 
> background thread.
> Unfortunately when trying to view the metrics, Cassandra throws an NPE 
> exception, stack trace is here:
> {code:java}
> WARN  [qtp104447770-28] 2024-01-12 14:26:50,102 ServletHandler.java:522 - 
> /metrics
> java.lang.NullPointerException: null
>       at 
> org.apache.cassandra.locator.MetaStrategy.getReplicationFactor(MetaStrategy.java:64)
>       at 
> org.apache.cassandra.metrics.KeyspaceMetrics.lambda$new$12(KeyspaceMetrics.java:224)
>       at 
> org.apache.cassandra.metrics.KeyspaceMetrics$1.getValue(KeyspaceMetrics.java:344)
>       at 
> org.apache.cassandra.metrics.KeyspaceMetrics$1.getValue(KeyspaceMetrics.java:338)
>       at 
> org.apache.cassandra.metrics.StorageMetrics.lambda$static$0(StorageMetrics.java:40)
>       at 
> org.apache.cassandra.metrics.StorageMetrics.lambda$createSummingGauge$2(StorageMetrics.java:55)
>       at 
> java.base/java.util.stream.ReferencePipeline$5$1.accept(ReferencePipeline.java:229)
>       at 
> com.google.common.collect.CollectSpliterators$1.lambda$forEachRemaining$1(CollectSpliterators.java:128)
>       at 
> java.base/java.util.Spliterators$ArraySpliterator.forEachRemaining(Spliterators.java:948)
>       at 
> com.google.common.collect.CollectSpliterators$1.forEachRemaining(CollectSpliterators.java:128)
>       at 
> java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:484)
>       at 
> java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:474)
>       at 
> java.base/java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:913)
>       at 
> java.base/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
>       at java.base/java.util.stream.LongPipeline.reduce(LongPipeline.java:474)
>       at java.base/java.util.stream.LongPipeline.sum(LongPipeline.java:432)
>       at 
> org.apache.cassandra.metrics.StorageMetrics.lambda$createSummingGauge$3(StorageMetrics.java:56)
>       at 
> io.prometheus.client.dropwizard.DropwizardExports.fromGauge(DropwizardExports.java:47)
>       at 
> io.prometheus.client.dropwizard.DropwizardExports.collect(DropwizardExports.java:133)
>       at io.prometheus.client.Collector.collect(Collector.java:45)
>       at 
> io.prometheus.client.CollectorRegistry$MetricFamilySamplesEnumeration.findNextElement(CollectorRegistry.java:204)
>       at 
> io.prometheus.client.CollectorRegistry$MetricFamilySamplesEnumeration.<init>(CollectorRegistry.java:162)
>       at 
> io.prometheus.client.CollectorRegistry.filteredMetricFamilySamples(CollectorRegistry.java:140)
>       at 
> io.prometheus.client.exporter.MetricsServlet.doGet(MetricsServlet.java:43)
>       at javax.servlet.http.HttpServlet.service(HttpServlet.java:735)
>       at javax.servlet.http.HttpServlet.service(HttpServlet.java:848)
>       at 
> org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:648)
>       at 
> org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:455)
>       at 
> org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1072)
>       at 
> org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:382)
>       at 
> org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1006)
>       at 
> org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:135)
>       at 
> org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:116)
>       at org.eclipse.jetty.server.Server.handle(Server.java:365)
>       at 
> org.eclipse.jetty.server.AbstractHttpConnection.handleRequest(AbstractHttpConnection.java:485)
>       at 
> org.eclipse.jetty.server.AbstractHttpConnection.headerComplete(AbstractHttpConnection.java:926)
>       at 
> org.eclipse.jetty.server.AbstractHttpConnection$RequestHandler.headerComplete(AbstractHttpConnection.java:988)
>       at org.eclipse.jetty.http.HttpParser.parseNext(HttpParser.java:635)
>       at org.eclipse.jetty.http.HttpParser.parseAvailable(HttpParser.java:235)
>       at 
> org.eclipse.jetty.server.AsyncHttpConnection.handle(AsyncHttpConnection.java:82)
>       at 
> org.eclipse.jetty.io.nio.SelectChannelEndPoint.handle(SelectChannelEndPoint.java:627)
>       at 
> org.eclipse.jetty.io.nio.SelectChannelEndPoint$1.run(SelectChannelEndPoint.java:51)
>       at 
> org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:608)
>       at 
> org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:543)
>       at java.base/java.lang.Thread.run(Thread.java:829)
> {code}
> Related [discussion 
> thread|https://lists.apache.org/thread/lppjlxrd91qn0r0dkz80r5y843jwl1qo].



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@cassandra.apache.org
For additional commands, e-mail: commits-h...@cassandra.apache.org

Reply via email to