APM plugins are used by the autoscaler to interact with an external APM system, returning metrics that are used by the autoscaler to inform scaling actions.
For a real-world example of a Nomad APM plugin implementation, see the
»Authoring APM Plugins
Authoring an APM plugin in Go can be accomplished by implementing the
apm.APM interface, alongside a
main package to launch the plugin.
no-op APM plugin can be used as a starting point for new APM
»APM Plugin API
The base plugin interface must be implemented in addition to the following functions.
Query(query string, timeRange sdk.TimeRange) (sdk.TimestampedMetrics, error)
Query function is called by the agent during policy
query argument is the opaque string from the scaling policy,
timeRange indicates the period of time over which the query should be
made. The response is a series of timestamped metrics; as such, the query semantics
should be such that the backing APM will return a time series. An example is the
CPU utilization of a task group, averaged over all current allocations.
QueryMultiple(query string, timeRange sdk.TimeRange) (sdk.TimestampedMetrics, error)
QueryMultiple method is similar to
Query, except that the interface allows
multiple time series to be returned. This endpoint is currently only used for
Dynamic Application Sizing.
An example would be to return the CPU utilization for all allocations during
the time range.