Skip to content

Toro Cloud Dev Center

API monitoring

Martini allows you to log service invocations from Martini endpoints and HTTP APIs1 through a feature called invoke monitor. This is done by configuring monitor rules in your instance, where you can define conditions for logging.

When a request is received or when an endpoint is triggered, Martini checks for any matching monitor rules. If it finds a match, it logs the service invocation by adding a record to the invoke_monitor database, and a document with identical fields to the invoke_monitor Solr core. Data is stored both in Solr and database; the former to allow for faster, finer-grained searches, and the latter to serve as the source of truth when performing reindexing in Solr.

Conditions for checking monitor rule matches

No checks will be done if there are no configured monitor rules. If multiple rules are applicable for the call, the rule with the highest priority will be chosen.

The invoke_monitor core is also registered through a package.xml file

Like custom Solr cores, the invoke_monitor core is registered through a package.xml file. It comes pre-configured, and belongs to the core package:

<?xml version="1.0"?>
<package name="core" context-path="" enabled="true" version="1.0.0-RC3" id="io.toro.martini" stateOnStartup="started">
        <!-- ... -->
        <solr-core enabled="true" name="invoke_monitor" />

We call entries in the invoke_monitor core invoke documents2. They contain fields that describe a service invocation. Obtained through queries, data in these documents can be used for monetizing API usage, data analytics, creating reports, and the like.

How is logging through the invoke monitor different from logging with Tracker

Tracker is ideal if you want to audit and debug transactions that have transpired within your server. Meanwhile, you should use the invoke monitor if you want to monetize invocations.

  1. Created through Gloop or Groovy

  2. Oftentimes, used synonymously to refer to entries in the database as well.