Skip to content

Home

Development

IDEs

API Explorer

Releases

Release notes

Martini Runtime

Martini Desktop

Martini Online

Feature requests

Bug reports

Logging data to the invoke monitor

In order to log service invokes to the invoke_monitor database and Solr core, you must configure monitor rules in your instance. Once you have rules setup, incoming service invokes are logged, provided that they match with any of your rules.

Log all service invokes

To log all service invocations, set the application property monitor.always to true.

Invoke document discrepancies

There will be slight variations amongst invoke documents, depending on how a service is invoked. The invoke document of a service called by a Martini endpoint and the invoke document of a service called via an HTTP request differ by a small subset of unique fields each. In this section, we will take a look at these discrepancies.

To give you get a head start, here are snippets from a Solr search response that will let you compare the contents of each invoke document:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
{
    "id": "4413e83d-57e2-42a4-ae02-80d5112096cc",
    "trackerId": "592aaf8a-b361-11e9-a858-6d21b07394e2",
    "timeReceived": "2019-07-31T07:03:50.071Z",
    "responseTime": 20,
    "packageName": "examples",
    "serviceName": "groovy:apis.HelloYou/public io.toro.martini.core.api.APIResponse apis.HelloYou.sayHello()",
    "success": true,
    "cost": 500,
    "user": "ExampleUser",
    "userGroups": [ "group1", "group2" ],
    "endpointType": "http",
    "url": "http://localhost:8080/api/you/hello",
    "responseCode": 200,
    "userAgent": "Internet Explorer",
    "userPlatform": "Mac OS X",
    "remoteAddress": "0:0:0:0:0:0:0:1",
    "_version_": 1640556532972126208
}
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
{
    "id": "113e293d-064a-4513-808e-b2849977d002",
    "trackerId": "920eb369-b360-11e9-a858-6d21b07394e2",
    "timeReceived": "2019-07-31T06:58:16.021Z",
    "responseTime": 9,
    "packageName": "examples",
    "serviceName": "gloop:apis.service.HelloYouService/apis.service.HelloYouService",
    "success": true,
    "cost": 500,
    "user": "ExampleUser",
    "userGroups": [ "group1", "group2" ],
    "endpointType": "http",
    "url": "http://localhost:8080/api/sample/hello/you",
    "responseCode": 200,
    "userAgent": "Internet Explorer",
    "userPlatform": "Mac OS X",
    "remoteAddress": "0:0:0:0:0:0:0:1",
    "_version_": 1640556182676439040
}
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
{
    "id": "e22ea1d2-d11a-40d8-bc96-9e00ae1ee668",
    "trackerId": "663a9ba8-b360-11e9-a858-6d21b07394e2",
    "timeReceived": "2019-07-31T06:57:02.495Z",
    "responseTime": 66,
    "packageName": "examples",
    "serviceName": "gloop:apis.service.HelloYouService/apis.service.HelloYouService",
    "success": true,
    "cost": 500,
    "user": "ExampleUser",
    "userGroups": [ "group1", "group2" ],
    "endpointType": "http",
    "url": "http://localhost:8080/api/hello/you",
    "responseCode": 200,
    "userAgent": "Internet Explorer",
    "userPlatform": "Mac OS X",
    "remoteAddress": "0:0:0:0:0:0:0:1",
    "_version_": 1640556105678454784
}
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
{
    "id": "f1d0dc0c-6d46-4be8-956e-879002c592bf",
    "trackerId": "d464a787-0539-45fb-b3db-b4adfbc14fba",
    "timeReceived": "2019-07-31T06:56:05.386Z",
    "responseTime": 13,
    "packageName": "examples",
    "serviceName": "gloop:apis.service.HelloYouService/apis.service.HelloYouService",
    "success": true,
    "cost": 500,
    "user": "ExampleUser",
    "userGroups": [ "group1", "group2" ],
    "endpointName": "SchedulerEndpoint",
    "endpointType": "scheduler",
    "_version_": 1640556045704101888
}
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
{
    "id": "87067110-7309-4ee8-8948-f1c92e26aff3",
    "trackerId": "d464a787-0539-45fb-b3db-b4adfbc14fbb",
    "timeReceived": "2019-07-31T07:10:23.057Z",
    "responseTime": 27,
    "packageName": "examples",
    "serviceName": "groovy:apis.HelloYou/public io.toro.martini.core.api.APIResponse apis.HelloYou.sayHello()",
    "success": true,
    "cost": 500,
    "user": "ExampleUser",
    "userGroups": [ "group1", "group2" ],
    "endpointType": "http",
    "url": "http://localhost:8080/invoke/examples/groovy/apis.HelloYou/public%20io.toro.martini.core.api.APIResponse%20apis.HelloYou.sayHello()",
    "responseCode": 200,
    "userAgent": "Internet Explorer",
    "userPlatform": "Mac OS X",
    "remoteAddress": "0:0:0:0:0:0:0:1",
    "_version_": 1640556945036279808
}

trackerId

  • trackerId only gets set when the service is configured to log calls to Tracker.

endpointName

  • This property is only present in services triggered by Martini endpoints.
  • endpointName will be set to the name of the Martini endpoint which called the service.

endpointType

  • If the call was triggered by an HTTP request, endpointType will have the value of http.
  • If the call was from a Martini endpoint instead, endpointType will be set to the type of Martini endpoint (e.g. scheduler, email, ftp-server) that triggered the service invoke.

serviceName

  • For Groovy services invoked through a RESTful HTTP request1 or the service invoker, serviceName will be set to the name of the method that handled the call in the format:

    1
    groovy:<fully qualified class name>/<method signature>
    
  • For Gloop services invoked through a Gloop API endpoint, ad hoc Gloop service endpoint, or the service invoker, serviceName would be the namespace of the service that was invoked. The namespace will be in the format:

    1
    gloop:<fully qualified service name>/<fully qualified service name>
    
  • For Martini endpoints, serviceName will be the namespace of the service invoked.

url

  • Only set if the service was called via an HTTP request.
  • url's value will be the URL mapped to the invoked service.

remoteAddress

  • Only set if the service was called via an HTTP request.
  • The IP address of the service caller.

country

location

responseCode

  • Only set if the service call was triggered by an HTTP request.

userAgent

  • Only set if the service call was triggered by an HTTP request.
  • If the user agent can't be identified, it will use the value of the User-Agent request header.

userPlatform

  • Only set if the service call was triggered by an HTTP request.
  • Value derived from the User-Agent request header.
  • Not set if Martini is unable to identify the platform used.

  1. Exposed through Spring annotations