Giter Club home page Giter Club logo

Comments (7)

RustedBones avatar RustedBones commented on May 20, 2024 1

Glad I could help :)

from akka-http-metrics.

RustedBones avatar RustedBones commented on May 20, 2024

Hi @gunjdesai

Thanks a lot for the detailed report. It's actually not your fault but mine.
I've actually introduced a regression in the the 1.1.0 release in recordMetrics:

recordMetrics has a default value for the implicit ExecutionContextExecutor set to null (as akka-http does on the route conversion). I forgot to override the null with a default value for the connection metrics. I Will create a bugfix release.

For now you can add this to your code:

  implicit val system: ActorSystem = ActorSystem()
  implicit val ec: ExecutionContextExecutor =  implicitly[Materializer].executionContext

This import the default materializer explicitly and should make your project run.

Sorry for the inconvenience.

from akka-http-metrics.

gunjdesai avatar gunjdesai commented on May 20, 2024

Thanks @RustedBones for looking into this so fast, adding the execution context executor does work for other routes, but still facing an issue while trying /metrics route.

Error during processing of request: 'java.lang.NullPointerException (No error message supplied)'. Completing with 500 Internal Server Error response. To change default exception handling behavior, provide a custom ExceptionHandler.
java.lang.NullPointerException
	at fr.davit.akka.http.metrics.prometheus.marshalling.PrometheusMarshallers.$anonfun$marshaller$1(PrometheusMarshallers.scala:36)
	at akka.http.scaladsl.marshalling.Marshaller$.$anonfun$opaque$2(Marshaller.scala:162)
	at akka.http.scaladsl.marshalling.Marshalling$Opaque.$anonfun$map$7(Marshaller.scala:215)
	at akka.http.scaladsl.marshalling.Marshal.$anonfun$toResponseFor$1(Marshal.scala:71)
	at akka.http.scaladsl.util.FastFuture$.$anonfun$map$1(FastFuture.scala:23)
	at akka.http.scaladsl.util.FastFuture$.strictTransform$1(FastFuture.scala:41)
	at akka.http.scaladsl.util.FastFuture$.transformWith$extension1(FastFuture.scala:45)
	at akka.http.scaladsl.util.FastFuture$.map$extension(FastFuture.scala:23)
	at akka.http.scaladsl.marshalling.Marshal.toResponseFor(Marshal.scala:55)
	at akka.http.scaladsl.marshalling.ToResponseMarshallable.apply(ToResponseMarshallable.scala:17)
	at akka.http.scaladsl.marshalling.ToResponseMarshallable.apply$(ToResponseMarshallable.scala:16)
	at akka.http.scaladsl.marshalling.ToResponseMarshallable$$anon$1.apply(ToResponseMarshallable.scala:22)
	at akka.http.scaladsl.server.RequestContextImpl.complete(RequestContextImpl.scala:42)
	at akka.http.scaladsl.server.directives.RouteDirectives.$anonfun$complete$1(RouteDirectives.scala:47)
	at akka.http.scaladsl.server.StandardRoute$$anon$1.apply(StandardRoute.scala:19)
	at akka.http.scaladsl.server.StandardRoute$$anon$1.apply(StandardRoute.scala:19)
	at akka.http.scaladsl.server.directives.BasicDirectives.$anonfun$mapRouteResult$2(BasicDirectives.scala:68)
	at akka.http.scaladsl.server.directives.BasicDirectives.$anonfun$textract$2(BasicDirectives.scala:161)
	at akka.http.scaladsl.server.directives.BasicDirectives.$anonfun$mapRequestContext$2(BasicDirectives.scala:45)
	at akka.http.scaladsl.server.directives.BasicDirectives.$anonfun$textract$2(BasicDirectives.scala:161)
	at akka.http.scaladsl.server.RouteConcatenation$RouteWithConcatenation.$anonfun$$tilde$2(RouteConcatenation.scala:47)
	at akka.http.scaladsl.util.FastFuture$.strictTransform$1(FastFuture.scala:41)
	at akka.http.scaladsl.util.FastFuture$.transformWith$extension1(FastFuture.scala:45)
	at akka.http.scaladsl.util.FastFuture$.flatMap$extension(FastFuture.scala:26)
	at akka.http.scaladsl.server.RouteConcatenation$RouteWithConcatenation.$anonfun$$tilde$1(RouteConcatenation.scala:44)
	at akka.http.scaladsl.server.directives.BasicDirectives.$anonfun$mapRouteResultWith$2(BasicDirectives.scala:74)
	at akka.http.scaladsl.server.directives.BasicDirectives.$anonfun$textract$2(BasicDirectives.scala:161)
	at akka.http.scaladsl.server.directives.ExecutionDirectives.$anonfun$handleExceptions$2(ExecutionDirectives.scala:32)
	at akka.http.scaladsl.server.directives.BasicDirectives.$anonfun$textract$2(BasicDirectives.scala:161)
	at akka.http.scaladsl.server.Route$.$anonfun$asyncHandler$1(Route.scala:86)
	at fr.davit.akka.http.metrics.core.scaladsl.server.HttpMetricsRoute.$anonfun$recordMetricsAsync$3(HttpMetricsRoute.scala:90)
	at akka.stream.impl.fusing.MapAsyncUnordered$$anon$31.onPush(Ops.scala:1401)
	at akka.stream.impl.fusing.GraphInterpreter.processPush(GraphInterpreter.scala:541)
	at akka.stream.impl.fusing.GraphInterpreter.execute(GraphInterpreter.scala:423)
	at akka.stream.impl.fusing.GraphInterpreterShell.runBatch(ActorGraphInterpreter.scala:624)
	at akka.stream.impl.fusing.GraphInterpreterShell$AsyncInput.execute(ActorGraphInterpreter.scala:501)
	at akka.stream.impl.fusing.GraphInterpreterShell.processEvent(ActorGraphInterpreter.scala:599)
	at akka.stream.impl.fusing.ActorGraphInterpreter.akka$stream$impl$fusing$ActorGraphInterpreter$$processEvent(ActorGraphInterpreter.scala:768)
	at akka.stream.impl.fusing.ActorGraphInterpreter$$anonfun$receive$1.applyOrElse(ActorGraphInterpreter.scala:783)
	at akka.actor.Actor.aroundReceive(Actor.scala:534)
	at akka.actor.Actor.aroundReceive$(Actor.scala:532)
	at akka.stream.impl.fusing.ActorGraphInterpreter.aroundReceive(ActorGraphInterpreter.scala:690)
	at akka.actor.ActorCell.receiveMessage(ActorCell.scala:573)
	at akka.actor.ActorCell.invoke(ActorCell.scala:543)
	at akka.dispatch.Mailbox.processMailbox(Mailbox.scala:269)
	at akka.dispatch.Mailbox.run(Mailbox.scala:230)
	at akka.dispatch.Mailbox.exec(Mailbox.scala:242)
	at java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:289)
	at java.util.concurrent.ForkJoinPool$WorkQueue.runTask(ForkJoinPool.java:1056)
	at java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1692)
	at java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:157)

