Search code examples
javaamazon-web-servicesvert.xaws-xray

How to add a Servlet filter in Vert.x REST API?


I have a REST API which was created purely using Vert.x, I would like to instrument it for AWS X-RAY and in order to do that I need to add a servlet filter. I'm creating a webserver like this:

vertx.createHttpServer()
      .requestHandler(r -> r.response().end("Welcome to Vert.x Intro");
      })
      .listen(config().getInteger("http.port", 9090), 
        result -> {
          if (result.succeeded()) {
              future.complete();
          } else {
              future.fail(result.cause());
          }
      });

In the documentation for AWS X-RAY they've only mentioned Tomcat (https://docs.aws.amazon.com/xray/latest/devguide/xray-sdk-java-filters.html). Would adding filters using web.xml work for this as well or do I need to do something different?


Solution

  • I think AWS X-Ray will not work with vert.x - I found no mention of them being used together.

    I would probably try to apply spring example from their site but according to these answers it might be in vain. It seems vert.x architecture is not compatible with X-Ray.