akka-tracing icon indicating copy to clipboard operation
akka-tracing copied to clipboard

Akka-http page is missing in Wiki

Open relgames opened this issue 8 years ago • 6 comments

https://github.com/levkhomich/akka-tracing/wiki There is no page for akka-http. So it is not clear how to trace requests with akka-http and Java.

relgames avatar Oct 27 '16 11:10 relgames

Nice catch, thank you. I will take care of it.

Generally speaking, it should be used in the same way as Spray tooling from Scala. I do not know anyone who is interested in using it from Java, so there is no support for it yet.

levkhomich avatar Nov 08 '16 22:11 levkhomich

I'm interested :) I use akka-http from Java.

relgames avatar Nov 09 '16 12:11 relgames

Would love a scala page for akka-http. I'm currently doing

class Routes(sys: ActorSystem) extends BaseTracingDirectives{
  
override def trace: TracingExtensionImpl = TracingExtension(sys)
  //Routes go here
}

I am not using actors explictly and bind like this:

val bindingFuture = Http().bindAndHandle(new Routes(system).routes, "0.0.0.0", 8080)

raam86 avatar Dec 19 '16 19:12 raam86

@raam86 can you provide complete usage example with routes definition and wiring it with tracing support? can't make it work with json requests as i must provide unmarshaller/marshaller for tracedHandleWith

tonypizzicato avatar Dec 31 '16 01:12 tonypizzicato

@tonypizzicato my route looks like this:

 val tracedPlaces = (am: ActorMaterializer) => path("tplace") {
      get {
        implicit val aq = am
        tracedHandleWith("place")(processPlace)
      }
  }

make sure you return the correct types from the handle with function. processPlace signature:

def processPlace(place: PlaceRequestParameters)(implicit am: ActorMaterializer): Future[JsObject]

raam86 avatar Jan 03 '17 14:01 raam86

I am stuck as well.
I have

get {
  import com.mdsol.strategicmonitoring.visits.model.views.ClientViewsJsonProtocol._
  path(uri / JavaUUID) { uuid =>
    tracedHandleWith(systemName) {
      extractUserUUID { userUuid =>
        logger.info(s"Get visit")
        complete(
          visitsService.findByUuid(userUuid, uuid).map {
            case visit@Some(_) =>
              logger.info(s"Visit retrieved")
              OK -> visit
            case _ => NotFound -> None
          }
        )
      }
    }
  }
}

for above route it requires an implicit FromRequestUnmarshaller. What is the idea? Do I need to provide a class with TracingSupport, e.g. TestMessage class in the tests, for all of my routes then try to unmarshall something like TestMessage for each request ?

rojanu avatar Aug 21 '17 08:08 rojanu