Analytics provides built-in support for collecting analytics data from various types of sources, such as agent-instrumented Java applications, .NET applications, browser applications, and more. The Analytics Events API supplements built-in analytics data sources with your custom data sources and event types.
In addition to the transaction events published by the app agents, custom events collected by the Analytics Events API are metered.
Publishing custom events requires Transaction Analytics licensing. Transaction Analytics license units determine the limit on the volume of custom events that you can publish. |
In Analytics, an event encapsulates a unit of analytics data. In APM, for example, each event corresponds to a method or service invocation, whether it be an entry point service or downstream service.
With the Analytics API, you define the structure of your own custom event in the data store, capture the event records as they occur in your custom source, and send them to the Events Service, the data store for Analytics. Once your data is in the Events Store, users can query your data through the Controller UI or the Analytics Events API.
Analytics Events API uses a shared key to authenticate clients to the Events Service. As a Controller or Analytics Administrator, you can generate API keys from the Controller UI. See Manage API Keys.
A Transaction Analytics license is required to use the Events Service API. The same licensing model that applies to business transactions for custom events (based on the number of events per unit/day) applies to the API. |
Unlike most REST APIs, which are presented at the Controller, you access the Analytics Events API by addressing the Events Service instance in the
platform.
You address the Events Service at one of the following URLs:
You can get the Analytics Domain URLs from the SaaS Domains and IP Ranges page.
For an on-premises Events Service, address the Events Service instance host (or more likely, the virtual IP presented by a load balancer for the Events Service cluster). Use the primary default listening port for the Events Service, 9080.
Calls to the Analytics Events API need to specify the <global_account_name>
or the <eum_account_name>
for the Controller account being address, and the <api_key>
generated by the administrator for this client. The API expects the values as headers, property-value pairs that are separated by a colon. As cURL arguments, for example, the values would be passed with curl through the `-H`
or `--header
option` as follows:
-H"X-Events-API-AccountName:<global_account_name> OR <eum_account_name>" -H"X-Events-API-Key:<api_key>" |
You can get the global account name to use from the License page in the Controller UI. The API keys are described in Manage API Keys.
The content type, also as a cURL argument, is:
-H"Content-type: application/vnd.appd.events+json;v=2" |
strongly recommends the use of SSL/HTTPS to access the API. Otherwise, the API key is sent in plain text.
For security reasons, the Analytics Events API, by default, does not accept cross-origin HTTP requests. For example, from links embedded directly in web pages. |
The Analytics Events API takes events as JSON-formatted name-value pair data.
Before sending data that conforms to a custom events schema, you need to define the data structure for the custom schema. The Events Service matches incoming events data to the appropriate schema.
yyyy-MM-dd'T'HH:mm:ss.SSSZZ
.Naming Restrictions
Custom event names and field names must conform to the following:
Two implicit timestamp fields are automatically added to custom schemas:
eventTimestamp
pickupTimestamp
The eventTimestamp
field represents the time an event occurred. An API client can specify a value for the timestamp field when it creates an event. If it does not, the Analytics Events API uses the same value for eventTimestamp
as it uses for another implicit field, pickupTimestamp
.The pickupTimestamp
field, which is always populated by the Events Service, represents the time the event was received by the Events Service.
When configuring a milestone in Business Journeys, you need to supply a date in the eventTimestamp
field in order for the event to register. In order to use Custom Events to define Business Journey, the custom events should send the eventTimestamp
field. If not, the Business Journeys will not work.
uses another timestamp,
eventcompletionTimestamp
, which is not automatically added to custom schemas. The eventcompletionTimestamp
field represents the time an event ends. Generally, uses this field internally to accurately report long-running events.
You can express all timestamp fields using ISO 8601 or UNIX epoch time (64-bit milliseconds) format.
The following steps take you through an on-premises API call workflow for using the Analytics Events API. The steps show cURL examples for creating a schema, publishing an event to that schema, and then querying the event.
Replace the value for the URL and port in the examples ( |
Define the schema by associating field names with data types. For example, the following defines a Purchase event type:
curl -X POST "<events_service_endpoint>:9080/events/schema/myProducts" -H"X-Events-API-AccountName:customer1_1234-567a-bccc-123" -H"X-Events-API-Key:a123b456-c789-1d23-e456-nnn" -H"Content-type: application/vnd.appd.events+json;v=2" -d '{"schema" : { "id": "string", "productBrand": "string", "userRating": "integer", "price": "float", "productName": "string", "description": "string" } }' |
Publish an event based on the schema you created:
curl -X POST "<events_service_endpoint>:9080/events/publish/myProducts" -H"X-Events-API-AccountName:customer1_1234-567a-bccc-123" -H"X-Events-API-Key:a123b456-c789-1d23-e456-nnn" -H"Content-type: application/vnd.appd.events+json;v=2" -d '[{"id": "5653b879ab33a","productBrand": "ACME","userRating": 3,"price": 2006.41,"productName": "Watch","description": "new watch"},{"id": "5653b879700","productBrand": "Widget","userRating": 1,"price": 3800.13,"productName": "Watch","description": "2015 watch"}]' |
Query the event data:
curl -X POST "http://<events_service_endpoint>:9080/events/query" -H"X-Events-API-AccountName:customer1_7xxx-467a-bccc-xxx" -H"X-Events-API-Key:a123b456-c789-1d23-e456-nnn" -H"Content-type: application/vnd.appd.events+text;v=2" -d 'SELECT * FROM myProducts' |
If including fields with ADQL keywords, enclose the keywords in single quotes. These keywords include, for example, between
, in
, select
, and others.
For a single query request, use this content type:
-H"Content-type: application/vnd.appd.events+text;v=2" |
In a multi-query request, the queries are passed as JSON body text. In this case, use the following content type header:
-H"Content-type: application/vnd.appd.events+json;v=2" |
Controller ingestion of custom events has the following limits:
Custom events limit increases are available for SaaS Events Service version 4.5.13 and later. On-premises Events Services cannot exceed a maximum of 1500 custom field events. |
By default, the Events Service allows you to create up to 1500 custom fields. If you reach 80% capacity of custom fields (1200 fields), the maximum field limit increases by 500 fields at the next index rollover.
For example, if you reach 1400 custom fields, your maximum field limit will increase from 1500 to 2000 fields. If you later reach 1800 custom fields, and maximum increases to 2500 fields.
You can create an absolute maximum of 3000 custom fields. Reaching or exceeding the maximum fields could result in lag or outages.
The Publish Events API call takes an array of events and stores them in the Events Service storage. The data must comply with an existing schema. A single request cannot publish to multiple event types.
If the event data doesn't match an event schema, the Events Service makes a best-effort attempt to match the data to the schema and returns a 400 bad request if unsuccessful.
|
N/A
Name | Description |
---|---|
| Account ID |
schemaName | Event schema name |
Name | Description |
---|---|
X-Events-API-AccountName | The global account name or the EUM account name, as shown on the Controller UI License page. |
X-Events-API-Key | The Analytics API key. See Manage API Keys |
Content-Type | The Content-Type of the request body. The default is application/vnd.appd.events+json;v=2 which also versions the resource representation (v=2). |
|
Error Code | Description |
---|---|
400 | The given request was invalid. |
401 | The given authentication information provided in the authorization header was invalid. |
404 | No event type could be found for this account. |
406 | The Accept header was not application/vnd.appd.events+json;v=2 . |
413 | The request body is larger than the max allowed size. |
415 | The Content-Type header was not application/vnd.appd.events+json;v=2 . |
429 | Too many requests. Returned when account or event reaches limits. |
Use this API to create your own event schema. The schema defines the overall structure of an event type by field and type.
You only need to use this API if the event you are uploading does not match an existing schema for first-class event types (such as logs or transactions). Events that conform to an existing schema automatically match that schema. Review the supported data types and naming restrictions described prior to this topic.
|
Name | Description |
---|---|
accountId | Account ID |
schemaName | Event schema name |
N/A
Name | Description |
---|---|
X-Events-API-AccountName | The global account name, as shown in the Controller UI License page. |
X-Events-API-Key | The Analytics API key. See Manage API Keys |
Accept | The Content-Type of the response body. The supported value is application/vnd.appd.events+json;v=2 . |
Content-type | The Content-Type of the request body. The default is application/vnd.appd.events+json;v=2 which also versions the resource representation (v=2). |
|
Use this API to retrieve an existing event schema.
|
Name | Description |
---|---|
accountId | Account ID |
schemaName | Event schema name |
N/A
Name | Description |
---|---|
X-Events-API-AccountName | The global account name, as shown in the Controller UI License page. |
X-Events-API-Key | The Analytics API key. See Manage API Keys |
Accept | The Content-Type of the response body. The supported value is application/vnd.appd.events+json;v=2 . |
|
Use this API to update an existing event schema by field. The request body defines the updates to be applied to the event schema.
As shown in the following example, you specify each field update action as a named section in the request body. The actions are represented by these fields:
For the Add field definition, you need to specify the data format for the new field, as you would when creating the event schema.
The response to this call should be the complete event schema as modified.
|
Name | Description |
---|---|
accountId | Account id |
schemaName | Event schema name |
N/A
Name | Description |
---|---|
X-Events-API-AccountName | The global account name, as shown in the Controller UI License page. |
X-Events-API-Key | The Analytics API key. See Manage API Keys. |
Accept | The Content-Type of the response body. The supported value is application/vnd.appd.events+json;v=2 . |
Content-type | The Content-Type of the request body. The default is application/vnd.appd.events+json;v=2 which also versions the resource representation (v=2). |
|
Use this API to delete an existing event schema.
|
Name | Description |
---|---|
accountId | Account id |
eventType | Event schema name |
N/A
Name | Description |
---|---|
X-Events-API-AccountName | The global account name or the EUM account name, as shown in the Controller UI License page. |
X-Events-API-Key | The Analytics API key. See Manage API Keys |
Accept | The Content-Type of the response body. The following is the supported value: application/vnd.appd.events+json;v=2 |
DELETE http://analytics.api.example.com/events/schema/{schemaName} HTTP/1.1 X-Events-API-AccountName:<global_account_name> OR <eum_account_name> X-Events-API-Key:<api_key> Accept: application/vnd.appd.events+json;v=2 |
When querying analytics events data, the following applies:
Every Events Service API has a limit of 200 searches per minute by each account on each event type.
The Analytics Query API can return a maximum of 10,000 results. If you would like to retrieve and paginate over the data, you can use the scroll mode. Scroll mode is limited to 1,000 results per batch.
Scroll mode cannot be used in Query Events (Multiple Queries). |
ADQL sets the rate limits on the following header fields to control large request volumes that may impact system stability:
X-Events-API-AccountName
: 450 requests per minute.X-Events-API-Key
: 145 requests per minute.LIMIT
is not specified in the SELECT
statement, the value specified in the URL query parameter is used. If the limit query parameter is also absent, the default is 100.This API can be used either as a simple text-formatted query or as a JSON-formatted query. The JSON-formatted query can accommodate multiple queries per call and is described in Query Events (Multiple Queries).
An event type might search against multiple event types. Therefore, the event type is not provided in the URL path or as a query parameter, but as part of the ADQL query provided in the request body itself. Your ADQL queries must adhere to the syntax described in the ADQL Reference.
This section describes the single query form for querying events.
|
Name | Description | |
---|---|---|
start | Filter results based on the minimum event timestamp, specified in ISO 8601 time (https://en.wikipedia.org/wiki/ISO_8601) or Unix time (http://en.wikipedia.org/wiki/Unix_time). If not specified, then the default is no minimum timestamp filtering. Note that data returned will always be limited by the data retention. Specify the time in combined UTC date and time format or epoch milliseconds. Start time is inclusive of limiting timestamps. | |
end | Filter results based on the maximum event timestamp, specified in ISO 8601 time (https://en.wikipedia.org/wiki/ISO_8601) or Unix time (http://en.wikipedia.org/wiki/Unix_time). If not specified, then the default is no maximum timestamp filtering.
Specify the time in combined UTC date and time format or epoch milliseconds. End time is inclusive of limiting timestamps. | |
limit | Limits the number of results returned. The default value is 100. The upper limit on the results that can be fetched is 1,000. | |
mode | The default mode is none. You can use the scroll mode to fetch bulk data and paginate over 10,000 ADQL results. Unless a limit is specified in the query, the API enables the Events Service to fetch beyond the maximum limit. The default mode supports aggregation but the scroll mode does not support aggregation or math operations. Order by queries is supported in scroll mode. Scroll queries returns results in batches. Every request response contains results along with a |
Name | Description |
---|---|
X-Events-API-AccountName | The global account name or the EUM account name, as shown in the Controller UI License page. |
X-Events-API-Key | The Analytics API key. See Manage API Keys. |
Accept | The Content-Type of the response body. The supported value is application/vnd.appd.events+json;v=2 . |
Content-type | The Content-Type of the request body. The default is application/vnd.appd.events+json;v=2 which also versions the resource representation (v=2). |
|
|
Use this API to execute multiple queries against a particular account and event type in parallel. A query event that specifies multiple queries does so by including multiple ADQL queries in the body of the request. Your ADQL queries must adhere to the syntax described in the ADQL Reference.
Using queries in this form takes advantage of certain backend optimizations in query performance. Query filter criteria, such as time range and limit, can be overridden by each inner query.
The Multi-Query Events API is limited to twenty queries per HTTP request. |
|
None
Name | Description |
---|---|
start | Filter results based on the minimum event timestamp, specified in ISO 8601 time or Unix time. If not specified, then the default is no minimum timestamp filtering. Specify the time in combined UTC date and time format or epoch milliseconds. Start time is inclusive of limiting timestamps. |
end | Filter results based on the maximum event timestamp, specified in ISO 8601 time or Unix time. If not specified, then the default is no maximum timestamp filtering. Specify the time in combined UTC date and time format or epoch milliseconds. End time is inclusive of limiting timestamps. |
limit | Limits the number of results returned. The default value is 100. The upper limit on the results that can be fetched is 10,000. |
Name | Description |
---|---|
X-Events-API-AccountName | The global account name or the EUM account name, as shown in the Controller UI License page. |
X-Events-API-Key | The Analytics API key. See Manage API Keys. |
Accept | The Content-Type of the response body. The supported value is application/vnd.appd.events+json;v=2 . |
Content-type | The Content-Type of the request body. The default is application/vnd.appd.events+json;v=2 which also versions the resource representation (v=2). |
Field | Description |
---|---|
label | (Optional) Friendly name to identify the query. |
query | ADQL query to execute. |
start | (Optional) Overrides the start parameter value provided as a query parameter. |
end | (Optional) Overrides the end parameter value provided as a query parameter. |
limit | (Optional) Overrides the limit provided as a query parameter. |
|