Skip to main content
Version: 2.6.0

Armeria

Aperture Java Instrumentation Agent

All requests handled by an Armeria application can have Aperture SDK calls automatically added into them using Aperture Instrumentation Agent.

Armeria Decorators

Aperture Java SDK Armeria package contains Armeria decorators that automatically set traffic control points for decorated services:
    public static HttpService createHelloHTTPService() {
return new AbstractHttpService() {
@Override
protected HttpResponse doGet(ServiceRequestContext ctx, HttpRequest req) {
return HttpResponse.of("Hello, world!");
}
};
}

ApertureHTTPService decoratedService = createHelloHTTPService()
.decorate(ApertureHTTPService.newDecorator(apertureSDK, controlPointName));
serverBuilder.service("/somePath", decoratedService);

You can instruct the decorator to exclude specific paths from being monitored by the Aperture SDK. For example, you might want to exclude endpoints used for health checks. To achieve this, you can add the path(s) you want to ignore to the ignoredPaths field of the SDK, as shown in the following code:

ApertureSDK sdk = ApertureSDK.builder()
.setHost(...)
.setPort(...)
...
.addIgnoredPaths("/healthz,/metrics")
...
.build()

The paths should be specified as a comma-separated list. Note that the paths you specify must match exactly. However, you can change this behavior to treat the paths as regular expressions by setting the ignoredPathMatchRegex flag to true, like so:

  builder
.setIgnoredPathMatchRegex(true)

For more context on using Aperture Armeria Decorators to set control points, refer to the example app available in the repository.