Skip to content

Toro Cloud Dev Center

Tracker search index

In Martini, you can log data consumed and produced by your applications via a feature called Tracker. Tracker is a term used to refer to the family of services and resources wired together to record service invocation data. By logging data coming in and out of Martini, you are granted access to these data again so you could use them when performing audits, analysis, troubleshooting, and when generating reports.

Tracker is a fully searchable, queryable logging engine that's great for looking up the data that your code has dealt with in the past.

Possible use cases

Suppose you have exposed a REST API in Martini, for your e-commerce web site. Every time a customer orders something on the website, it contacts Martini behind the scenes to have the order created in your warehouse. By indexing order data, you can easily create reports about the:

  • Average orders received in the previous months
  • Orders received per day over the last month
  • Orders received which costs greater than $50 in the last week
  • Orders the contained certain products
  • Orders shipped to a certain postal state
  • Orders that have resulted in an error
  • Best-selling products in the previous month, or year

You can also do other integrations that compute:

  • How often your partners invoke Martini services
  • How often your suppliers send their data for your systems
  • The number of products published over the Google Marketplace
  • How many new customers have signed up to receive your newsletter in the previous month
  • The average value of all invoices, graphed per day for the last month

Internal system design

Under the hood, Tracker is backed by a Solr core of the same name (tracker)1 linked to your instance's core package. When a service invocation is triggered by an endpoint or HTTP call, Tracker will log the details of the service invocation by adding an entry to the tracker database2. It will then create a Lucene document for that entry and index it to the aforementioned Solr core's index, which we call the Tracker search index. Querying data against the index instead of the database allows for faster, finer-grained searches.

Tracking is on by default

Martini automatically adds a record to tracker every time code is invoked over HTTP/S or via endpoints, unless configured to not do so.

Tracker versus the invoke monitor

Although both Tracker and the invoke monitor log service invocation data, their purposes differ. Tracker is ideal for debugging and auditing transactions. In Tracker, you can see the entire payload that went in, got processed, and went out. Meanwhile, the invoke monitor is used to monetize and throttle service invokes.

  1. Out-of-the-box, the tracker Solr core resides in an embedded Solr instance and should be migrated to a remote Solr server instead for performance boost. 

  2. Martini, by default, uses an embeded HSQL database for tracker. It is recommended that you migrate your data there in a more reliable database when running on production.