Invoke document
Martini produces an invoke document whenever it detects a matching monitor rule
for a service invocation. This document contains the particulars of the service call.
It is first added to the invoke_monitor
database, and then indexed to the invoke_monitor
Solr core.
There are two types of invoke documents:
- endpoint invoke documents; and
- HTTP invoke documents.
The former is created for service calls triggered by endpoints; the latter for service calls triggered by APIs exposed through Martini.
Java bean properties
Internally, endpoint invoke documents are represented through
EndpointInvokeDocument
objects;
HTTP invoke documents by HttpInvokeDocument
objects.
Both types have properties in common, but also contain a unique set of properties each:
Name | Data type | Description |
---|---|---|
id |
String |
A unique, auto-generated identifier for the document. |
associatedTrackerId |
String |
The ID of the associated Tracker document, if it exists1. |
timeInvoked |
Long |
Time invoked in milliseconds from the epoch of 1970-01-01T00:00:00Z . |
packageName |
String |
The name of the package which handled the request. |
endpointName 2 |
String |
The name of the endpoint which invoked the service. |
endpointType 2 |
String |
The type of endpoint over which the service was invoked. If service is invoked via HTTP then the endpoint type is http . |
userAgent 3 |
String |
The user agent used when the service was invoked. |
userPlatform 3 |
String |
The platform used when the service was invoked. |
serviceName |
String |
The name of the service that was invoked. |
url 3 |
URL |
The invocation URL. |
user |
String |
The username of the user who invoked the service. |
userGroups |
Set<String> |
The name of the groups the caller (user) belongs to. |
success |
boolean |
Flag indicating whether the service was successfully executed or not. |
invokeCost |
BigDecimal |
The cost of invoking the service. |
responseTime |
long |
The duration of the service invocation in milliseconds. For HTTP-based calls, this will be the total time Martini took to respond to an HTTP request. For Martini endpoint-based calls, this will be the total time a service took to finish the invocation. |
remoteAddress 3 |
String |
The IP address where the HTTP invoke originated. |
responseCode 3 |
int |
The HTTP response code of the invocation. |
Developers wishing to programmatically log invoke documents can work with either of these objects in their service code.
Database columns
Martini maps InvokeDocument
object properties to the following SQL columns
when saving an invoke document to the invoke_monitor
database:
Mapped from | SQL column | SQL data type | SQL table for HTTP invocations | SQL table for endpoint invocations |
---|---|---|---|---|
id |
invoke_id |
VARCHAR(255) |
http_invoke_document |
endpoint_invoke_document |
associatedTrackerId |
associated_tracker_id |
VARCHAR(40) |
http_invoke_document |
endpoint_invoke_document |
timeInvoked |
time_invoked |
BIGINT |
http_invoke_document |
endpoint_invoke_document |
packageName |
package_name |
VARCHAR(255) |
http_invoke_document |
endpoint_invoke_document |
endpointName |
endpoint_name |
VARCHAR(255) |
N/A | endpoint_invoke_document |
endpointType |
endpoint_type |
VARCHAR(30) |
N/A | endpoint_invoke_document |
userAgent |
user_agent |
VARCHAR(255) |
http_invoke_document |
N/A |
userPlatform |
user_platform |
VARCHAR(255) |
http_invoke_document |
N/A |
serviceName |
service_name |
VARCHAR(1000) |
http_invoke_document |
endpoint_invoke_document |
url |
url |
VARCHAR(2048) |
http_invoke_document |
N/A |
user |
user_name |
VARCHAR(50) |
http_invoke_document |
endpoint_invoke_document |
userGroups |
userGroups |
VARCHAR(20) |
invoke_document_user_group |
invoke_document_user_group |
success |
success |
BOOLEAN |
http_invoke_document |
endpoint_invoke_document |
invokeCost |
cost |
NUMERIC |
http_invoke_document |
endpoint_invoke_document |
responseTime |
response_time |
BIGINT |
http_invoke_document |
endpoint_invoke_document |
remoteAddress |
remote_address |
VARCHAR(255) |
http_invoke_document |
N/A |
responseCode |
response_code |
INTEGER |
http_invoke_document |
N/A |
Document fields
When indexing an invoke document to the invoke_monitor
Solr core, Martini creates a SolrDocument
with the following fields mapped from the InvokeDocument
object:
Mapped from | Field name | Field type | Multi-value? |
---|---|---|---|
id |
id |
solr.StrField |
false |
associatedTrackerId |
trackerId |
solr.StrField |
false |
timeInvoked |
timeReceived |
solr.StrField |
false |
packageName |
packageName |
solr.StrField |
false |
serviceName |
serviceName |
solr.StrField |
false |
success |
success |
solr.BoolField |
false |
invokeCost |
cost |
solr.DoublePointField |
false |
user |
user |
solr.StrField |
false |
userGroup |
userGroup |
solr.StrField |
true |
endpointName |
endpointName |
solr.StrField |
false |
endpointType |
endpointType |
solr.StrField |
false |
url |
url |
solr.StrField |
false |
remoteAddress |
remoteAddress |
solr.StrField |
false |
remoteAddress 4 |
country |
solr.StrField |
false |
responseCode |
responseCode |
solr.IntPointField |
false |
userAgent |
userAgent |
solr.StrField |
false |
userPlatform |
userPlatform |
solr.StrField |
false |
responseTime |
responseTime |
solr.LongPointField |
false |
remoteAddress 4 |
location |
solr.SpatialRecursivePrefixTreeFieldType |
false |