A precompiled bundle for tracking/monitoring your favourite API-Paths/Resources.
There are 2 features here:
@ClientRestriction
@TrackPath
Cloning source code:
git clone github.com/Tushar-Naik/dropwizard-hystrix-tracker.git
Building code
mvn install
<repository>
<id>clojars</id>
<name>Clojars repository</name>
<url>https://clojars.org/repo</url>
</repository>
<dependency>
<groupId>io.dropwizard.tracker</groupId>
<artifactId>dropwizard-hystrix-path-tracker</artifactId>
<version>1.3.12-1</version>
</dependency>
<dependency>
<groupId>io.dropwizard.tracker</groupId>
<artifactId>dropwizard-client-filter</artifactId>
<version>1.3.12-1</version>
</dependency>
Use this to track a particular API endpoint.
Hystrix metrics will be emitted based on the name of the API.
@Override
public void initialize(final Bootstrap...) {
bootstrap.addBundle(new TrackerBundle());
}
@Path("/service/v1")
@Slf4j
public class MyResource{
@Path("/api1")
@GET
@Produces(MediaType.APPLICATION_JSON)
@TrackPath("/service/*")
public Response getResponse() {
...
}
...
}
Depending on the ClientFilterConfig
provided,
if a Resource Path is marked with the annotation
@ClientRestriction
,
API will return a STATUS:403 FORBIDDEN if header in the incoming Request is not present,
or does not match the ones present in ClientFilterConfig.validClients
@Override
public void initialize(final Bootstrap<XYZConfiguration> bootstrap) {
bootstrap.addBundle(new ClientFilterBundle<XYZConfiguration>() {
@Override
public ClientFilterConfig getClientFilterConfig(XYZConfiguration xYZConfiguration) {
return xYZConfiguration.getClientFilterConfig();
}
});
}
@Path("/service/v1")
@Slf4j
public class MyResource{
@Path("/api/{path}/search")
@GET
@Produces(MediaType.APPLICATION_JSON)
@ClientRestriction
public Response getResponse() {
...
}
...
}
Can you improve this documentation?Edit on GitHub
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close