LogoLogo
  • User Guide
    • Getting Started
      • Building a Usage-Based Product in Revenium
      • Setting Up & Using API Analytics & Observability
      • Setting Up & Using Product Analytics
      • Sending Data to Revenium's Metering API
      • Key Concepts & Relationships
    • Connect Your Data
      • cURL Commands for Testing
      • Container-Native Metering
      • Kong
        • Kubernetes Installation
      • Salesforce
        • Revenium Unmanaged Package
          • Anypoint API Experience Hub (AEH)
            • Anypoint API Experience Hub Unmanaged Package Post Installation Instructions
          • Anypoint Community Manager (ACM)
            • Anypoint Community Manager Package Post Installation Instructions
        • Revenium Lightning Web Components
          • Add Components to Experience Cloud site
          • Drop-In Storefront
          • Product Card
          • Product Card (Anypoint)
          • Product Checkout
          • Product Details Button
          • Usage History
          • API Access Requester
      • MuleSoft
        • Metering Policy Configuration
        • Offline Metering Policy Configuration
        • Anypoint API & API Group Synchronization
        • Revenium Connector
        • Disable Default Anypoint Community Manager (ACM) Email Notifications
      • Gravitee
      • Istio
      • Envoy
      • AWS API Gateway
      • Python & Django
      • Golang
      • Spring Boot
      • .Net
      • NodeJs
      • Java/JVM
      • Snowflake
      • Azure API Management
      • IBM
      • Custom Integrations Using Metering Beacons
        • JWT Enrichment
      • Offline Metering via Log Parsing
    • Sources
      • Metering Elements
      • Alerts
        • Alert History
    • API Keys
    • Products & Pricing
      • Product Lines
      • Pricing Rules
        • Revenium Scripting Language
          • RSL Reference
        • Execution Logs
      • SLA Definitions
      • SLA Violation Review
    • Customers
      • Customers
      • Subscribers
      • Subscriptions
      • Subscribers Credentials
      • Subscribers Notifications
    • Billing and Invoicing
      • Manage Refunds
    • Analytics
      • Revenue Analytics
      • Product Analytics
        • Custom Reports (Products)
      • Subscriber Analytics
        • New Subscribers
        • (Daily/Weekly/Monthly) Active Subscribers
        • Most Engaged Subscribers & Customers
        • Historical Usage
      • API Analytics
        • Performance & Availability
        • Compare Periods
        • Traffic by Geography
        • Advanced Search
        • Custom Reports
    • Profile
      • Profile
      • Revenium API Documentation
    • Settings
      • Revenium Users & Organizations
        • Access Permissions by User Type
      • Revenium Subscription
      • Revenium Organizations
      • Notification Templates
      • Transactions Logs
        • Analytics Transaction Log
        • Product Transaction Log
        • Subscription Audit Log
        • No Code Transaction Testing
      • Integrations
        • Data Sync
        • Export Configurations
        • Notification Providers
        • Payment Configurations
          • Customer VAT ID Support
        • ERP Configurations
        • External Integration Logs
        • Identity Providers
      • System Logs
      • Default Configuration Limits
Powered by GitBook

© Revenium - www.revenium.io

On this page
  • Installation in Linux
  • Installation Instructions (Debian)
  • Installation Instructions (APT)
  • Starting the Agent in Linux
  • Installing Native Metering in Docker
  • Docker Compose Stack for Metering Testing
  • Testing Metering
  1. User Guide
  2. Connect Your Data

Container-Native Metering

Revenium's container-native metering agent offers real-time, zero-latency monitoring and metering of API and microservice traffic across without requiring API gateways, sidecars or code modification

Last updated 7 months ago

With Revenium's container agent, API and microservice traffic can be monitored and metered on Linux bare metal, virtual machines and containers. This provides real-time, zero-latency visibility into API traffic across an enterprise without the need for API Gateways, sidecars, code modification or other invasive approaches.

For testing purposes, our container-based instructions are simple to implement, though for production use cases, we recommend a native installation on the host server to allow for all container traffic to be metered without individual modification. There are also security reasons for this recommendation which are explained in the section below.

Each of the installation options is outlined below.

Looking for a quick implementation & test? Revenium provides a Docker Compose stack that lets you experience Revenium's native metering solution in a self-contained environment that will send metering events to your Revenium account. The stack will create one container to send API traffic, one to receive traffic and a synthetic load generator. You can download the repository using the .

Installation in Linux

Installation Instructions (Debian)

Replace HTTP_PORT with the port your APIs are bound to and REVENIUM_API_KEY with your .

curl -sSL https://raw.githubusercontent.com/hypercurrentio/isotope-files/main/install_and_run  | sudo bash -s -- HTTP_PORT REVENIUM_API_KEY

Installation Instructions (APT)

Its also possible to install the agent manually using apt:

Step 1: Update and install necessary packages

apt-get update && apt-get install -y curl lsb-release

Step 2: Download the keyring for your package repository

curl -Lo /usr/share/keyrings/rm-dev-archive-keyring.gpg https://pkg.dev.hcapp.io/deb/rm-dev-archive-keyring.gpg

Step 3: Add the Revenium package repository to the sources list

printf "deb [signed-by=%s] %s/%s %s main\n" \
    "/usr/share/keyrings/rm-dev-archive-keyring.gpg" \
    "https://pkg.dev.hcapp.io/deb" \
    "$(lsb_release -is | tr A-Z a-z)" \
    "$(lsb_release -cs)" \
    > "/etc/apt/sources.list.d/rm-dev.list"

