Custom Integrations Using Metering Beacons
This guide documents how to write custom integrations to Revenium Metering Beacons.
Before investigating a custom integration, we recommend you review our Linux & container-native metering solution here, which works in a variety of environments and is configurable with only a few lines of additional code.
Introduction
Revenium Metering Beacons act as bulkheads or “shock absorbers” to collect API transaction telemetry. The telemetry data is buffered in the Metering Beacon’s cache and periodically synchronized to the Revenium Transaction Engine.
Under normal circumstances you should not need to implement custom integrations to the Metering Beacons. Revenium offers out-of-the-box connectivity to most common API Gateways and API platforms, including MuleSoft, Kong, Apigee, Istio, Envoy, Spring Boot and others.
The Revenium Metering Beacon presents a very simple REST API that allows downstream applications, such as API gateway plugins or agents, to send API transaction telemetry via an HTTP POST operation with a JSON payload.
In addition to the REST API Revenium also provides a pre-packaged JVM SDK to simplify integration with JVM based applications (Java, Scala, Clojure, Kotlin, etc.)
The Revenium Metering SDK can be obtained from your Revenium Account Team.
Using the Metering Beacon API
The full Metering Beacon API documentation is located here: https://revenium.readme.io/reference/meter
Metering Beacon Data Types
The Metering Beacon API uses the following JSON data types
MeteringRequestDTO
MeteringRequestDTO represents the result of a metered HTTP API transaction. MeteringRequestDTOs are created after the response has been received from a metered API. Use MeteringRequestDTO when you need to meter an API transaction after it has completed. This is used to synchronously meter an API transaction.
ApiEventDTO
ApiEventDTO represents either the request or response of an HTTP API transaction of a metered API request. ApiEventDTOs are created when the HTTP request is received and when the API response has been completed. This is used to asynchronously meter an API transaction.
Metering Beacon Endpoints
The Revenium Beacon API exposes the following endpoints:
Revenium uses the /metering/v1/api/meter endpoint to implement metering policies / plugins for traditional API Gateway implementations such as MuleSoft, Kong and Apigee. We use the /metering/v1/api/event to implement metering policies / plugins for cloud API Gateway implementations like AWS and Azure which rely on serverless functionality.
Examples
CURL
The detailed example on this page shows how to use CURL to send metering requests via the command line.
Kotlin
This example demonstrates a metering request sent via Kotlin using the Revenium JVM SDK.
Lua
This example demonstrates a metering request sent via Lua using the REST API.
Last updated