Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Akka-http page is missing in Wiki #87

Open
relgames opened this issue Oct 27, 2016 · 6 comments
Open

Akka-http page is missing in Wiki #87

relgames opened this issue Oct 27, 2016 · 6 comments

Comments

@relgames
Copy link

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.

@levkhomich
Copy link
Owner

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.

@relgames
Copy link
Author

relgames commented Nov 9, 2016

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

@raam86
Copy link

raam86 commented Dec 19, 2016

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)

@tonypizzicato
Copy link

@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

@raam86
Copy link

raam86 commented Jan 3, 2017

@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]

@rojanu
Copy link

rojanu commented Aug 21, 2017

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 ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants