Skip to content

Home

Introduction

Development

IDEs

Services

Service manager

API Explorer

Logging data to Tracker

TORO Integrate exposes a small API that you can use to search and store data to the Tracker search index. Using the API, you can customize the way integrations look in the Tracker interface, as well as pick and choose which data will be indexed by Tracker for searching later.

Logging from Gloop

Tracker automatically logs HTTP requests

By default, all HTTP requests that map to a Gloop service are logged. To disable this, you can change the HTTP logging property.

To manually create or update Tracker documents in the Tracker search index, integration developers can use the services in TrackerMethods. The TrackerMethods class is located in the core package, under the services/io/toro/integrate code directory, as seen in the Coder Navigator view.

Coder showing the available methods in Gloop for Tracker

Coder showing the available methods in Gloop for Tracker

To update a Tracker document, you would need to have its internalId. A Gloop service invoked over HTTP and whose tracking is also enabled makes this property available via the presence of an input property called $internalId.

To disable the logging of data passing through Gloop services invoked over HTTP, you could add a io.toro.integrate.tracker.Trackable model input property and then set this model's trackingScope property to NONE.

Logging HTTP requests made by Gloop services

Logging HTTP requests that invoke the io.toro.integrate.HttpMethods.http(...) service is done by configuring the trackable input model. This model can be found in the Input side of the Mapper view when the invoke step is selected. This model also has a field called trackingScope which changes the scope of the tracking for the HTTP request.

HTTP invoke step showing the `trackable` input property

HTTP invoke step showing the `trackable` input property

Logging from Flux

Another way to monitor the behavior of Flux services is by using Tracker. The Flux engine adds a Tracker document when a Flux service is executed and a document state is added for each of the following scenarios:

  • Start of execution - where the document state contains the context of the Flux service in a JSON file.
  • Execution of a state - where the document state contains the context of the invoked state in a JSON file.
  • Occurrence of an exception - where the document contains the stacktrace of the exception from the {stateName}-error.log file.
  • End of execution

The properties of a Flux-produced Tracker document by default, are defined as follows:

Name Description
internalId By default, this is a random 40-digit hex value. It can be overridden by adding a string input named $fluxTrackerId in your Flux.
externalId The time in milliseconds when the execution started.
documentType The value is "FluxExecution" by default, but can be overridden by adding a string input named $fluxTrackerDocumentType in your Flux.
senderId The context ID of the Flux execution.
receiverId The value is set to "Flux".

Tracking can be disabled on a Flux execution by adding a boolean input property named $fluxTrackerEnabled to a Flux service and setting it to false. To globally disable Tracker for all Flux services, set the flux.tracker.enabled application property to false in TORO Integrate's application properties. This global property takes precedence over the $fluxTrackerEnabled input property.

A Flux service will not be logged to Tracker if it is debugged or invoked using Coder.

To manually index documents in Flux, you can also call services from TrackerMethods. To update an existing document, add an input property named $fluxTrackerId in your Flux to get ahold of the document's internalId.

Logging from Groovy

TORO Integrate has a custom annotation for tracking the data of Groovy services invoked via HTTP. To use this, annotate the service that you wanted to track with the @Track annotation. For example:

1
2
3
4
@Track
public String greeting(String name) {
    return "Hello, ${name}!"
}

Furthermore, the scope of the tracking can be customized to track the request only, the response only, both, or none at all. This can be done by setting the value property of the @Track annotation.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
@Track(TrackMethod.REQUEST) // This would track the request only
public String greeting(String name) {
    return "Hello, ${name}!"
}

@Track(TrackMethod.RESPONSE) // This would track the response only
public String greeting(String name) {
    return "Hello, ${name}!"
}

@Track(TrackMethod.NONE) // This tells Tracker to not track this service.
public String greeting(String name) {
    return "Hello, ${name}!"
}

Additionally, you can enable or disable tracking via the @Track annotation's enabled property.

1
2
3
4
@Track(enabled = false) // This tells Tracker to not track this service.
public String greeting(String name) {
    return "Hello, ${name}!"
}

Class-level annotation

It is possible to use the @Track annotation on a class. This means all the methods under the @Track-annotated class will follow the tracking scope defined by the annotation unless a method itself is annotated.

If TORO Integrate created a document for you and you need the internalId, simply add a String parameter to your method called internalId, and TORO Integrate will map it for you. For example:

1
2
3
4
5
6
@Track
public String greeting(String name, String internalId) {
    "The internal ID is ${internalId}".info()
    internalId.addDocumentProperty('name', name)
    return "Hello, ${name}!"
}

The TrackerMethods class contains many one-liners which you can use to add and update the Tracker search index.

Logging from Integrate endpoints

To log data processed by Integrate endpoints to Tracker, the Logging property of the Integrate endpoint you want to track must be checked in the Endpoint configuration editor. You will be able to set this property when creating or configuring an endpoint. Un-checking this property means data processed by the endpoint is left un-indexed.

Endpoint logging property

Endpoint logging property

Logging HTTP requests

TORO Integrate uses an application property that can be configured to enable and disable logging to Tracker for HTTP requests it receives. This property is called http.invoke.track.enable and it accepts a boolean value. The default value for this true and thus, all HTTP requests are being logged to Tracker by default. Setting its value to false disables logging HTTP data to Tracker instance-wide.

For this property to take effect, the file must be saved and the instance must be restarted.

Why should I disable logging data to Tracker?

