Developing Custom Extensions for Satoris

Extending the Satoris metering engine via the Probes Open API

Satoris, now freely available for download, comes with numerous built-in metering extensions. Some extensions adapt the engine to limit metering to particular software execution characteristics such as a particular code path or an environment condition. Others extend the data collection capabilities as well as allowing simplified integration with other tools and technologies. But it’s also possible to develop custom extensions around some well-defined extension points in the Probes Open API, which is fully supported by Satoris.

Anatomy of a Satoris Metered Runtime

There are 5 ways to extend the metering engine using the Probes Open API.

  1. Instrumentation — instrumenting code blocks using the probe interface
  2. Implementation — replacing the engine via a service provider interface
  3. Interception — processing metering events with a custom interceptor
  4. Intelligence — employing custom measurement strategies to filter events
  5. Inclusion — introduce new resource meters to be metered by probes

Instrumentation

Manual instrumentation can be employed alongside agent-based dynamic bytecode instrumentation (BCI) to create and fire custom probes for a run of code within a large method or embedding additional context within a name.

Instrumentation.java

Implementation

The entire implementation of the Satoris metering engine can be replaced by implementing the service provider interface and setting a system property.

ProviderFactory.java

To install the alternative implementation:

https://gist.github.com/autoletics/9f863682a2bab7003e445ecef24daa32

Interception

The metering engine can be further extended by intercepting the lifecycle of all metered firing probes. Simply register a factory class name and have it return an interceptor when a thread, context, is first metered by the engine.

InterceptorFactory.java

To install a custom interceptor add the following to the Satoris config file.

https://gist.github.com/autoletics/1ac50c4fab26fed20529937d0c30de68

Intelligence

What we attend to and what we decide to ignore is very much part of our intelligence. The same applies to application performance monitoring tools. One or more custom strategies can be injected into the metering engine in deciding whether to meter (measure and collect) the firing of a specific named probe at some particular point in time in the software execution.

StrategyFactory.java

To install a custom strategy add the following to the Satoris config file.

https://gist.github.com/autoletics/5cfd7f4998d164a928fad42bdb435402

Inclusion

The metering engine comes with numerous built-in meters but it also provides an interface for registering custom resource meters — measures.

MeasureFactory.java

To install a custom measure add the following to the Satoris config file.

It’s also possible to include custom resource measures using event counters.

Counting.java

Learning More

For further information on extending or integrating Satoris please check out the Probes Open API project documentation and sources hosted on GitHub.

Also, consider joining the Slack channel. Need an invite? Send an email.

http://www.autoletics.com/tools/satoris