Any idea what i am missing here ?

from akka-http-metrics.

RustedBones avatar RustedBones commented on May 20, 2024

I tested the marshaling too yesterday, and it serialized the metrics properly.
Release 1.1.1 should be available now. Can you update and give it another try ?

from akka-http-metrics.

gunjdesai avatar gunjdesai commented on May 20, 2024

Tried 1.1.1, dont need the variable for ExecutionContextExecutor anymore, thank you so much for that update but still facing issue with the metrics api. I am assuming its because of the way, i have initialised it and not because of the library. Will try to debug
Below is the code FYR

import fr.davit.akka.http.metrics.core.scaladsl.server.HttpMetricsDirectives._
import fr.davit.akka.http.metrics.prometheus.marshalling.PrometheusMarshallers._
import com.api.server.Start.registry

object Metrics {

  val metricRoute = path("metrics") {

    get {

        metrics(registry)

    }

  }

  val routes = this.metricRoute

}

from akka-http-metrics.

RustedBones avatar RustedBones commented on May 20, 2024

looking at the stack trace, it seems the registry, or the underlying registry is null.
How is your the com.api.server.Start.registry initialized ?

from akka-http-metrics.

gunjdesai avatar gunjdesai commented on May 20, 2024

@RustedBones, extremely sorry, very basic miss, registry was imported from a variable initialised in try - catch block, hence was null.
Thank you so much for helping me out really appreciate it. Kudos !!

from akka-http-metrics.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.