While enabled by default, it is also possible to disable Tracker's logging of data. Typically, this would be done to:

Discrepancies

As with the case in Monitor, there are a few discrepancies among Tracker documents; depending on how the service is exposed. To show you these differences, the following examples below1 are provided:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
{
  "internalId": "fa30f599-6030-4ad5-836e-2a18926ee1a6",
  "externalId": "1534393691669",
  "type": {
    "id": "hello",
    "name": "hello"
  },
  "stateName": "Processed",
  "senderId": "0:0:0:0:0:0:0:1",
  "receiverId": "/api/hello/world",
  "username": "Anonymous",
  "timestamp": 1534393691629,
  "logs": [],
  "properties": [
    {
      "key": "Integrate_Server",
      "value": "TORO Integrate@TORO-MM64:8080 (fe80:0:0:0:42cd:e074:a3d4:4fdc%utun0)"
    },
    {
      "key": "Duration(ms)",
      "value": "29"
    }
  ],
  "states": [
    {
      "id": 1,
      "name": "Received",
      "timeReceived": 1534393691629,
      "canBeResubmitted": false,
      "contentFileName": "request.xml",
      "contentSize": 5347
    },
    {
      "id": 2,
      "name": "Processed",
      "timeReceived": 1534393691793,
      "canBeResubmitted": false,
      "contentFileName": "response.txt",
      "contentSize": 13
    }
  ]
}
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
{
  "internalId": "7ae04eee-d419-404d-ada6-da623e3e9ed5",
  "externalId": "1534394377149",
  "type": {
    "id": "hello",
    "name": "hello"
  },
  "stateName": "Processed",
  "senderId": "0:0:0:0:0:0:0:1",
  "receiverId": "/api/hello/world",
  "username": "Anonymous",
  "timestamp": 1534394377149,
  "logs": [],
  "properties": [
    {
      "key": "Integrate_Server",
      "value": "TORO Integrate@TORO-MM64:8080 (fe80:0:0:0:42cd:e074:a3d4:4fdc%utun0)"
    },
    {
      "key": "Duration(ms)",
      "value": "208"
    }
  ],
  "states": [
    {
      "id": 3,
      "name": "Received",
      "timeReceived": 1534394377149,
      "canBeResubmitted": false,
      "contentFileName": "request.xml",
      "contentSize": 5195
    },
    {
      "id": 4,
      "name": "Processed",
      "timeReceived": 1534394377366,
      "canBeResubmitted": false,
      "contentFileName": "response.txt",
      "contentSize": 15
    }
  ]
}
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
{
  "internalId": "d3d21653-e75c-46c1-a6a3-dfc82b0db9a6",
  "externalId": "1534394572980",
  "type": {
    "id": "hello",
    "name": "hello"
  },
  "stateName": "Processed",
  "senderId": "0:0:0:0:0:0:0:1",
  "receiverId": "/api/hello/world",
  "username": "Anonymous",
  "timestamp": 1534394572979,
  "logs": [],
  "properties": [
    {
      "key": "Integrate_Server",
      "value": "TORO Integrate@TORO-MM64:8080 (fe80:0:0:0:42cd:e074:a3d4:4fdc%utun0)"
    },
    {
      "key": "Duration(ms)",
      "value": "303"
    }
  ],
  "states": [
    {
      "id": 5,
      "name": "Received",
      "timeReceived": 1534394572979,
      "canBeResubmitted": false,
      "contentFileName": "request.xml",
      "contentSize": 5195
    },
    {
      "id": 6,
      "name": "Processed",
      "timeReceived": 1534394573295,
      "canBeResubmitted": false,
      "contentFileName": "response.txt",
      "contentSize": 15
    }
  ]
}
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
{
  "internalId": "97bdc10b-237f-4c27-97f9-867145ee7ad7",
  "externalId": "1534400984618",
  "type": {
    "id": "Scheduler",
    "name": "Scheduler"
  },
  "stateName": "Processed",
  "senderId": "SendScheduledEmail",
  "receiverId": "gloop:endpointServices.gloop.schedulerExamples.SendScheduledEmail/endpointServices.gloop.schedulerExamples.SendScheduledEmail",
  "username": "",
  "timestamp": 1534400984618,
  "logs": [],
  "properties": [
    {
      "key": "Duration(ms)",
      "value": "6350"
    }
  ],
  "states": [
    {
      "id": 7,
      "name": "Started",
      "timeReceived": 1534400984618,
      "canBeResubmitted": false,
      "contentFileName": "",
      "contentSize": 0
    },
    {
      "id": 8,
      "name": "Processed",
      "timeReceived": 1534400990995,
      "canBeResubmitted": false,
      "contentFileName": "",
      "contentSize": 0
    }
  ]
}

As you may notice, Groovy service, Gloop API, and ad hoc Gloop service endpoints have fairly similar fields.

  • By default, these types have set the leading URL mapping as the name and ID of the type of each document. In the example, all endpoints are accessible via the path /hello/{name}, wherein the leading URL path is hello.
  • The senderId is the IP address where the request came from.
  • The receoverId is the URL mapping where the request was received at.

Integrate endpoints service invocations differ in that:

  • The default name of their starting state is "Started" instead of "Received".
  • The senderId is the name of the endpoint itself.
  • The receiverId is the qualified name of the service of the endpoint.

  1. Displayed JSON data are obtained via the /tracker/document/{id} endpoint.