Step 4: Update and install the agent and its eBPF shim

apt-get update && apt-get install -y isotope isotope-ebpf-shim

RPM installation for RedHat derivatives is coming soon! Let us know if you need it right now.

Starting the Agent in Linux

The agent can be run from /usr/bin/isotope and accepts the following command line parameters.

Command Line Parameters:

 --api-key string
    	The Revenium Platform API key
  --correlation-header string
    	An optional HTTP header used to correlate API responses to requests.  If unset responses will be correlated to requests based on their arrival sequence
  --dequeuing-interval int
    	The interval in seconds to dequeue metering events (default is 5 seconds) (default 5)
  --interfaces string
    	Comma-separated list of network interfaces to listen for API traffic on
  --max-concurrency int
    	The amount of API events to process in parallel (default 10)
  --metering-header string
    	The HTTP header that identifies the API Subscriber (default "clientId")
        Note that this is a critical header to define to maximize your analytics value
  --platform-api-url string
    	The Revenium Platform API URL (default "https://api.revenium.io")
  --port-mappings string
    	Comma-separated list of mapped -> destination ports (ie: 9091:8080,9443:8443)
  --ports string
    	Comma-separated list of ports to listen for API traffic on (default "80")
  --pprof
    	capture runtime profiling data (debug use only)
  --statistics-interval int
    	The interval in seconds to log runtime statistics (if 0 statistic logging is disabled)

The agent supports binding to the Docker interface (ie, "docker0") to meter intra-container API traffic

The following shows the agent listening on ports 8080 and 8443 on the "eth0" and "docker0" interfaces and emitting statistics to stdout every 5 seconds. Additionally, it defines a port mapping that will decode requests on port 9091 to port 8080 so that external traffic arriving on port 9091 mapped to port 8080 can be captured. Lastly, it defines the header (clientName) that will send the client identifier to Revenium so that you can easily identify API traffic by Subscriber.

/usr/bin/isotope --ports 8080,8443 --interfaces eth0,docker0 --port-mappings 9091:8080 --api-key REVENIUM_API_KEY --statistics-interval 5 --metering-header clientName

Installing Native Metering in Docker

An entrypoint script can be used to integrate the Revenium agent into an API's Docker image. Download the entrypoint script template into the directory with your Dockerfile using the command below.

curl https://raw.githubusercontent.com/hypercurrentio/revenium-isotope-sandbox/main/entrypoint > entrypoint

Next modify the entrypoint script with the HTTP port your API is listening on and your Revenium API Key and save the entrypoint file in the directory with your Dockerfile and docker-compose.yml file.

#!/bin/sh
curl -sSL https://raw.githubusercontent.com/hypercurrentio/isotope-files/main/install_and_run \
| sh -s -- HTTP_PORT REVENIUM_API_KEY
exec "$@"
#!/bin/sh
curl -sSL https://raw.githubusercontent.com/hypercurrentio/isotope-files/main/install_and_run \
| sh -s -- HTTP_PORT REVENIUM_API_KEY --ports 8080,9090 --correlation-header x-revenium-correlation-id -metering-header clientName
exec "$@" 

In the absence of a correlation header, the agent correlates HTTP requests with responses using TCP arrival sequence and source/destination ports.

Next, add the entrypoint to your Dockerfile. An example Dockerfile is shown below with lines 14 & 15 added to show what you will need to insert this into your own environment.

FROM python:3.8-slim AS rm-isotope-sandbox

ARG DEBIAN_FRONTEND=noninteractive
ARG APT_LISTCHANGES_FRONTEND=none
RUN apt-get -qq update\
 && apt-get -qq install\
 curl\
 lsb-release\
 && apt-get -qq clean

COPY --link app/ /usr/src/app/

# COPY AND INSTALL THE ENTRYPOINT FILE DOWNLOADED ABOVE
COPY --link --chmod=755 ./entrypoint /entrypoint
ENTRYPOINT ["/entrypoint"]

WORKDIR /usr/src/app
RUN pip install --no-cache-dir -r requirements.txt

EXPOSE 8080
ENV NAME EchoAPI

# Run app.py when the container launches
CMD ["python", "./app.py"]

Once you have inserted the lines above into your Dockerfile, proceed to build and run the docker images as you normally would with commands like docker build and docker run/ docker-compose up.

Once launched, the agent will be running in the background and logging to /var/log/isotope.log

Docker Compose Stack for Metering Testing

Testing Metering

To observe transactions being recorded in Revenium navigate to Transactions -> Analytics Transaction Logs.

You will also see analytics data from your transactions presented under the "API Analytics" section of the left navigation menu.

can also be appended to the entrypoint script. In the example immediately below we are configuring the agent to listen for HTTP API traffic on ports 8080 and 9090 and also specifying the correlation header we'll use to map API requests to responses. Lastly, it defines the header (clientName) that will send the client identifier to Revenium so that you can easily identify API traffic by Subscriber.

Docker containers running eBPF programs usually require running the program in "privileged" mode and mounting the host's BPF filesystem (/sys/fs/bpf). Production deployments should run the agent on the container host (using the ) in order to monitor API traffic across all containers without requiring privileged access.

If you prefer to test in a sample docker environment before implementing this agent into your own application, you can easily do so using our on GitHub. The stack will create one container to send API traffic, one to receive traffic and a synthetic load generator, all of which are connected to your own Revenium account (linked by providing your in the configuration).

metering sandbox repository
API key
Revenium API Key
Docker Installation
instructions below
Command line parameters
instructions above